chenkainan 4 months ago
parent
commit
e68a4d20f6
  1. 479
      pages/cart/cart.vue
  2. 27
      static/js/CommonFunction.js
  3. 5
      static/js/request.js
  4. 6
      store/modules/user.js
  5. 2
      subPackages/food/detail.vue
  6. 19
      subPackages/food/order.vue
  7. 4
      subPackages/techan/detail.vue
  8. 14
      subPackages/techan/index.vue
  9. 112
      subPackages/techan/order.vue
  10. 69
      subPackages/techan/selfPickUpPoint.vue
  11. 16
      subPackages/ticket/order.vue

479
pages/cart/cart.vue

@ -1,5 +1,73 @@
<template> <template>
<view class="bg bg-padding"> <view class="bg bg-padding">
<view class="del-all" @click="delAll()">全部删除</view>
<uni-swipe-action>
<view class="cart-container" v-for="(item,i) in cartList" :key="i">
<view class="flex" style="align-items: center;padding: 20rpx;">
<view class="no-select" v-show="!item.is_seld" @click="changeShopSelect(item,true)"></view>
<image class="select-img" v-show="item.is_seld" @click="changeShopSelect(item,false)" src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png"></image>
<view class="shop-name">{{item.shop_name}} <uni-icons type="right" size="12"></uni-icons></view>
<view style="font-size: 27rpx;color: #7C7C7C;" @click="delCartByShop(item,index)">删除</view>
</view>
<uni-swipe-action-item v-for="(goods,goodsIndex) in item.goods" :key="goodsIndex">
<view class="cart-item" :style="{'padding-bottom':goods.product.type=='hotel'?'60rpx':'20rpx'}">
<view class="flex-between">
<view class="no-select" v-show="!goods.is_seld" @click="changeGoodsSelect(goods,true)"></view>
<image class="select-img" v-show="goods.is_seld" @click="changeGoodsSelect(goods,false)" src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png"></image>
<image class="cart-img" :src="goods.sku.headimg"></image>
</view>
<view class="cart-content">
<view>
<view class="title text-overflow">{{goods.product.title}}</view>
<view class="sku-name text-overflow">{{goods.sku.sku_name}}</view>
</view>
<view class="flex-between">
<view class="price">{{goods.sku.price/100}}</view>
<view class="flex-between">
<view :class="['ctrl',goods.num<=1?'disabled':'']" @click="addBuyNum(goods,-1)">-</view>
<view style="padding: 0 20rpx;">{{goods.num}}</view>
<view class="ctrl" @click="addBuyNum(goods,1)">+</view>
</view>
</view>
</view>
<view class="time-select" v-if="goods.product.type=='hotel'">
<view v-if="goods.start_time&&goods.end_time"></view>
<view v-else>请选择时间</view>
>>
</view>
<view class="off-cover" v-if="goods.sku.flag == 'off'" @click="delItem(goods)">
<view>商品已失效</view>
<view class="off-btn">删除</view>
</view>
</view>
<template v-if="goods.sku.flag != 'off'" v-slot:right>
<view class="cart-item-del" @click="delItem(goods)">
<uni-icons type="trash" size="16" color="#fff"></uni-icons>
<view>删除</view>
</view>
</template>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<view style="width: 1rpx;height: 250rpx;"></view>
<view class="bottom-btn">
<view class="flex" style="align-items: center;">
<view @click="selectAllData(true)" class="no-select" v-show="!selectAll" style="margin-right: 12rpx;"></view>
<image @click="selectAllData(false)" class="select-img" v-show="selectAll" style="margin-right: 12rpx;" src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png"></image>
<text>全选</text>
<text style="padding-left: 20rpx;">合计</text>
<text class="price">{{total()}}</text>
</view>
<view class="btn" @click="goOrder()">去下单</view>
</view>
<CustomTabBar :currentTab="3" /> <CustomTabBar :currentTab="3" />
</view> </view>
</template> </template>
@ -12,20 +80,423 @@
}, },
data() { data() {
return { return {
cartList: [],
allPrice: 0,
selectAll: false,
} }
}, },
onLoad() { onLoad() {
},
onShow() {
this.getList()
}, },
methods: { methods: {
getList () {
this.Post({},"/api/cart/get_list").then(res=>{
let resData = (res.data ||[])
let shopSelectIds = []
let skuSelectIds = []
this.cartList.forEach(v=>{
if (v.is_seld) {shopSelectIds.push(v.id)}
v.goods.forEach(x=>{
if(x.is_seld) {skuSelectIds.push(x.sku_id)}
})
})
resData.forEach(v=>{
v.is_seld = shopSelectIds.includes(v.id)
// v.show = true
v.goods.forEach(x=>{
x.is_seld = skuSelectIds.includes(x.sku_id)
// v.show = true
})
})
this.cartList = resData
this.judgeSelectAll()
}).finally(()=>{
uni.hideLoading()
})
},
// /
addBuyNum(item,num,index){
console.log(item)
if (num == -1 && item.num == 1) {
return //
this.delItem(item)
} else {
let numData = item.num + num
this.Post({sku_id: item.sku_id, num: numData},'/api/cart/update_sku').then(res =>{
item.num += num
})
}
},
//
delItem(item){
this.Post({sku_id: item.sku_id},'/api/cart/del_sku').then(res =>{
// this.cartData.splice(index,1)
this.getList()
})
},
//
delCartByShop (item, index) {
let goods = item.goods.map(v=>v.sku_id)
this.Post({sku_id: goods.join(',')},'/api/cart/del_sku').then(res =>{
this.getList()
})
},
//
delAll () {
let goods = []
this.cartList.forEach(v=>{
v.goods.forEach(x=>{goods.push(x.sku_id)})
})
this.Post({sku_id: goods.join(',')},'/api/cart/del_sku').then(res =>{
this.getList()
})
},
//
selectAllData (flag) {
this.selectAll = flag
if (flag) {
this.cartList.forEach(t=>{
t.goods.forEach(v=>{
if (v && v.product &&v.sku) {
if (v.sku.flag== "off") {
v.is_seld = false
} else {
if (v.product.type == 'hotel'&&(!v.strat_time||!v.end_time)) {
v.is_seld = false
} else {
v.is_seld = true
}
}
}
})
})
} else {
this.cartList.forEach(v=>{
v.is_seld = false
})
}
this.judgeSelectAll()
},
//
changeShopSelect(item, flag) {
if (flag) {
item.goods.forEach(v=>{
if (v.sku.flag== "off") {
v.is_seld = false
} else {
if (v.product.type == 'hotel'&&(!v.strat_time||!v.end_time)) {
v.is_seld = false
} else {
v.is_seld = true
}
}
})
item.is_seld = true
} else {
item.goods.forEach(v=>{
v.is_seld = false
})
item.is_seld = false
}
this.judgeSelectAll()
},
//
changeGoodsSelect(item,flag) {
if (flag) {
if (item.sku.flag== "off") {
item.is_seld = false
} else {
if (item.product.type == 'hotel'&&(!item.strat_time||!item.end_time)) {
item.is_seld = false
uni.showToast({
title:'酒店产品需要选择时间',
icon:'none'
})
} else {
item.is_seld = true
}
}
} else {
item.is_seld = false
}
this.judgeSelectAll()
},
//
judgeSelectAll () {
this.cartList.forEach(v=>{
if(v.goods.some(x=>x.sku&& x.sku.flag!= "off"&&!x.is_seld)) {
v.is_seld = false;
} else {
v.is_seld = true;
}
})
if (this.cartList.every(v=>v.is_seld)) {
this.selectAll = true
} else {
this.selectAll = false
}
},
//
goOrder () {
let buyGoods = this.cartList.filter(v=>v.is_seld)
if (buyGoods.length<=0) {
uni.showToast({
title: '请选择要购买的产品',
icon: 'none'
})
}
let ticketOrderList = [] //
let foodOrderList = [] //
let techanOrderList = [] //
let hotelOrderList = [] //
buyGoods.forEach(v=>{
if (v.product.is_package == 1) {
foodOrderList.push({
pInfo: v.product,
sInfo: {...v.sku, buyNum: v.num}
})
} else if (v.product.type == "ticket") {
ticketOrderList.push({
pInfo: v.product,
sInfo: {...v.sku, buyNum: v.num}
})
} else if (v.product.type == "post") {
techanOrderList.push({
pInfo: v.product,
sInfo: {...v.sku, buyNum: v.num}
})
} else if (v.product.type == "hotel") {
hotelOrderList.push(v)
}
})
// todo
this.$store.commit("changeTechanOrderList", techanOrderList);
this.$store.commit("changeTicketOrderList", ticketOrderList);
this.$store.commit("changeFoodOrderList", foodOrderList);
this.$store.commit("changeHotelOrderList", hotelOrderList);
// > > >
this.goCartNextPage(0)
},
total () {
return 0
},
},
onReachBottom() {
} }
} }
</script> </script>
<style> <style scoped lang="scss">
.bg { .bg {
min-height: 100vh;
padding: 26rpx 26rpx 0;
}
.cart-container{
width: 100%;
background: #FFFFFF;
border-radius: 20rpx;
margin-bottom: 26rpx;
padding-bottom: 20rpx;
.shop-name{
font-weight: 500;
font-size: 35rpx;
color: #000000;
flex: 1;
width: 1rpx;
line-height: 57rpx;
padding-right: 24rpx;
}
}
.no-select{
width: 37rpx;
height: 37rpx;
border-radius: 50%;
border: 1px solid #666666;
flex-shrink: 0;
margin-right: 24rpx;
}
.select-img{
width: 37rpx;
height: 37rpx;
border-radius: 50%;
flex-shrink: 0;
margin-right: 24rpx;
}
.cart-item{
display: flex;
align-items: flex-start;
position: relative;
padding: 20rpx;
.cart-img{
width: 173rpx;
height: 173rpx;
border-radius: 13rpx;
flex-shrink: 0;
}
.cart-content{
flex: 1;
min-height: 173rpx;
padding-left: 20rpx;
width: 1rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.title{
font-weight: normal;
font-size: 31rpx;
color: #000000;
}
.sku-name{
font-weight: 500;
font-size: 27rpx;
color: #7C7C7C;
}
.price{
font-size: 37rpx;
font-weight: 500;
color: #C3282E;
&::before{
content: '¥';
font-size: 27rpx;
}
}
.ctrl{
width: 47rpx;
height: 47rpx;
background: #6A8A27;
border-radius: 50%;
font-weight: 400;
font-size: 34rpx;
color: #FFFFFF;
text-align: center;
line-height: 47rpx;
&.disabled{
background: #E8E8E8;
color: #999999;
}
}
}
.off-cover{
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3);
font-weight: 400;
font-size: 27rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
.off-btn{
width: 67rpx;
height: 67rpx;
background: #FFFFFF;
border-radius: 50%;
font-weight: 400;
font-size: 27rpx;
color: #000000;
text-align: center;
line-height: 67rpx;
margin-left: 18rpx;
}
}
.cart-item-del{
width: 80rpx;
height: 100%;
background: #FF0505;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-weight: normal;
font-size: 24rpx;
color: #FFFFFF;
margin-left: 10rpx;
}
.bottom-btn{
width: 100%;
height: 125rpx;
background: #FFFFFF;
display: flex;
align-items: center;
position: fixed;
justify-content: space-between;
padding:0 26rpx;
bottom: 133rpx;
left: 0;
z-index: 50;
border-bottom: 1px solid #F7F7F7;
font-weight: 400;
font-size: 28rpx;
color: #393B3E;
.price{
font-size: 44rpx;
font-weight: 500;
color: #C3282E;
padding-left: 33rpx;
line-height: 0;
&::before{
content: "¥";
font-size: 24rpx;
}
}
.btn{
width: 300rpx;
height: 80rpx;
background: #6A8A27;
border-radius: 13rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
line-height: 80rpx;
}
}
.time-select{
height: 43rpx;
background: rgba(106,138,39,0.2);
border-radius: 8rpx;
font-weight: 400;
font-size: 27rpx;
color: #6A8A27;
text-align: center;
line-height: 43rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 20rpx;
position: absolute;
bottom: 0;
right: 20rpx;
}
.del-all{
font-weight: normal;
font-size: 32rpx;
color: #000000;
text-align: right;
padding-bottom: 25rpx;
} }
</style> </style>

