时味苏州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1563 lines
38 KiB

<template>
<!-- 解决滚动穿透 -->
<page-meta :page-style="'overflow:'+(popShow?'hidden':'visible')"></page-meta>
<view class="bg" v-if="orderList.length>0">
<view class="order-container" v-for="(info,i) in orderList" :key="i">
<view class="sendwayArea" v-if="Array.isArray(info.post_type)&&info.post_type.length>0">
<view v-if="info.post_type.includes(1)" :class="['sendway-item',info.user_select_type==1?'active':'']"
@click="changeUserPost(info,1)" >邮寄</view>
<view v-if="info.post_type.includes(3)" :class="['sendway-item',info.user_select_type==3?'active':'']"
@click="changeUserPost(info,3)" >配送</view>
<view v-if="info.post_type.includes(2)" :class="['sendway-item',info.user_select_type==2?'active':'']"
@click="changeUserPost(info,2)">自提</view>
</view>
<!-- 邮寄 -->
<view class="address" style="margin-bottom: 36rpx;" v-if="info.user_select_type==1">
<view class="a-title">
<view>收货地址</view>
<view>
<view class="more-person flex-center" v-if="addressList.length>0" @click="changeAddressPopup('open', '', info)">
更多<uni-icons style="width: 14rpx;" type="right" size="14"></uni-icons>
</view>
</view>
</view>
<view class="btn-box">
<view class="contacts box" v-if="info.contacts">
<view class="contacts-left">
<view class="name-phone">
<view class="name">{{ info.contacts.name }}</view>
<view class="phone">{{ info.contacts.tel }}</view>
</view>
<view class="adds text-overflowRows">{{ info.contacts.address }}</view>
</view>
<image @click="changeAddressAddPopup('open', '', info.contacts)" :src="showImg('/uploads/20250612/7408965e126a86023f2e33856622a749.png')" mode="aspectFill"></image>
</view>
<view v-else class="a-img flex-center" @click.stop="changeAddressAddPopup('open','',{})">
<uni-icons style="width: 32rpx;" type="plusempty" size="14"></uni-icons>添加
</view>
</view>
</view>
<!-- 自提 -->
<view v-if="info.user_select_type==2">
<view class="pickself" >
<navigator :url="`/subPackages/techan/selfPickUpPoint?pickupId=null&goodsId=${info.pInfo.id}&skuId=${info.sInfo.id}`">
<view class="pickpoint">
<view class="flex-shrink-0">自提点</view>
<view class="pickpointAddress">
<view class="pointAddressText text-overflow" v-if="info.pickupAddress&&info.pickupAddress.title">
{{info.pickupAddress.title}}
</view>
<view class="pointAddressText text-overflow" v-else>选择提货地址</view>
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons>
</view>
</view>
</navigator>
</view>
</view>
<!-- 配送 -->
<view v-if="info.user_select_type==3">
<template v-if="isInDeliveryTime">
<view class="pickself" @click="changeAddressPopup('open', '', info)">
<view class="flex-between" style="height: 100%;" v-if="info.delivery&&info.delivery.address">
<view style="flex: 1;width: 1rpx;padding-left: 20rpx;">
<view class="text-overflow" style="font-weight: bold;font-size: 33rpx;" >{{info.delivery.address}}</view>
<view style="font-size: 28rpx;color: #666666;">{{info.delivery.name}}<text style="padding-left: 20rpx;">{{info.delivery.tel}}</text></view>
</view>
<view class="flex-shrink-0">
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons>
</view>
</view>
<view class="pickpoint" v-else>
<view class="flex-shrink-0">收货地址</view>
<view class="pickpointAddress">
<view class="pointAddressText text-overflow">选择收货地址</view>
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons>
</view>
</view>
</view>
<view class="pickself" >
<view>
<view class="pickpoint">
<view class="flex-shrink-0">配送时间</view>
<view class="pickpointAddress">
<view class="pointAddressText text-overflow">
立即配送
</view>
<!-- <view class="pointAddressText text-overflow" v-else>选择收货地址</view> -->
<uni-icons style="height: 36rpx;" type="right" size="18"></uni-icons>
</view>
</view>
</view>
</view>
</template>
<template v-else>
<view class="no-time">
<image style="width: 253rpx;height: 253rpx;" src="https://static.ticket.sz-trip.com/uploads/20250731/00434905248139846cbb56eb0690baa9.png"></image>
<view style="width: 480rpx;padding-top: 50rpx;">
很抱歉,产品配送时间为 {{info.pInfo.supplier_bsamecity_delivery_start_time}}-{{info.pInfo.supplier_bsamecity_delivery_end_time}}, 请选择其他收货方式
</view>
</view>
</template>
</view>
<template v-if="info.user_select_type!=3||(info.user_select_type==3&&isInDeliveryTime)">
<view class="new-box" >
<view v-if="info.user_select_type==3" class="text-overflow" style="font-weight: bold;font-size: 31rpx;padding: 20rpx 20rpx 0;">{{info.pInfo.supplier_shop_name}}</view>
<view class="commodity box">
<image class="img" :src="showImg(info.sInfo.headimg)" mode="aspectFill"></image>
<view class="sku-content">
<view class="text-overflowRows">{{ info.pInfo.title }}</view>
<view class="text-overflow" style="font-size: 24rpx;color: #666666;">{{ info.sInfo.sku_name }}</view>
<view class="tag text-overflow" v-if="info.sInfo.display_tags">
<view class="tag-item" v-for="(item, index) in info.sInfo.display_tags.split(',')" :key="index">
{{ item }}
</view>
</view>
<view class="flex-between">
<view class="commodity-price">
{{info.sInfo.price/100}}
</view>
<view class="num-box">
<view :class="['ctrl',info.sInfo.buyNum>1?'':'disabled']" @click="reduce(info.sInfo)">-</view>
<input class="num" type="text" v-model="info.sInfo.buyNum" :disabled='true' />
<view :class="['ctrl']" @click="plus(info.sInfo)">+</view>
</view>
</view>
</view>
</view>
<view class="post top-line flex-between" v-show="info.user_select_type==1">
<view class="">
运费
</view>
<view style="font-weight: 500;" >
<text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="info.postDiscount>0">{{info.postPrice/100}}</text>
<text>{{!info.post?'免邮':info.post/100}}</text>
</view>
</view>
<view class="post top-line flex-between" v-show="info.user_select_type==3">
<view class="flex" style="align-items: center;" @click="showPeisongTip()">
<view>配送费 </view>
<view class="peisong-tip">!</view>
</view>
<view style="font-weight: 500;" >
{{!info.post?'0':info.post/100}}
</view>
</view>
</view>
<view class="tickets-box flex-between">
<view class="remark">
<view class="remark-title" >订单备注:</view>
<input style="z-index:0;text-align: right;" type="text" placeholder="选填" v-model="info.remark" maxlength="50"/>
</view>
</view>
</template>
</view>
<template v-if="orderList[0].user_select_type!=3||(orderList[0].user_select_type==3&&isInDeliveryTime)">
<!-- 优惠券 -->
<view @click="goOrderCoupon" class="tickets-container flex-between" v-if="!isShoppingCart">
<view class="order-title">优惠券</view>
<view class="coupon-btn" v-if="coupon==''">
<view class="select">选择优惠券</view>
<uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons>
</view>
<div class="coupon-price" v-else>
<span v-if="coupon.activity.fold == 0">-¥{{coupon.activity.money/100}}</span>
<span v-else>-{{coupon.activity.fold*10}}%</span>
<span style="margin:0 31rpx 0 8rpx;color: #6C7A94;">></span>
</div>
</view>
<view class="btn-list">
<view class="price-box">
<view class="text">合计:</view>
<view class="price">{{ total() }}</view>
<!-- <view class="post-text" v-if="info.user_select_type==1&&post">含邮费:¥{{ post / 100 }}</view> -->
</view>
<view class="btn" @click="order()">提交订单</view>
</view>
</template>
<!-- 选择收货地址弹窗 -->
<uni-popup ref="addressPopup" type="bottom" backgroundColor="#F4F4F4" @change="changPopShow">
<!-- 邮寄 -->
<view class="people-popup" v-if="selectInfo&&selectInfo.user_select_type == 1">
<view class="button" @click="changeAddressAddPopup('open','',{})">添加收货地址</view>
<!-- #ifdef MP-WEIXIN -->
<view style="display: flex;justify-content: center;padding-top: 20rpx;">
<view class="wx-address" @click="getWXAddress()">
<image class="wx-icon" src="https://static.ticket.sz-trip.com/uploads/20250916/3402d54588c3f0470bf05ac754f76cf0.png"></image>
<text style="padding-left: 8rpx;">获取微信地址</text>
</view>
</view>
<!-- #endif -->
<view class="popup-list" v-if="addressList.length > 0">
<view :class="['popup-item',selectInfo.contacts.id==item.id?'active':'']" v-for="(item, index) in addressList" :key="index" @click="seldThisAddress(item)">
<view class="item-top flex-between">
<view style="padding-right: 71rpx;">
<view class="name flex-start">
{{ item.name }}
<text>{{ item.tel }}</text>
<text class="tag" v-if="item.is_default == 1">默认</text>
</view>
<view class="subtitle text-overflowRows">{{ item.address }}</view>
</view>
<view>
<img @click.stop="changeAddressAddPopup('open', '', item)" :src="showImg('/uploads/20250612/7408965e126a86023f2e33856622a749.png')" alt="" />
</view>
</view>
</view>
</view>
</view>
<!-- 配送 -->
<view class="people-popup" v-if="selectInfo&&selectInfo.user_select_type == 3">
<view class="button" @click="goAddDelivery()">添加配送地址</view>
<view class="popup-list" v-if="addressList.length > 0">
<view :class="['popup-item',selectInfo.delivery.id==item.id?'active':'']" v-for="(item, index) in deliveryList" :key="index" @click="seldThisAddress(item)">
<view class="item-top flex-between">
<view style="padding-right: 71rpx;">
<view class="name flex-start">
{{ item.name }}
<text>{{ item.tel }}</text>
<text class="tag" v-if="item.is_default == 1">默认</text>
</view>
<view class="subtitle text-overflowRows">{{ item.address }}</view>
</view>
<view>
<img @click.stop="goAddDelivery(item)" :src="showImg('/uploads/20250612/7408965e126a86023f2e33856622a749.png')" alt="" />
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<!-- 新增编辑收货地址弹窗 -->
<uni-popup ref="addressAddPopup" type="bottom" backgroundColor="#F4F4F4"
@change="changPopShow" style="border-radius: 13rpx 13rpx 0 0;">
<view class="people-popup">
<view class="top-box">
<view class="top flex-between" style="height: fit-content;">
<text class="text-overflow" @click="changeAddressAddPopup('close')">取消</text>
<text style="font-size: 35rpx;font-weight: 600;">{{addressTitle}}</text>
<text style="color: #515150;" class="confirm" @click="saveAddress">保存</text>
</view>
</view>
<view class="add-edit-content">
<addressAddVue ref="addressAddVueRef"></addressAddVue>
</view>
</view>
</uni-popup>
<!-- 配送费说明 -->
<uni-popup ref="peisongPop" type="bottom" backgroundColor="#F4F4F4" borderRadius="30px 30px 30px 30px">
<view class="people-popup" style="min-height: 500rpx;">
<view style="position: relative;font-weight: bold;font-size: 35rpx;text-align: center;">
配送费说明
<uni-icons @click.native="$refs.peisongPop.close()" style="position: absolute;top: 0;right: 0;" type="closeempty" size="16"></uni-icons>
</view>
<view style="font-weight: 500;font-size: 28rpx;padding-top: 76rpx;line-height: 58rpx;">店铺列表页及店铺页展示的配送费仅为预估配送费金额实际配送费受配送距离、难度、时段、天气、运力、配送工具等因素影响,最终以确认订单页显示的配送费金额为准;冬季天气寒冷,配送难度加大。</view>
</view>
</uni-popup>
<agreeAdressVue ref="agreeAdressRef" @submitAgreeAdress="submitAgreeAdress"></agreeAdressVue>
</view>
</template>
<script>
import agreeAdressVue from '../../components/agreeAdress.vue';
import addressAddVue from '../../components/addressAdd.vue';
export default {
components: {addressAddVue, agreeAdressVue},
data() {
return {
// isPost: "1", //0=核销,1=邮寄,2=自取,3=邮寄/自提
contacts: null, // 默认收货地址
addressList: [],
deliveryList: [],
deliveryInfo: null, //默认配送地址
orderList: [],
selectInfo: null, // 选中的要修改的产品
info: null,//规格的信息
detail:null,//商品的信息
orderGoods: [],
post: 0,
flag: true,
coupon: "",
allprice: 0,
popShow: false, // 解决滚动穿透
addressTitle: '添加收货地址',
isShoppingCart: false,
isInDeliveryTime: true,
firstInit: null,
};
},
onLoad(options) {
if (options.isShoppingCart) {
this.isShoppingCart = options.isShoppingCart
}
this.$store.commit("choseCoupon", "");
this.handleOrderGoods()
setTimeout(()=>{
this.firstInit = true
},2000)
},
onShow() {
if (!this.isShoppingCart) {
this.coupon = this.$store.state.user.coupon
}
// 更新自提点
uni.$on("updateDataByConnect",this.getDataByConnect)
if (this.firstInit) {
this.getDelivery()
}
},
onUnload(){
uni.$off("updateDataByConnect",this.getDataByConnect)
},
onReady () {
// this.$nextTick(()=>{
// setTimeout(()=>{
// this.getMaxCouponData()
// },1000)
// })
},
methods: {
submitAgreeAdress (val) {
if (val) {
this.getWXAddress()
}
},
// 获取微信地址
getWXAddress () {
let agress = uni.getStorageSync("agreeAddress")
if (!agress) {
this.$refs.agreeAdressRef.openPop()
return
}
let _this = this;
uni.chooseAddress({
success: (res) => {
_this.Post({...res,method:"POST"},'/api/uservice/user/addWxDefaultConsignee').then(()=>{
_this.getAddressList2()
})
}
})
},
getAddressList2 () {
this.Post({
contactType: "CONSIGNEE",
offset: '0',
limit: '100'
}, '/api/uservice/user/getContactOrConsignee').then(res => {
if (res) {
this.addressList = res.data || []
}
})
},
handleOrderGoods () {
let orderList = this.$store.state.user.techanOrderList.list1;
// orderList = uni.getStorageSync("techanOrderList")
if (!Array.isArray(orderList) || orderList.length<=0) {
uni.navigateBack();
return
}
console.log(orderList)
this.isInDeliveryTime = true
// use_type 0邮寄 1自提 3邮寄或自提
// is_delivery 是否支持配送
// user_select_type 1邮寄 2自提 3配送
orderList.forEach(v=>{
let use_type = v.sInfo.use_type;
// v.sInfo.is_delivery = 1;
let supportTypes = [];
// 判断是否支持邮寄(1)
if (use_type === 0 || use_type === 3) {supportTypes.push(1);}
// 判断是否支持配送(3)
if (v.sInfo.is_delivery) {supportTypes.push(3);}
// 判断是否支持自提(2)
if (use_type === 1 || use_type === 3) {supportTypes.push(2);}
v.post_type = supportTypes;
v.user_select_type = supportTypes[0] // 用户自选方式
v.pickupAddress = v.pickupAddress || null // 自提信息
v.contacts = v.contacts || null // 收货地址
v.post = v.post || null // 运费信息
v.delivery = v.delivery || null // 配送信息
v.delivery_time = v.delivery || null // 配送时间
v.delivery_post = v.delivery_post|| null // 配送费
v.remark = v.remark||""
// 判断是否在配送时间
if (v.sInfo.is_delivery) {
console.log(v.sInfo)
if (v.pInfo.supplier_bsamecity_delivery_start_time && v.pInfo.supplier_bsamecity_delivery_end_time) {
if (!this.isInTimeRange(v.pInfo.supplier_bsamecity_delivery_start_time, v.pInfo.supplier_bsamecity_delivery_end_time)) {
this.isInDeliveryTime = false
}
} else {
this.isInDeliveryTime = false
}
}
})
this.orderList = orderList
console.log(this.orderList)
this.getContacts()
this.getDelivery()
},
// 更换收获方式
changeUserPost (item,value) {
console.log(item)
item.user_select_type = value
this.getPost()
this.getDeliveryPost()
// #ifdef H5
this.$forceUpdate()
// #endif
},
goOrderCoupon () {
let allPrice = 0
let skuIds= []
this.orderList.forEach(v=>{
allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.sInfo.buyNum>0) {
skuIds.push(v.sInfo.id)
}
})
uni.navigateTo({
url: `/subPackages/order/orderCoupon?allprice=${allPrice}&sku_ids=${skuIds.join(',')}`
})
},
// 获取收获地址
getContacts() {
this.Post({
contactType: "CONSIGNEE",
offset: '0',
limit: '100'
}, '/api/uservice/user/getContactOrConsignee').then(res => {
if (res) {
this.addressList = res.data || []
let defaultData = this.addressList.find(v=>v.is_default)
if (defaultData) {
this.contacts = defaultData
} else if (this.addressList[0]) {
this.contacts = this.addressList[0]
}
// todo 每个邮寄类要设置 并获取邮费
this.orderList.forEach(v=>{
// if (v.user_select_type == 1) {
let selfContacts = this.addressList.find(x=>x.id == (v.contacts||{}).id)
if (!selfContacts) {
v.contacts = JSON.parse(JSON.stringify(this.contacts))
} else {
v.contacts = JSON.parse(JSON.stringify(selfContacts))
}
// }
})
this.getPost()
}
});
},
getPost() {
let _this = this
let tempList = []
this.orderList.forEach(v=>{
if( v.contacts && v.user_select_type == 1) {
tempList.push(v)
}
})
let param = []
let consignee_id = null
tempList.forEach(v=>{
v.post = 0;
// param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id})
param.push({
type: v.pInfo.type,
product_id: v.pInfo.id,
sku_id: v.sInfo.id,
product_num: v.sInfo.buyNum,
use_type: 1,
post: v.contacts.id,
consignee_id: v.contacts.id,
})
consignee_id = v.contacts.id
})
// 店铺满减前
// console.log(data);
// this.flag = false;
// Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{
// if (res) {
// console.log("promise" ,res)
// for(let i=0;i<tempList.length;i++) {
// tempList[i].post = res[i].data.price;
// }
// }
// }).finally(()=>{this.flag = true;})
// 店铺满减后
if (consignee_id && param.length>0) {
let data = {
product_list: param,
consignee_id:consignee_id
};
this.Post({
method: 'POST',
data: JSON.stringify(data),
consignee_id:consignee_id
},"/api/order/get_post_price_new").then(res=>{
let resData = res.data || []
resData.forEach((x,i) => {
tempList[i].post = x.price - x.discount_price
tempList[i].postPrice = x.price
tempList[i].postDiscount = x.discount_price
})
this.$forceUpdate()
}).finally(()=>{
this.$forceUpdate()
})
} else {
this.$forceUpdate()
}
},
// 获取配送地址
getDelivery () {
this.Post({
contactType: "BSAMECITY",
offset: '0',
limit: '100'
}, '/api/uservice/user/getContactOrConsignee').then(res => {
if (res) {
this.deliveryList = res.data || []
let defaultData = this.deliveryList.find(v=>v.is_default)
if (defaultData) {
this.deliveryInfo = defaultData
} else if (this.deliveryList[0]) {
this.deliveryInfo = this.deliveryList[0]
}
// todo 每个邮寄类要设置 并获取邮费
this.orderList.forEach(v=>{
// if (v.user_select_type == 3) {
let selfContacts = this.deliveryList.find(x=>x.id == (v.delivery||{}).id)
if (!selfContacts) {
v.delivery = JSON.parse(JSON.stringify(this.deliveryInfo))
} else {
v.delivery = JSON.parse(JSON.stringify(selfContacts))
}
// }
})
this.getDeliveryPost()
}
});
},
getDeliveryPost() {
let _this = this
let tempList = []
this.orderList.forEach(v=>{
if( v.delivery && v.user_select_type == 3) {
tempList.push(v)
}
})
if (tempList.length<=0) {return}
let param = []
tempList.forEach(v=>{
v.post = 0;
param.push({
data: {
product_list: [{
product_id: v.pInfo.id,sku_id: v.sInfo.id, product_num: v.sInfo.buyNum,
post:v.delivery.id,supplier_id:v.pInfo.supplier_id,
}]
},
})
})
let data = JSON.stringify(param);
// console.log(data);
this.flag = false;
Promise.all(param.map(v=>_this.Post({...v},"/api/order/getExpressPrice"))).then(res=>{
if (res) {
console.log("promise" ,res)
for(let i=0;i<tempList.length;i++) {
tempList[i].post = res[i].data.discountFee;
}
}
}).finally(()=>{
this.$forceUpdate()
this.flag = true;
})
},
// 配送费提示
showPeisongTip () {
this.$refs.peisongPop.open()
},
plus(sku) {
this.$nextTick(() => {
this.$store.commit("choseCoupon","");
this.coupon = this.$store.state.user.coupon
sku.buyNum += 1;
if (this.flag) {
this.getPost();
}
});
},
reduce(sku) {
if (sku.buyNum > 1) {
this.$store.commit("choseCoupon","");
this.coupon = this.$store.state.user.coupon
this.$nextTick(() => {
sku.buyNum -= 1;
if (this.flag) {
this.getPost();
}
});
}
},
// 选择收货地址弹窗
changeAddressPopup(type, confirm, item) {
this.selectInfo = item
if (type == 'open') this.$refs.addressPopup.open('bottom');
else this.$refs.addressPopup.close();
},
// 选择收货地址
seldThisAddress(item) {
console.log(this.selectInfo, item)
if (this.selectInfo.user_select_type==1) {
this.selectInfo.contacts = item
if (this.flag) {
this.getPost();
}
}
if (this.selectInfo.user_select_type==3) {
this.selectInfo.delivery = item
// todo 获取配送费
if (this.flag) {
this.getDelivery()
}
}
this.$refs.addressPopup.close();
},
// 收货地址新增弹窗
changeAddressAddPopup(type, confirm, item) {
if (type == 'open') {
this.addressTitle = '新增收货地址'
if (item.id) { this.addressTitle = '编辑收货地址' }
// this.id = item.id
this.$refs.addressAddPopup.open('bottom');
this.$nextTick(()=>{
this.$refs.addressAddVueRef.init(item)
})
}
else {this.$refs.addressAddPopup.close();}
this.$forceUpdate();
},
// 保存地址
async saveAddress () {
let res = await this.$refs.addressAddVueRef.postSave()
if (res && res.code == 1) {
// 更新所有地址
this.getContacts()
// this.getAllAddressList();
this.changeAddressAddPopup('close')
}
},
// 去配送
goAddDelivery (item) {
if (item) {
uni.navigateTo({
url: "/subPackages/user/myDeliveryAdd?id="+item.id
})
} else {
uni.navigateTo({
url: "/subPackages/user/myDeliveryAdd"
})
}
},
// 总价
total() {
let price = 0
let postPrice = 0
let allPrice = 0
if (this.orderList && Array.isArray(this.orderList)) {
this.orderList.forEach(v=>{
allPrice += v.sInfo.price*v.sInfo.buyNum
if (v.user_select_type == 1 || v.user_select_type == 3) {
postPrice+=v.post
}
})
}
console.log(postPrice)
this.allprice = allPrice + postPrice
if (this.coupon) {
if (this.coupon.activity.fold == 0) {
if (this.coupon.activity.money>allPrice) {
price =0
}else{
price = allPrice - (this.coupon.activity.money)
}
} else{
price = allPrice - allPrice * (this.coupon.activity.fold*10/100)
}
} else {
price = allPrice
}
price=price+postPrice
return price < 0 ? 0 : (price/100).toFixed(2)
},
// 预定
order() {
let goods = [];
for(let info of this.orderList) {
let param = {
type: info.pInfo.type,
product_id: info.pInfo.id,
sku_id: info.sInfo.id,
product_num: info.sInfo.buyNum,
remark: info.remark,
supplier_id: info.pInfo.supplier_id,
}
if (info.user_select_type == 1) {
if(!info.contacts) {
uni.showToast({
title: '请选择收货地址',
icon: 'none'
});
return;
} else {
param.use_type = 1
param.post = info.contacts.id
}
}
if (info.user_select_type == 2) {
if (!info.pickupAddress||!info.pickupAddress.id) {
uni.showToast({title: '请选择自提点',icon: 'none'});
return;
} else {
param.use_type = 2
param.pickup_shop_id = info.pickupAddress.id
param.pickup_shop_info = info.pickupAddress
}
}
if (info.user_select_type == 3) {
if (!info.delivery||!info.delivery.id) {
uni.showToast({title: '请选择配送地址',icon: 'none'});
return;
} else {
param.use_type = 99
param.post = info.delivery.id
}
}
goods.push(param)
}
// 如果是购物车下单
if (this.isShoppingCart) {
this.$store.commit("changeTechanOrderList", this.orderList);
// console.log(this.orderList)
this.goCartNextPage(1)
return
}
let data = {
product_list: goods,
coupon_id: this.coupon ? this.coupon.id : null,
};
this.Post(
{
method: 'POST',
data: JSON.stringify(data)
},
'/api/order/create'
).then(res => {
if (res.code == 1) {
// #ifdef MP-WEIXIN
this.Post(
{
order_id: res.data.order_id,
pay_platform: "MINI",
pay_method: 'WEIXIN',
},
'/api/order/pay'
).then(res => {
if (res.data) {
uni.requestPayment({
nonceStr: res.data.nonceStr,
package: res.data.package,
paySign: res.data.paySign,
signType: res.data.signType,
timeStamp: res.data.timeStamp,
complete: () => {
uni.navigateTo({
url: '/subPackages/order/trades'
})
}
});
}
});
// #endif
// #ifdef H5
uni.navigateTo({
url: "/subPackages/order/orderPay?orderId=" +res.data.order_id
})
// #endif
}
});
},
// ---------------自提-----------------------
changPopShow (e) {
this.popShow = e.show
},
getDataByConnect(data) {
if (data.msgType == "updatePickUpPoint") {
for(let p of this.orderList) {
if (p.sInfo.id == data.data.skuId) {
let selectItem = data.data.selectItem
p.pickupAddress = selectItem
p.pickupAddress.address = selectItem.address;
p.pickupAddress.title = selectItem.title;
p.pickupAddress.id = selectItem.id;
p.pickupAddress.tel = selectItem.tel;
break;
}
}
this.$forceUpdate()
}
},
// 获取最大优惠券
async getMaxCouponData () {
let allPrice =0
let skuIds = []
if (this.info && Array.isArray(this.info.goods)) {
this.info.goods.forEach(v=>{
allPrice += v.skuInfo.money*v.skuInfo.buyNum
if (v.skuInfo.buyNum>0) {
skuIds.push(v.skuInfo.id)
}
})
}
let param = {money:allPrice,sku_ids:skuIds.join(',')}
let res = await this.getMaxCoupon(param)
if (res.id) {
this.coupon = res
}
}
}
};
</script>
<style lang="scss" scoped>
.bg {
min-height: 100vh;
overflow-x: hidden;
background: #f2f4f7;
padding-bottom: 200rpx;
}
view {
box-sizing: border-box;
}
.flex-shrink-0{
flex-shrink: 0;
}
.box {
width: 100%;
min-height: 100rpx;
padding: 20rpx;
background: #ffffff;
border-radius: 16rpx;
}
.address {
width: 697rpx;
height: 291rpx;
background: #FFFFFF;
border-radius: 13rpx;
margin: 0 auto;
margin-top: 26rpx;
.a-title{
font-size: 31rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
padding: 30rpx 18rpx;
justify-content: space-between;
align-items: center;
display: flex;
width: 100%;
.more-person{
width: 133rpx;
height: 60rpx;
border-radius: 30rpx;
border: 1px solid #999999;
font-family: PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #000000;
line-height: 16rpx;
}
}
.btn-box{
display: flex;
align-items: center;
justify-content: center;
border-top:1rpx solid rgba(216, 216, 216, 1) ;
height: 176rpx;
.a-img{
width: 219rpx;
height: 73rpx;
border-radius: 37rpx;
border: 1px solid #333333;
font-family: PingFang SC;
font-weight: 400;
font-size: 29rpx;
color: #000000;
}
}
}
.pickself{
width: 697rpx;
height: 120rpx;
background: #FFFFFF;
border-radius: 13rpx;
margin: 26rpx auto;
.pickpoint{
display: flex;
width: 100%;
font-size: 31rpx;
font-weight: bold;
padding: 40rpx 18rpx;
}
.pickpointAddress{
display: flex;
font-weight: 500;
flex: 1;
width: 10rpx;
align-items: center;
justify-content: flex-end;
}
.pickpointImg{
width: 20rpx;
height: 20rpx;
}
.pointAddressText{
padding: 0 20rpx 0 40rpx;
flex: 1;
text-align: right;
width: 10rpx;
}
}
.new-box{
background: #fff;
width: 698rpx;
margin: 0 auto 20rpx;
border-radius: 14rpx;
.commodity {
display: flex;
.num-box {
display: flex;
align-items: center;
margin-left: 20rpx;
width: 160rpx;
justify-content: space-between;
.num {
text-align: center;
width: 50rpx;
}
.ctrl {
width: 47rpx;
height: 47rpx;
background: #6A8A2D;
border-radius: 50%;
font-family: PingFang SC;
font-weight: 400;
font-size: 34rpx;
color: #FFFFFF;
line-height: 47rpx;
text-align: center;
}
.ctrl.disabled{
background: #E8E8E8;
color: #999999;
}
}
}
.img {
width: 174rpx;
height: 174rpx;
background: #f2f4f7;
border-radius: 10rpx;
flex-shrink: 0;
}
.sku-content{
flex: 1;
width: 1rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
font-weight: 500;
font-size: 28rpx;
color: #333333;
padding-left: 12rpx;
}
.tag {
margin-top: 10rpx;
display: flex;
.tag-item {
border-radius: 7rpx;
border: 1px solid #6A8A2D;
padding: 2rpx 6rpx;
font-weight: 500;
font-size: 20rpx;
color: #6A8A2D;
margin-right: 10rpx;
}
}
.commodity-price{
&:before{
content:"¥";
font-size: 24rpx;
}
}
}
.btn-list {
width: 100%;
height: 166rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 9rpx 1rpx rgba(227, 229, 232, 0.5);
display: flex;
position: fixed;
bottom: 0;
padding: 20rpx 20rpx;
align-items: center;
justify-content: space-between;
.btn {
width: 294rpx;
height: 88rpx;
background: #6A8A2D;
border-radius: 11rpx;
text-align: center;
line-height: 88rpx;
font-size: 36rpx;
font-family: PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
.price-box {
display: flex;
align-items: center;
.text {
font-size: 29rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 500;
color: #333;
}
.price {
margin-left: 15rpx;
font-size: 36rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: bold;
color: #DC2525;
&:before {
content: '¥';
display: inline-block;
font-size: 36rpx;
}
}
.post-text {
margin-left: 15rpx;
color: #fc5109;
font-size: 24rpx;
}
}
}
.contacts {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
image {
width: 36rpx;
height: 36rpx;
}
.contacts-left {
.name-phone {
display: flex;
align-items: baseline;
.name {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: #222222;
}
.phone {
margin-left: 27rpx;
font-size: 25rpx;
font-family: PingFang SC;
font-weight: 400;
color: #666666;
}
}
.adds {
font-size: 27rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000;
margin-top: 20rpx;
max-width: 500rpx;
}
}
}
.people-popup {
padding: 26rpx;
min-height: 800rpx;
.top-box {
height: 80rpx;
.top {
position: fixed;
left: 0;
right: 0;
color: #000;
height: 80rpx;
font-size: 0;
overflow: hidden;
padding: 0 26rpx;
text {
text-align: left;
font-size: 31rpx;
font-weight: 400;
color: #000000;
}
.confirm {
font-weight: 400;
color: #000000;
}
}
}
.popup-list {
height: 666rpx;
overflow: scroll;
.popup-item {
border-radius: 12rpx;
padding: 2rpx;
margin-top: 24rpx;
font-size: 24rpx;
color: #333333;
font-weight: 400;
background-color: #ffffff;
.item-top {
border-radius: 12rpx;
padding: 30rpx 40rpx;
background-color: #ffffff;
img {
color: #666666;
width: 40rpx;
height: 40rpx;
}
.name {
overflow: hidden;
font-family: PingFang SC;
font-weight: 400;
font-size: 32rpx;
display: flex;
align-items: baseline;
text {
color: #666;
font-size: 25rpx;
padding: 0 24rpx;
}
.tag {
padding: 0 8rpx;
height: 32rpx;
border-radius: 7rpx;
line-height: 30rpx;
text-align: center;
font-size: 23rpx;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
background: #6A8A2D;
}
}
.com-flex-start {
margin: 0 0 30rpx;
}
.subtitle {
font-weight: 400;
flex: 1;
text-align: left;
margin-top: 33rpx;
color: #666666;
font-size: 25rpx;
.mobile {
margin-bottom: 36rpx;
}
}
.status {
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 50%;
text-align: center;
box-sizing: border-box;
img {
width: 27rpx;
height: 21rpx;
}
}
.statuss {
background: linear-gradient(90deg, #fa2b66, #ff9834);
border: none;
}
.noSelect {
border: 1rpx solid #999999;
}
}
.item-site {
color: #666666;
display: flex;
align-items: center;
padding: 36rpx 0;
view {
width: 23rpx;
height: 23rpx;
margin-right: 10rpx;
border: 1rpx solid #999999;
border-radius: 50%;
view {
width: 8rpx;
height: 8rpx;
background: #000000;
border-radius: 50%;
margin: auto;
}
}
}
}
.popup-item.active{
background: #6A8A2D;
}
}
.button {
text-align: center;
width: 100%;
height: 80rpx;
line-height: 80rpx;
background-color: #ffffff;
border-radius: 40rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 33rpx;
color: #000000;
}
}
.person-info {
padding: 30rpx 30rpx 15rpx 30rpx;
background: #fff;
margin-top: 30rpx;
border-radius: 16rpx;
}
.person-title {
font-size: 32rpx;
font-weight: bold;
color: #000;
}
.line {
border-bottom: 1px solid #e3e5e8;
}
.left {
width: 140rpx;
height: 104rpx;
line-height: 104rpx;
font-family: PingFang;
font-weight: bold;
font-size: 31rpx;
color: #000000;
}
.input {
font-size: 31rpx;
font-weight: 400;
text-align: right;
}
.remark {
padding:30rpx;
display: flex;
align-items: center;
width: 698rpx;
min-height: 120rpx;
background: #ffffff;
margin: 0 auto;
border-radius: 14rpx;
.remark-title{
font-size: 31rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
flex-shrink: 0;
}
input {
margin-left: 64rpx;
width: 500rpx;
font-size: 31rpx;
}
}
.tickets-box {
width: 698rpx;
margin: 26rpx auto 0;
border-radius: 13rpx;
background: #fff;
height: 120rpx;
.order-title {
margin: 31rpx 0 31rpx 30rpx;
font-size: 31rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
.coupon-price {
color:#DD0000;
font-size: 30rpx;
font-weight: bold;
}
}
.top-line{
border-top:rgba(216, 216, 216, 1) solid 2rpx ;
}
.post{
height: 120rpx;
padding: 0 30rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
.sendwayArea{
padding: 26rpx 26rpx 0;
display: flex;
// justify-content: space-between;
.sendway-item{
font-weight: 500;
font-size: 27rpx;
color: #111111;
width: 31%;
margin-right: 20rpx;
text-align: center;
height: 57rpx;
line-height: 57rpx;
background: #FFFFFF;
border-radius: 13rpx;
}
.sendway-item:last-of-type{
margin-right: 0;
}
.sendway-item.active{
border: 1px solid #6A8A2D;
color: #6A8A2D;
}
}
.add-edit-content{
background-color: white;
padding: 0 20rpx;
border-radius: 20rpx;
}
.coupon-btn {
color: #999999;;
display: flex;
align-items: center;
.select {
display: block;
width: 153rpx;
height: 40rpx;
background: #6A8A2D;
border-radius: 9rpx;
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
text-align: center;
line-height: 40rpx;
font-family: PingFang SC;
margin-right: 20rpx;
}
}
.shop-name{
font-weight: bold;
font-size: 31rpx;
color: #333333;
padding-bottom: 12rpx;
min-height: fit-content;
}
.tickets-container {
width: 698rpx;
background: #fff;
height: 120rpx;
margin: 22rpx auto 0;
.order-title {
margin: 31rpx 0 31rpx 30rpx;
font-size: 31rpx;
font-family: PingFang SC;
font-weight: bold;
color: #000000;
}
.coupon-price {
color:#DD0000;
font-size: 30rpx;
font-weight: bold;
}
}
.peisong-tip{
width: 24rpx;
height: 24rpx;
background: #6A8A2D;
border-radius: 50%;
color: #fff;
line-height: 24rpx;
font-weight: normal;
text-align: center;
font-size: 18rpx;
margin-left: 12rpx;
}
.no-time {
padding-top: 300rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
font-weight: 500;
font-size: 28rpx;
color: #666666;
line-height: 50rpx;
}
.wx-address{
width: 201rpx;
height: 53rpx;
background: #6A8A2D;
border-radius: 9rpx;
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
.wx-icon{
width: 26.67rpx;
height: 26.67rpx;
}
}
</style>