27
static/js/CommonFunction.js

@ -281,4 +281,31 @@ Vue.prototype.goCartPage = ()=>{
uni.switchTab({ uni.switchTab({
url: "/pages/cart/cart" url: "/pages/cart/cart"
}) })
},
// 购物车下单去下个页面
Vue.prototype.goCartNextPage= function(currentPageIndex){
// currentPage "" 购物车 'techan' 'ticket' 'food' 'hotel'
// 0 1 2 3 4
let techanOrderList = this.$store.state.user.techanOrderList;
let ticketOrderList = this.$store.state.user.ticketOrderList;
let foodOrderList = this.$store.state.user.foodOrderList;
let hotelOrderList = this.$store.state.user.hotelOrderList;
let orderPage = [
{path: '/subPackages/techan/order', length: techanOrderList.length},
{path: '/subPackages/ticket/order', length: ticketOrderList.length},
{path: '/subPackages/food/order', length: foodOrderList.length},
{path: '',length: hotelOrderList.length}
]
let nextPage = orderPage.find((v,index)=>v.length>0&&index>=currentPageIndex)
if (nextPage) {
console.log(nextPage)
uni.navigateTo({
url: nextPage.path+'?isShoppingCart=1'
})
} else {
console.log(orderPage, nextPage, '结束')
// todo 最后下单页面
}
} }

5
static/js/request.js

@ -3,7 +3,7 @@ import store from '@/store';
// 定义 API URL // 定义 API URL
// const DEV_API_URL = 'https://api.cloud.sz-trip.com'; // const DEV_API_URL = 'https://api.cloud.sz-trip.com';
const DEV_API_URL = 'https://swsz.api.js-dyyj.com'; const DEV_API_URL = 'https://swsz.api.js-dyyj.com'
const PROD_API_URL = 'https://swsz.api.js-dyyj.com'; const PROD_API_URL = 'https://swsz.api.js-dyyj.com';
const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL;
@ -40,7 +40,8 @@ Vue.prototype.NEWAPIURL = '/api';
// #endif // #endif
Vue.prototype.Post = (params = {}, apiurl) => { Vue.prototype.Post = (params = {}, apiurl) => {
const token = getToken() || 'a090644d-2bdb-4807-833b-bb5bc2182ac5'; // const token = getToken() || '0caa10fc-6d65-4d9c-8e57-b344be3fc526'; // 君到苏州
const token = getToken() || 'a090644d-2bdb-4807-833b-bb5bc2182ac5' // 时味苏州
if (token) { if (token) {
params.token = token; params.token = token;
} }

6
store/modules/user.js

@ -17,7 +17,7 @@ export default {
ticketOrderList: [], // 门票类下单 ticketOrderList: [], // 门票类下单
foodOrderList: [], // 农家烟火下单 foodOrderList: [], // 农家烟火下单
techanOrderList: [], // 邮寄自提下单 techanOrderList: [], // 邮寄自提下单
hotelOrderList: [], // 酒店下单
meetRoomReserve: { meetRoomReserve: {
date: null, //使用日期信息 date: null, //使用日期信息
coupon: null, // 优惠券信息 coupon: null, // 优惠券信息
@ -88,5 +88,9 @@ export default {
changeFoodOrderList(state, data){ changeFoodOrderList(state, data){
state.foodOrderList = data state.foodOrderList = data
}, },
// 酒店下单
changeHotelOrderList(state, data){
state.hotelOrderList = data
},
} }
} }

2
subPackages/food/detail.vue

@ -271,7 +271,7 @@
sInfo: goods, sInfo: goods,
}] }]
uni.setStorageSync('foodOrder', JSON.stringify(orderInfo)); // this.$store.commit("changeFoodOrderList", orderInfo);
uni.navigateTo({ uni.navigateTo({
url: '/subPackages/food/order' url: '/subPackages/food/order'
}); });

19
subPackages/food/order.vue

@ -148,15 +148,7 @@
initPageData () { initPageData () {
let data = uni.getStorageSync('foodOrder'); this.orderList = this.$store.state.user.foodOrderList;
try{
data = JSON.parse(data)
this.orderList = data
console.log(this.orderList)
} catch(e){
console.log(e)
}
this.getMaxCouponData() this.getMaxCouponData()
}, },
@ -238,10 +230,17 @@
goods.push(param) goods.push(param)
}) })
//
if (this.isShoppingCart) {
this.$store.commit("changeFoodOrderList", this.orderList);
this.goCartNextPage(3)
return
}
let data = { let data = {
product_list: goods, product_list: goods,
coupon_id: this.coupon ? this.coupon.id : "", coupon_id: this.coupon ? this.coupon.id : null,
} }
console.log('data数据',data); console.log('data数据',data);
this.Post({ this.Post({

4
subPackages/techan/detail.vue

@ -245,13 +245,13 @@
// post: 0, // post: 0,
}] }]
uni.setStorageSync('teChanOrder', JSON.stringify(orderInfo)); // this.$store.commit("changeTechanOrderList", orderInfo);
uni.navigateTo({ uni.navigateTo({
url: '/subPackages/techan/order' url: '/subPackages/techan/order'
}); });
}, },
addToCart () { addToCart () {
let goods = this.trueSku[this.productIndex] let goods = this.sku[this.productIndex]
goods.buyNum = this.buyNum goods.buyNum = this.buyNum
this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => { this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) { if (res.code == 1) {

14
subPackages/techan/index.vue

@ -26,7 +26,7 @@
</scroll-view> </scroll-view>
<view class="more-btn" @click="showTypes(true)"> <view class="more-btn" @click="showTypes(true)">
展开 展开<image style="width: 22rpx;height: 22rpx;" src="https://static.ticket.sz-trip.com/uploads/20250617/42345fdf6426e5dd533fd7461c3642a0.png"></image>
</view> </view>
</view> </view>
@ -34,7 +34,7 @@
<view class="goods-container"> <view class="goods-container">
<view class="search-container"> <view class="search-container">
<view > <view >
<text :class="[search_type==0?'active-search-item':'']">综合</text> <text :class="[search_type==0?'active-search-item':'']" @click="changeSearchParm(0)">综合</text>
</view> </view>
<view > <view >
<text :class="[[1,2].includes(search_type)?'active-search-item':'']">销量</text> <text :class="[[1,2].includes(search_type)?'active-search-item':'']">销量</text>
@ -123,7 +123,7 @@
</view> </view>
<!-- 购物车 --> <!-- 购物车 -->
<view class="btn-bottom" > <!-- <view class="btn-bottom" >
<cartDataVue ref="cartDataVueRef" :paramData="paramData" @changeParamData="changeParamData" style="width: 100%;height: 100%;"> <cartDataVue ref="cartDataVueRef" :paramData="paramData" @changeParamData="changeParamData" style="width: 100%;height: 100%;">
<template class="btn-list" slot="content"> <template class="btn-list" slot="content">
@ -148,7 +148,7 @@
</template> </template>
</cartDataVue> </cartDataVue>
</view> </view> -->
<uni-popup ref="popup" type="bottom" :safe-area="true"> <uni-popup ref="popup" type="bottom" :safe-area="true">
<view class="popup-content" v-if="sku.length>0"> <view class="popup-content" v-if="sku.length>0">
@ -230,7 +230,7 @@
statusBarHeight: 0, statusBarHeight: 0,
headImg: "https://cgc.js-dyyj.com/uploads/20250513/f8b255f965efcd71b6843e4b72c3f1f3.png", headImg: "https://cgc.js-dyyj.com/uploads/20250513/f8b255f965efcd71b6843e4b72c3f1f3.png",
type_pid: 646, type_pid: 20,
typeParam: [], typeParam: [],
typeIndex: 0, typeIndex: 0,
list:[], list:[],
@ -402,7 +402,7 @@
this.$refs.popup.open() this.$refs.popup.open()
}, },
addToCart() { addToCart() {
let goods = this.trueSku[this.productIndex] let goods = this.sku[this.productIndex]
goods.buyNum = this.buyNum goods.buyNum = this.buyNum
this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => { this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) { if (res.code == 1) {
@ -582,6 +582,8 @@
width: 67rpx; width: 67rpx;
background: #EDF5DC; background: #EDF5DC;
padding: 24rpx 20rpx; padding: 24rpx 20rpx;
text-align: center;
line-height: 1.2;
} }
.goods-container{ .goods-container{

112
subPackages/techan/order.vue

@ -46,7 +46,7 @@
<view class="pickpoint"> <view class="pickpoint">
<view class="flex-shrink-0">自提点</view> <view class="flex-shrink-0">自提点</view>
<view class="pickpointAddress"> <view class="pickpointAddress">
<view class="pointAddressText text-overflow">{{info.pickupAddress.extract_name||'选择提货地址'}}</view> <view class="pointAddressText text-overflow">{{info.pickupAddress.title||'选择提货地址'}}</view>
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons> <uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons>
</view> </view>
</view> </view>
@ -97,7 +97,7 @@
<view class="tickets-box flex-between"> <view class="tickets-box flex-between">
<view class="remark"> <view class="remark">
<view class="remark-title" >订单备注:</view> <view class="remark-title" >订单备注:</view>
<input style="z-index:0;text-align: right;" type="text" placeholder="选填" v-model="remark" maxlength="50"/> <input style="z-index:0;text-align: right;" type="text" placeholder="选填" v-model="info.remark" maxlength="50"/>
</view> </view>
</view> </view>
</view> </view>
@ -196,7 +196,6 @@ export default {
post: 0, post: 0,
flag: true, flag: true,
remark: '',
coupon: "", coupon: "",
allprice: 0, allprice: 0,
@ -238,19 +237,21 @@ export default {
}, },
methods: { methods: {
handleOrderGoods () { handleOrderGoods () {
let orderList = JSON.parse(uni.getStorageSync('teChanOrder')); let orderList = this.$store.state.user.techanOrderList;
if (!Array.isArray(orderList) || orderList.length<=0) { if (!Array.isArray(orderList) || orderList.length<=0) {
uni.navigateBack(); uni.navigateBack();
return return
} }
console.log(orderList)
// use_type 0 1 3 // use_type 0 1 3
// is_post 1 2 1 // is_post 1 2 1
orderList.forEach(v=>{ orderList.forEach(v=>{
v.is_post = v.sInfo.use_type==0?1:v.sInfo.use_type==1?2:3 // v.is_post = v.sInfo.use_type==3?3:v.sInfo.use_type==1?2:1 //
v.is_user_post = v.sInfo.use_type==1?2:1 // v.is_user_post = v.sInfo.use_type==1?2:1 //
v.pickupAddress = {} // v.pickupAddress = v.pickupAddress || {} //
v.contacts = null // v.contacts = v.contacts || null //
v.post = null // v.post = v.post || null //
v.remark = v.remark||""
}) })
this.orderList = orderList this.orderList = orderList
@ -261,6 +262,7 @@ export default {
changeUserPost (item,value) { changeUserPost (item,value) {
console.log(item) console.log(item)
item.is_user_post = value item.is_user_post = value
this.getPost()
}, },
goOrderCoupon () { goOrderCoupon () {
@ -308,32 +310,32 @@ export default {
}); });
}, },
getPost() { getPost() {
let _this = this
let tempList = [] let tempList = []
this.orderList.forEach(v=>{ this.orderList.forEach(v=>{
if( v.sInfo.contacts && v.is_user_post == 1) { if( v.contacts && v.is_user_post == 1) {
tempList.push(v) tempList.push(v)
} }
}) })
let param = [] let param = []
tempList.forEach(v=>{ tempList.forEach(v=>{
param.push({specifications_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id})
}) })
let data = JSON.stringify(param); let data = JSON.stringify(param);
// console.log(data); // console.log(data);
this.flag = false; this.flag = false;
this.Post({ data: data }, '/api/order/getNewPost').then(res => {
Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{
if (res) { if (res) {
console.log("promise" ,res)
for(let i=0;i<tempList.length;i++) { for(let i=0;i<tempList.length;i++) {
tempList[i].post = res.data[i].price; tempList[i].post = res[i].data.price;
} }
this.flag = true;
} }
}).catch(err=>{ }).finally(()=>{this.flag = true;})
console.log(err,'aaaaaaa');
this.flag = true;
});
}, },
plus(sku) { plus(sku) {
@ -374,7 +376,7 @@ export default {
this.selectInfo.contacts = item this.selectInfo.contacts = item
if (this.flag) { if (this.flag) {
// this.getPost(); this.getPost();
} }
this.$refs.addressPopup.close(); this.$refs.addressPopup.close();
}, },
@ -443,57 +445,60 @@ export default {
}, },
// //
order() { order() {
if (this.info.is_user_post == 1 || this.info.is_user_post == 3) { let goods = [];
console.log(this.info.is_user_post) for(let info of this.orderList) {
if (this.info.is_user_post == 1 && !this.contacts) { let param = {
uni.showToast({ type: info.pInfo.type,
title: '请选择收货地址', product_id: info.pInfo.id,
icon: 'none' sku_id: info.sInfo.id,
}); product_num: info.sInfo.buyNum,
return; remark: info.remark
} }
if (info.is_user_post == 1) {
if (this.info.is_user_post == 2) { if(!info.contacts) {
uni.showToast({
title: '请选择收货地址',
icon: 'none'
});
return;
} else {
param.use_type = 1
param.post = info.contacts.id
}
}
if (info.is_user_post == 2) {
if (!this.pickupAddress.id) { if (!this.pickupAddress.id) {
uni.showToast({title: '请选择自提点',icon: 'none'}); uni.showToast({title: '请选择自提点',icon: 'none'});
return; return;
} else {
param.use_type = 2
param.pickup_shop_id = info.pickupAddress.id
param.pickup_shop_info = info.pickupAddress
} }
} }
goods.push(param)
} }
let goods = [];
this.info.goods.forEach(v=>{
let goodsItem = {
specifications_id: v.skuInfo.id,
num: v.skuInfo.buyNum,
};
if (this.info.is_user_post == 2) {
goodsItem.extract_id = this.pickupAddress.id;
} else if (this.info.is_user_post == 1){
goodsItem.consignee_id = this.contacts.id
}
goods.push(goodsItem);
})
//
if (this.isShoppingCart) {
this.$store.commit("changeTechanOrderList", this.orderList);
this.goCartNextPage(1)
return
}
let data = { let data = {
goods: goods, product_list: goods,
coupon: this.coupon ? this.coupon.id : "", coupon_id: this.coupon ? this.coupon.id : null,
remark: this.remark,
is_post: this.info.is_user_post,
}; };
this.Post( this.Post(
{ {
method: 'POST', method: 'POST',
data: JSON.stringify(data) data: JSON.stringify(data)
}, },
'/api/order/place' '/api/order/create'
).then(res => { ).then(res => {
uni.removeStorageSync('teChanOrder')
uni.removeStorageSync('teChanInfo')
if (res.code == 1) { if (res.code == 1) {
this.Post( this.Post(
{ {
@ -532,7 +537,8 @@ export default {
getDataByConnect(data) { getDataByConnect(data) {
if (data.msgType == "updatePickUpPoint") { if (data.msgType == "updatePickUpPoint") {
let tempData = this.orderList.find(v=>v.sInfo.id == data.data.goodsId) let tempData = this.orderList.find(v=>v.pInfo.id == data.data.pInfoId)
console.log(tempData)
if (tempData) { if (tempData) {
tempData.pickupAddress = data.data.selectItem tempData.pickupAddress = data.data.selectItem
} }

69
subPackages/techan/selfPickUpPoint.vue

@ -2,19 +2,17 @@
<view class="bg"> <view class="bg">
<view :class="['item-bg',selectItem.id==item.id?'active':'']" v-for="(item,index) in list" :key="index" @click="selectPoint(item)"> <view :class="['item-bg',selectItem.id==item.id?'active':'']" v-for="(item,index) in list" :key="index" @click="selectPoint(item)">
<view class="item"> <view class="item">
<view class="item-point-title"> <view class="item-point-title">
<view class="name text-overflow flex-shrink-0">{{item.extract_name}}</view> <view class="name">{{item.title}}</view>
<view class="addressStr"> <view style="padding: 10rpx 0;">营业时间{{item.remark}}</view>
<!-- <view class="flex-shrink-0"></view> --> <view >地址{{item.address}}</view>
<view class="text-overflowRows">地址{{item.detail_addr}}</view>
</view> </view>
</view> <view class="item-point-guide" @click.stop="goMap(item)">
<view class="item-point-guide" @click.stop="goMap(item)"> <view>
<view> <image src="https://static.ticket.sz-trip.com/uploads/20250617/69e16394a2a95657a08eaa5c685c9f1d.png" mode="aspectFill" class="mapPoint"></image>
<image :src="showImg('/uploads/20241104/8ff7aa0225c9e4fb86df1a9cb229c932.png')" mode="aspectFill" class="mapPoint"></image> </view>
<view class="distance" v-if="item.distance">距离{{item.distance.toFixed(2)}}km</view>
</view> </view>
<view>去这里</view>
</view>
</view> </view>
</view> </view>
<view class="no-data" v-if="list.length==0"> <view class="no-data" v-if="list.length==0">
@ -23,11 +21,11 @@
暂无自提点地址 暂无自提点地址
</view> </view>
</view> </view>
<!-- <view class="btn-bottom"> <view class="btn-bottom">
<view class="addBox" @click.stop="confirmPoint"> <view class="addBox" @click.stop="confirmPoint">
确定 确定
</view> </view>
</view> --> </view>
</view> </view>
@ -62,8 +60,8 @@
// this.getLocation() // this.getLocation()
let param = { let param = {
product_id: this.goodsId, product_id: this.goodsId,
lon: uni.getStorageSync('location').lon || '', lon: uni.getStorageSync('location').lon || '36',
lat: uni.getStorageSync('location').lat || '', lat: uni.getStorageSync('location').lat || '29',
} }
this.Post(param, "/api/product/getDeliverShop").then(res => { this.Post(param, "/api/product/getDeliverShop").then(res => {
if (res) { if (res) {
@ -87,8 +85,8 @@
selectPoint (item) { selectPoint (item) {
this.selectItem = item this.selectItem = item
// selectItem // selectItem
uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}}) // uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}})
uni.navigateBack() // uni.navigateBack()
}, },
goMap (item) { goMap (item) {
@ -109,7 +107,7 @@
return; return;
} }
// selectItem // selectItem
uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, skuId: this.goodsId}}) uni.$emit("updateDataByConnect", {msgType:'updatePickUpPoint',data:{selectItem: this.selectItem, pInfoId: this.goodsId}})
uni.navigateBack() uni.navigateBack()
} }
}, },
@ -136,12 +134,14 @@
} }
.item-bg{ .item-bg{
width: 697rpx; width: 697rpx;
height: 160rpx; min-height: 160rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 13rpx; border-radius: 13rpx;
margin: 0 auto; margin: 0 auto;
margin-bottom: 28rpx; margin-bottom: 28rpx;
padding: 2rpx; &.active{
border:1px solid #6A8A2D;
}
} }
.item { .item {
@ -159,6 +159,9 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
font-weight: 500;
font-size: 27rpx;
color: #999999;
} }
.item-point-guide{ .item-point-guide{
width:140rpx; width:140rpx;
@ -176,23 +179,14 @@
height: 33rpx; height: 33rpx;
} }
} }
.item-bg.active{
background: #515150;
}
.name { .name {
display: flex; display: flex;
font-size: 31rpx; font-size: 31rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
height: 42rpx;
}
.addressStr{
display: flex;
font-size: 27rpx;
color: #999999;
padding-top: 10rpx;
} }
.no-data { .no-data {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
@ -231,9 +225,9 @@
.addBox{ .addBox{
margin: 0 auto; margin: 0 auto;
width: 697rpx; width: 697rpx;
height: 80rpx; height: 73rpx;
background: linear-gradient(90deg, #F84A56, #FF9834); background: #6A8A2D;
border-radius: 40rpx; border-radius: 11rpx;
font-size: 36rpx; font-size: 36rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
@ -242,5 +236,12 @@
text-align: center; text-align: center;
} }
} }
.distance{
font-weight: 500;
font-size: 24rpx;
color: #6A8A2D;
text-align: center;
padding-top: 11rpx;
word-wrap: break-all;
}
</style> </style>

16
subPackages/ticket/order.vue

@ -174,13 +174,18 @@
} }
}, },
onLoad(options) { onLoad(options) {
if (options.isShoppingCart) {
this.isShoppingCart = options.isShoppingCart
}
// this.getList(); // this.getList();
this.$store.commit("choseCoupon", ""); this.$store.commit("choseCoupon", "");
this.initPageData() this.initPageData()
}, },
onShow() { onShow() {
this.coupon = this.$store.state.user.coupon if (!this.isShoppingCart) {
this.coupon = this.$store.state.user.coupon
}
}, },
methods: { methods: {
@ -420,10 +425,17 @@
goods.push(param) goods.push(param)
}) })
//
if (this.isShoppingCart) {
this.$store.commit("changeTicketOrderList", this.orderList);
this.goCartNextPage(2)
return
}
let data = { let data = {
product_list: goods, product_list: goods,
coupon_id: this.coupon ? this.coupon.id : "", coupon_id: this.coupon ? this.coupon.id : null,
} }
console.log('data数据',data); console.log('data数据',data);
this.Post({ this.Post({

Loading…
Cancel
Save