Browse Source

拼团弹出层

master
tianyi 3 weeks ago
parent
commit
5841fac3da
  1. 476
      package1/buyFood/buyFood.vue

476
package1/buyFood/buyFood.vue

@ -45,16 +45,20 @@
请选择收货地址 <uni-icons type="right" size="16"></uni-icons> 请选择收货地址 <uni-icons type="right" size="16"></uni-icons>
</view> </view>
<view v-else style="display: flex; justify-content: space-between; align-items: center;"> <view v-else style="display: flex; justify-content: space-between; align-items: center;">
<view @tap="openAddressBook" style="flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"> <view @tap="openAddressBook"
{{formData.address.areaName || ''}}{{formData.address.floor ? formData.address.floor + '层' : ''}}{{formData.address.roomNum || ''}} {{formData.address.receiverName || ''}} style="flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
{{formData.address.areaName || ''}}{{formData.address.floor ? formData.address.floor + '层' : ''}}{{formData.address.roomNum || ''}}
{{formData.address.receiverName || ''}}
</view> </view>
<view @tap.stop="openAddressBook" style="color: #0b9b73; font-size: 13px; font-weight: normal; margin-left: 10px; display: flex; align-items: center;"> <view @tap.stop="openAddressBook"
style="color: #0b9b73; font-size: 13px; font-weight: normal; margin-left: 10px; display: flex; align-items: center;">
更换地址 <uni-icons type="right" size="13" color="#0b9b73"></uni-icons> 更换地址 <uni-icons type="right" size="13" color="#0b9b73"></uni-icons>
</view> </view>
</view> </view>
</view> </view>
<view class="time-box" v-if="isPaotui"> <view class="time-box" v-if="isPaotui">
<view class="time1" @tap="checkTime(true)" :style="{'background':formData.isImmediately?'linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1))':'#eee'}"> <view class="time1" @tap="checkTime(true)"
:style="{'background':formData.isImmediately?'linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1))':'#eee'}">
<view style="font-weight: 700;"> <view style="font-weight: 700;">
立即送出 立即送出
</view> </view>
@ -62,12 +66,14 @@
预计{{immediateTimeStr}}送达 预计{{immediateTimeStr}}送达
</view> </view>
</view> </view>
<view class="time1" @tap="checkTime(false)" :style="{'background':formData.isImmediately==false?'linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1))':'#eee'}"> <view class="time1" @tap="checkTime(false)"
:style="{'background':formData.isImmediately==false?'linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1))':'#eee'}">
<view style="font-weight: 700;"> <view style="font-weight: 700;">
预约配送 预约配送
</view> </view>
<view class=""> <view class="">
<view style="font-size: 10px;color: #777;" v-if="formData.isImmediately!=true&&formData.deliveryTime!=''"> <view style="font-size: 10px;color: #777;"
v-if="formData.isImmediately!=true&&formData.deliveryTime!=''">
{{formData.deliveryTime}} {{formData.deliveryTime}}
</view> </view>
<view v-else style="font-size: 10px;color: #777;"> <view v-else style="font-size: 10px;color: #777;">
@ -77,7 +83,8 @@
</view> </view>
</view> </view>
<view v-if="isPaotui" style='background: #fff;border-bottom: 1px solid #eee;'> <view v-if="isPaotui" style='background: #fff;border-bottom: 1px solid #eee;'>
<view style="height: 45px;line-height: 20px;padding: 0 20px;font-size: 14px;font-weight: 700;padding-top: 10px;"> <view
style="height: 45px;line-height: 20px;padding: 0 20px;font-size: 14px;font-weight: 700;padding-top: 10px;">
<view class=""> <view class="">
配送员 配送员
</view> </view>
@ -86,7 +93,8 @@
</view> </view>
</view> </view>
<view style="padding: 20px;"> <view style="padding: 20px;">
<view style="display: flex;font-size: 14px;font-weight: bold;line-height: 25px;margin-bottom: 15px;align-items: center;"> <view
style="display: flex;font-size: 14px;font-weight: bold;line-height: 25px;margin-bottom: 15px;align-items: center;">
<view style="width:50%;display: flex;align-items: center;"> <view style="width:50%;display: flex;align-items: center;">
<view class="radio-check" v-if="selected === 'buzhiding'"> <view class="radio-check" v-if="selected === 'buzhiding'">
<uni-icons type="checkmarkempty" size="12"></uni-icons> <uni-icons type="checkmarkempty" size="12"></uni-icons>
@ -94,9 +102,12 @@
<view class="radio-no-check" @tap="checkVoucher('buzhiding')" v-else></view> <view class="radio-no-check" @tap="checkVoucher('buzhiding')" v-else></view>
不指定 不指定
</view> </view>
<view style="width: 50%;display: flex;justify-content: flex-end;align-items: center;" v-if="selected === 'buzhiding'"> <view style="width: 50%;display: flex;justify-content: flex-end;align-items: center;"
v-if="selected === 'buzhiding'">
<text style="color: #777; font-weight: normal; margin-right: 5px; font-size: 12px;">佣金 </text> <text style="color: #777; font-weight: normal; margin-right: 5px; font-size: 12px;">佣金 </text>
<input type="digit" v-model="customCommission" style="width: 70px; border-bottom: 1px solid #ccc; text-align: center; font-size: 14px; font-weight: normal; height: 25px; min-height: 25px;" placeholder="金额" /> <input type="digit" v-model="customCommission"
style="width: 70px; border-bottom: 1px solid #ccc; text-align: center; font-size: 14px; font-weight: normal; height: 25px; min-height: 25px;"
placeholder="金额" />
</view> </view>
</view> </view>
<view class="" style="display: flex;font-size: 14px;font-weight: bold;line-height: 25px;"> <view class="" style="display: flex;font-size: 14px;font-weight: bold;line-height: 25px;">
@ -120,7 +131,8 @@
</view> </view>
<block v-if="!isGroupBuy"> <block v-if="!isGroupBuy">
<view style="display: flex;padding: 10px;background: #eee;border-radius: 10px; margin-bottom:10px;" v-for="(cartItem, index) in cartItems" :key="index"> <view style="display: flex;padding: 10px;background: #eee;border-radius: 10px; margin-bottom:10px;"
v-for="(cartItem, index) in cartItems" :key="index">
<view class="goods-img"> <view class="goods-img">
<img :src="cartItem.item.productPicture" alt=""> <img :src="cartItem.item.productPicture" alt="">
</view> </view>
@ -145,7 +157,8 @@
</view> </view>
</block> </block>
<block v-else> <block v-else>
<view style="display: flex;padding: 10px;background: #eee;border-radius: 10px; margin-bottom:10px;" v-if="groupItem"> <view style="display: flex;padding: 10px;background: #eee;border-radius: 10px; margin-bottom:10px;"
v-if="groupItem">
<view class="goods-img"> <view class="goods-img">
<img :src="groupItem.item.productPicture" alt=""> <img :src="groupItem.item.productPicture" alt="">
</view> </view>
@ -163,7 +176,8 @@
X1 X1
</view> </view>
<view class="pintuan-left-price" style="flex:1;"> <view class="pintuan-left-price" style="flex:1;">
<view style="background: rgba(255, 57, 57, 0.2);padding: 0px 6px;border-radius: 10px;margin-left: 10px;"> <view
style="background: rgba(255, 57, 57, 0.2);padding: 0px 6px;border-radius: 10px;margin-left: 10px;">
<text>拼团</text> <text>拼团</text>
<text style="color: red;">{{groupItem.groupRule.groupPrice}}</text> <text style="color: red;">{{groupItem.groupRule.groupPrice}}</text>
</view> </view>
@ -193,7 +207,7 @@
</view> </view>
<view <view
style="display: flex;height: 40px;line-height: 50px;border-top: 1px solid #eee;font-size: 16px;font-weight: 700;"> style="display: flex;height: 40px;line-height: 50px;border-top: 1px solid #eee;font-size: 16px;font-weight: 700;">
<view style="flex: 1;"> <view style="flex: 1;" @tap="$refs.pintuanPopup.open()">
合计 合计
</view> </view>
<view class=""> <view class="">
@ -210,15 +224,22 @@
<!-- 地址簿弹出层 --> <!-- 地址簿弹出层 -->
<uni-popup ref="bookPopup" background-color="#fff"> <uni-popup ref="bookPopup" background-color="#fff">
<view class="book-popup-content"> <view class="book-popup-content">
<address-list @selectAddress="handleSelectAddress" @syncAddress="handleSyncAddress" @close="closeAddressBook"></address-list> <address-list @selectAddress="handleSelectAddress" @syncAddress="handleSyncAddress"
@close="closeAddressBook"></address-list>
</view> </view>
</uni-popup> </uni-popup>
<!-- 警告弹出层 --> <!-- 警告弹出层 -->
<uni-popup ref="warnPopup" background-color="#fff"> <uni-popup ref="warnPopup" background-color="#fff">
<view class="warnImg"> <view class="warnImg">
<img v-if="warnPopup == 'shdz'" @tap="$refs.warnPopup.close()" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4996043b3987401794b974d359429b8e.png" alt="填写收货地址" style="width:300px;height:370px;" /> <img v-if="warnPopup == 'shdz'" @tap="$refs.warnPopup.close()"
<img v-if="warnPopup == 'psyj'" @tap="$refs.warnPopup.close()" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/001cf760048b4718bdccd55085bef601.png" alt="填写配送佣金" style="width:300px;height:370px;" /> src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4996043b3987401794b974d359429b8e.png"
<img v-if="warnPopup == 'psy'" @tap="$refs.warnPopup.close()" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/e10ad77ca478413a9c53918750ecb932.png" alt="指定配送员" style="width:300px;height:370px;" /> alt="填写收货地址" style="width:300px;height:370px;" />
<img v-if="warnPopup == 'psyj'" @tap="$refs.warnPopup.close()"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/001cf760048b4718bdccd55085bef601.png"
alt="填写配送佣金" style="width:300px;height:370px;" />
<img v-if="warnPopup == 'psy'" @tap="$refs.warnPopup.close()"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/e10ad77ca478413a9c53918750ecb932.png"
alt="指定配送员" style="width:300px;height:370px;" />
</view> </view>
</uni-popup> </uni-popup>
<!-- 支付弹出层 --> <!-- 支付弹出层 -->
@ -227,10 +248,12 @@
<view class="content"> <view class="content">
<view class="box1"> <view class="box1">
<view style="height: 35px;line-height: 35px;text-align: center;"> <view style="height: 35px;line-height: 35px;text-align: center;">
支付剩余时间 59:09 支付剩余时间 59:09
</view> </view>
<view style="height: 45px;line-height: 45px;text-align: center;font-weight: 700;font-size: 15px;"> <view
<text style="font-size: 30px;">{{backendTotalAmount ? backendTotalAmount.toFixed(2) : totalAmountCalc.toFixed(2)}}</text> style="height: 45px;line-height: 45px;text-align: center;font-weight: 700;font-size: 15px;">
<text
style="font-size: 30px;">{{backendTotalAmount ? backendTotalAmount.toFixed(2) : totalAmountCalc.toFixed(2)}}</text>
</view> </view>
<view style="height: 20px;text-align: center;color: red;"> <view style="height: 20px;text-align: center;color: red;">
若拼团失败将会为您自动退款 若拼团失败将会为您自动退款
@ -239,7 +262,8 @@
<view class="box1" style="display: flex;padding: 20px;"> <view class="box1" style="display: flex;padding: 20px;">
<view style="flex: 1;"> <view style="flex: 1;">
<view style="height: 21px;line-height: 21px;display: flex;"> <view style="height: 21px;line-height: 21px;display: flex;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4c8e0cc311db4d38ab43e019673c4b8c.png" alt="" style="width: 21px;height: 21px;margin-right: 10px;" /> <img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/4c8e0cc311db4d38ab43e019673c4b8c.png"
alt="" style="width: 21px;height: 21px;margin-right: 10px;" />
<text style="font-size: 15px;font-weight: 700;">微信支付</text> <text style="font-size: 15px;font-weight: 700;">微信支付</text>
</view> </view>
<view style="text-align: right;margin-left: 30px;color: #777;width: 73px;"> <view style="text-align: right;margin-left: 30px;color: #777;width: 73px;">
@ -247,7 +271,8 @@
</view> </view>
</view> </view>
<view style="width: 18px;padding-top: 10px;"> <view style="width: 18px;padding-top: 10px;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/02bff7edc4e04caaa1868955ff684f1f.png" alt="" style="width: 18px;height: 18px;" /> <img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/02bff7edc4e04caaa1868955ff684f1f.png"
alt="" style="width: 18px;height: 18px;" />
</view> </view>
</view> </view>
<view class="btn" @tap="wxPayment"> <view class="btn" @tap="wxPayment">
@ -256,8 +281,54 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<delivery-time-op @timeCallback="timeCallback" :dodge="true" ref='model' <!-- 拼团分享弹出层 -->
:content="content" :barHidth='600' title="选择送达时间"> <uni-popup ref="pintuanPopup" background-color="#fff">
<view class="pintuan-popup">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/ecd00dab1c9c44198d765bc08bc1bd71.png" alt=""
style="position: absolute;top: 0;right: 0;width: 120px;height: 90px;">
<view style="position: absolute;bottom: 0;width: 100%;height: 380px;">
<view class="kaituan1">
<view class="kaituan1-title">
差1人即可成团
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/21b403bd13414ce79ad73cf1c8e3de98.png"
alt="" style="width: 60px;height: 11px;position: absolute;bottom: 0;right: 15px;" />
</view>
<view class="kaituan1-title1">
快呼唤小伙伴参加吧
</view>
</view>
<view class="kaituan2">
<view class="kaituan22">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/801c569079da4540990c1cc634186fdd.png"
alt=""
style="width: 45px;height: 45px;border-radius: 45px;margin: 0 auto;display: block;" />
</view>
<view class="kaituan22">
<view class="weipincheng">
+
</view>
</view>
<view class="kaituan22">
<view class="weipincheng">
+
</view>
</view>
</view>
<view class="kaituan3">
剩余<text style="font-size: 16px;font-weight: 700;padding: 0 10px;color: red;">23:59:23</text>结束
</view>
<view class="kaituan4">
分享至微信 <uni-icons type="weixin" size="15"></uni-icons>
</view>
<view class="kaituan5">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/c1f1b45c98fa4db1a1e5f98b3a0573c2.png"
alt="" style="width: 260px;height: 75px;margin: 0 auto;display: block;" />
</view>
</view>
</view>
</uni-popup>
<delivery-time-op @timeCallback="timeCallback" :dodge="true" ref='model' :content="content" :barHidth='600'
title="选择送达时间">
> </delivery-time-op> > </delivery-time-op>
</view> </view>
</template> </template>
@ -268,14 +339,14 @@
export default { export default {
data() { data() {
return { return {
warnPopup:'shdz', warnPopup: 'shdz',
isPaotui: true, isPaotui: true,
menuButtonInfo: {}, menuButtonInfo: {},
formData:{ formData: {
address:null, address: null,
isImmediately:true, isImmediately: true,
deliveryTime:'', deliveryTime: '',
peisongyuan:'' peisongyuan: ''
}, },
content: [], content: [],
selected: 'buzhiding', selected: 'buzhiding',
@ -315,7 +386,7 @@
}, },
computed: { computed: {
goodsAmountCalc() { goodsAmountCalc() {
if(this.isGroupBuy && this.groupItem) { if (this.isGroupBuy && this.groupItem) {
return parseFloat(this.groupItem.groupRule.groupPrice); return parseFloat(this.groupItem.groupRule.groupPrice);
} else { } else {
return this.cartItems.reduce((acc, curr) => acc + (curr.quantity * parseFloat(curr.price)), 0); return this.cartItems.reduce((acc, curr) => acc + (curr.quantity * parseFloat(curr.price)), 0);
@ -324,11 +395,11 @@
packageFee() { packageFee() {
if (this.totalPackageFee > 0) return this.totalPackageFee; if (this.totalPackageFee > 0) return this.totalPackageFee;
let fee = 0; let fee = 0;
if(this.isGroupBuy && this.groupItem && this.groupItem.item) { if (this.isGroupBuy && this.groupItem && this.groupItem.item) {
fee = parseFloat(this.groupItem.item.lunchBox || 0); fee = parseFloat(this.groupItem.item.lunchBox || 0);
} else if (this.cartItems && this.cartItems.length > 0) { } else if (this.cartItems && this.cartItems.length > 0) {
for(let cart of this.cartItems) { for (let cart of this.cartItems) {
if(cart.item) { if (cart.item) {
fee += parseFloat(cart.item.lunchBox || 0) * cart.quantity; fee += parseFloat(cart.item.lunchBox || 0) * cart.quantity;
} }
} }
@ -336,21 +407,24 @@
return fee; return fee;
}, },
deliveryFeeCalc() { deliveryFeeCalc() {
if(!this.isPaotui) return 0; if (!this.isPaotui) return 0;
let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem.isFaceToFace; let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem
if (isJoiningFaceToFace) return 0; // Front-end doesn't know exact fee, relies on backend after order creation .isFaceToFace;
if (isJoiningFaceToFace)
return 0; // Front-end doesn't know exact fee, relies on backend after order creation
let commission = 0; let commission = 0;
if(this.selected === 'zhiding') { if (this.selected === 'zhiding') {
if (!this.assignedWorker) return 0; if (!this.assignedWorker) return 0;
commission = parseFloat(this.assignedWorker.orderBkge || 3); commission = parseFloat(this.assignedWorker.orderBkge || 3);
} else { } else {
if (this.customCommission !== '' && this.customCommission !== null && !isNaN(parseFloat(this.customCommission))) { if (this.customCommission !== '' && this.customCommission !== null && !isNaN(parseFloat(this
.customCommission))) {
commission = parseFloat(this.customCommission); commission = parseFloat(this.customCommission);
} }
} }
if(this.isGroupBuy && this.groupItem && this.groupItem.isFaceToFace && !this.groupItem.groupId) { if (this.isGroupBuy && this.groupItem && this.groupItem.isFaceToFace && !this.groupItem.groupId) {
let members = parseInt(this.groupItem.groupRule.groupCount) || 1; let members = parseInt(this.groupItem.groupRule.groupCount) || 1;
if(this.selected === 'zhiding') { if (this.selected === 'zhiding') {
let extra = members > 2 ? (members - 2) * 0.5 : 0; let extra = members > 2 ? (members - 2) * 0.5 : 0;
return Math.ceil(((commission + extra) / members) * 10) / 10; return Math.ceil(((commission + extra) / members) * 10) / 10;
} else { } else {
@ -371,8 +445,10 @@
const endTime = new Date(now); const endTime = new Date(now);
startTime.setMinutes(startTime.getMinutes() + 20); startTime.setMinutes(startTime.getMinutes() + 20);
endTime.setMinutes(endTime.getMinutes() + 35); endTime.setMinutes(endTime.getMinutes() + 35);
const startStr = `${startTime.getHours().toString().padStart(2, '0')}:${startTime.getMinutes().toString().padStart(2, '0')}`; const startStr =
const endStr = `${endTime.getHours().toString().padStart(2, '0')}:${endTime.getMinutes().toString().padStart(2, '0')}`; `${startTime.getHours().toString().padStart(2, '0')}:${startTime.getMinutes().toString().padStart(2, '0')}`;
const endStr =
`${endTime.getHours().toString().padStart(2, '0')}:${endTime.getMinutes().toString().padStart(2, '0')}`;
this.immediateTimeStr = `${startStr}-${endStr}`; this.immediateTimeStr = `${startStr}-${endStr}`;
// Listen for selected delivery person event // Listen for selected delivery person event
@ -391,7 +467,9 @@
this.formData.address = cachedAddress; this.formData.address = cachedAddress;
} else { } else {
let that = this; let that = this;
that.tui.request("/app/userAddress/list", "GET", {userId:uni.getStorageSync('id')}, false, true).then((res) => { that.tui.request("/app/userAddress/list", "GET", {
userId: uni.getStorageSync('id')
}, false, true).then((res) => {
if (res.code == 200 && res.result && res.result.length > 0) { if (res.code == 200 && res.result && res.result.length > 0) {
// Find default address or use the first one // Find default address or use the first one
let target = res.result.find(item => item.isDefault == 1) || res.result[0]; let target = res.result.find(item => item.isDefault == 1) || res.result[0];
@ -413,20 +491,23 @@
this.$refs.bookPopup.close(); this.$refs.bookPopup.close();
}, },
getSpecDisplayString(specs) { getSpecDisplayString(specs) {
if(!specs) return ''; if (!specs) return '';
let arr = []; let arr = [];
for(let k in specs) { arr.push(specs[k]); } for (let k in specs) {
arr.push(specs[k]);
}
return arr.join(','); return arr.join(',');
}, },
submitPay(){ submitPay() {
let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem.isFaceToFace; let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem
if(this.isPaotui && !this.formData.address && !isJoiningFaceToFace) { .isFaceToFace;
if (this.isPaotui && !this.formData.address && !isJoiningFaceToFace) {
this.warnPopup = 'shdz'; this.warnPopup = 'shdz';
this.$refs.warnPopup.open(); this.$refs.warnPopup.open();
return; return;
} }
if(this.isPaotui && this.selected === 'buzhiding' && !isJoiningFaceToFace) { if (this.isPaotui && this.selected === 'buzhiding' && !isJoiningFaceToFace) {
let comm = parseFloat(this.customCommission); let comm = parseFloat(this.customCommission);
if (isNaN(comm) || comm <= 0) { if (isNaN(comm) || comm <= 0) {
this.warnPopup = 'psyj'; this.warnPopup = 'psyj';
@ -435,7 +516,7 @@
} }
} }
if(this.isPaotui && this.selected === 'zhiding' && !this.assignedWorker && !isJoiningFaceToFace) { if (this.isPaotui && this.selected === 'zhiding' && !this.assignedWorker && !isJoiningFaceToFace) {
this.warnPopup = 'psy'; this.warnPopup = 'psy';
this.$refs.warnPopup.open(); this.$refs.warnPopup.open();
return; return;
@ -444,19 +525,19 @@
// Validation successful, submit order to backend first to get backendTotalAmount // Validation successful, submit order to backend first to get backendTotalAmount
this.submitOrderToBackend(); this.submitOrderToBackend();
}, },
goDetail(){ goDetail() {
// Pass match conditions to worker list // Pass match conditions to worker list
let shopArea = this.shopItem.shopArea || ''; let shopArea = this.shopItem.shopArea || '';
let putArea = this.formData.address ? this.formData.address.areaId : ''; let putArea = this.formData.address ? this.formData.address.areaId : '';
uni.navigateTo({ uni.navigateTo({
url:`/package1/index/deliveryPersonList?shopAreaId=${shopArea}&putAreaId=${putArea}` url: `/package1/index/deliveryPersonList?shopAreaId=${shopArea}&putAreaId=${putArea}`
}) })
}, },
openAddressBook(){ openAddressBook() {
this.$refs.bookPopup.open('bottom') this.$refs.bookPopup.open('bottom')
}, },
checkTime(type){ checkTime(type) {
if (type === this.formData.isImmediately) { if (type === this.formData.isImmediately) {
if (type === false) { if (type === false) {
this.$refs.model.open() this.$refs.model.open()
@ -473,7 +554,7 @@
checkVoucher(type) { checkVoucher(type) {
if (type == this.selected) return; if (type == this.selected) return;
this.selected = type; this.selected = type;
if(this.selected == 'buzhiding'){ if (this.selected == 'buzhiding') {
this.formData.peisongyuan = ""; this.formData.peisongyuan = "";
this.assignedWorker = null; this.assignedWorker = null;
} }
@ -481,10 +562,10 @@
wxPayment() { wxPayment() {
let that = this; let that = this;
if (!this.currentOrderId || !this.backendTotalAmount) return; if (!this.currentOrderId || !this.backendTotalAmount) return;
let amountInCents = Math.round(this.backendTotalAmount * 100); let amountInCents = Math.round(this.backendTotalAmount * 100);
let payDesc = this.isGroupBuy ? '拼团订单' : '商城订单'; let payDesc = this.isGroupBuy ? '拼团订单' : '商城订单';
this.tui.request("/api/wechat/pay/unified-order", "POST", { this.tui.request("/api/wechat/pay/unified-order", "POST", {
openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid', openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',
amount: amountInCents, // amount: amountInCents, //
@ -501,9 +582,14 @@
paySign: res.paySign, paySign: res.paySign,
success: function(res2) { success: function(res2) {
that.$refs.payPopup.close(); that.$refs.payPopup.close();
uni.showToast({ title: '支付成功', icon: 'success' }); uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ delta: 2 }); uni.navigateBack({
delta: 2
});
}, 1500); }, 1500);
}, },
fail: function(err) { fail: function(err) {
@ -513,11 +599,18 @@
} else { } else {
// () // ()
if (res.code == 404 || res.code == 500 || res.code == 400 || !res.code) { if (res.code == 404 || res.code == 500 || res.code == 400 || !res.code) {
that.tui.request(`/hiver/order/payMallOrderSuccess?orderId=${that.currentOrderId}&workerId=${that.assignedWorker ? that.assignedWorker.workerId : ''}`, "POST", {}, false, false).then(res2 => { that.tui.request(
`/hiver/order/payMallOrderSuccess?orderId=${that.currentOrderId}&workerId=${that.assignedWorker ? that.assignedWorker.workerId : ''}`,
"POST", {}, false, false).then(res2 => {
that.$refs.payPopup.close(); that.$refs.payPopup.close();
uni.showToast({ title: '支付成功(模拟)', icon: 'none' }); uni.showToast({
title: '支付成功(模拟)',
icon: 'none'
});
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ delta: 2 }); uni.navigateBack({
delta: 2
});
}, 1500); }, 1500);
}).catch(e => { }).catch(e => {
that.tui.toast("请求失败"); that.tui.toast("请求失败");
@ -529,9 +622,10 @@
}) })
}, },
getMustFinishTime() { getMustFinishTime() {
if (!this.formData.deliveryTime || this.formData.deliveryTime === '自动送达' || this.formData.deliveryTime === '尽快送达') return null; if (!this.formData.deliveryTime || this.formData.deliveryTime === '自动送达' || this.formData.deliveryTime ===
'尽快送达') return null;
let timeStr = this.formData.deliveryTime; let timeStr = this.formData.deliveryTime;
if(timeStr.length === 5) { if (timeStr.length === 5) {
let [h, m] = timeStr.split(':'); let [h, m] = timeStr.split(':');
let targetHour = parseInt(h); let targetHour = parseInt(h);
let d = new Date(); let d = new Date();
@ -544,10 +638,11 @@
return null; return null;
}, },
submitOrderToBackend() { submitOrderToBackend() {
let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem.isFaceToFace; let isJoiningFaceToFace = this.isGroupBuy && this.groupItem && this.groupItem.groupId && this.groupItem
.isFaceToFace;
let items = []; let items = [];
if(this.isGroupBuy && this.groupItem) { if (this.isGroupBuy && this.groupItem) {
items.push({ items.push({
productId: this.groupItem.item.id, productId: this.groupItem.item.id,
specs: JSON.stringify(this.groupItem.specs || {}), specs: JSON.stringify(this.groupItem.specs || {}),
@ -555,7 +650,7 @@
quantity: 1 quantity: 1
}); });
} else { } else {
for(let cart of this.cartItems) { for (let cart of this.cartItems) {
items.push({ items.push({
productId: cart.item.id, productId: cart.item.id,
specs: JSON.stringify(cart.specs || {}), specs: JSON.stringify(cart.specs || {}),
@ -575,14 +670,16 @@
items: items, items: items,
receiverName: this.formData.address ? this.formData.address.receiverName : '', receiverName: this.formData.address ? this.formData.address.receiverName : '',
receiverPhone: this.formData.address ? this.formData.address.phone : '', receiverPhone: this.formData.address ? this.formData.address.phone : '',
receiverAddress: this.formData.address ? ((this.formData.address.areaName || '') + (this.formData.address.floor ? this.formData.address.floor + '层' : '') + (this.formData.address.roomNum || '')) : '', receiverAddress: this.formData.address ? ((this.formData.address.areaName || '') + (this.formData
.address.floor ? this.formData.address.floor + '层' : '') + (this.formData.address
.roomNum || '')) : '',
shopName: this.shopItem.shopName, shopName: this.shopItem.shopName,
shopPhone: this.shopItem.shopPhone || '', shopPhone: this.shopItem.shopPhone || '',
shopAddress: this.shopItem.shopAddress || '' shopAddress: this.shopItem.shopAddress || ''
}; };
let mft = this.getMustFinishTime(); let mft = this.getMustFinishTime();
if(mft) payload.mustFinishTime = mft; if (mft) payload.mustFinishTime = mft;
if (deliveryType === 1 && !isJoiningFaceToFace) { if (deliveryType === 1 && !isJoiningFaceToFace) {
payload.addressId = this.formData.address ? this.formData.address.id : null; payload.addressId = this.formData.address ? this.formData.address.id : null;
@ -590,14 +687,15 @@
payload.putAreaId = this.formData.address ? this.formData.address.areaId : null; payload.putAreaId = this.formData.address ? this.formData.address.areaId : null;
} }
if(this.isGroupBuy && this.groupItem) { if (this.isGroupBuy && this.groupItem) {
if (this.groupItem.groupId) { if (this.groupItem.groupId) {
payload.groupId = this.groupItem.groupId; payload.groupId = this.groupItem.groupId;
} else { } else {
payload.groupParam = { payload.groupParam = {
targetMembers: parseInt(this.groupItem.groupRule.groupCount), targetMembers: parseInt(this.groupItem.groupRule.groupCount),
isFaceToFace: this.groupItem.isFaceToFace ? 1 : 0, isFaceToFace: this.groupItem.isFaceToFace ? 1 : 0,
selfCommission: this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) : null selfCommission: this.selected === 'buzhiding' ? parseFloat(this.customCommission || 0) :
null
}; };
} }
} }
@ -615,17 +713,22 @@
} }
} }
uni.showLoading({ title: '创建订单中...' }); uni.showLoading({
title: '创建订单中...'
});
this.tui.request("/mall/order/create", "POST", payload, false, false).then(res => { this.tui.request("/mall/order/create", "POST", payload, false, false).then(res => {
uni.hideLoading(); uni.hideLoading();
if(res.success && res.result) { if (res.success && res.result) {
let orderId = res.result.id; let orderId = res.result.id;
let totalAmount = res.result.totalAmount; let totalAmount = res.result.totalAmount;
this.backendTotalAmount = totalAmount; this.backendTotalAmount = totalAmount;
this.currentOrderId = orderId; this.currentOrderId = orderId;
this.$refs.payPopup.open('bottom'); this.$refs.payPopup.open('bottom');
} else { } else {
uni.showToast({ title: res.message || '下单失败', icon: 'none' }); uni.showToast({
title: res.message || '下单失败',
icon: 'none'
});
} }
}).catch(err => { }).catch(err => {
uni.hideLoading(); uni.hideLoading();
@ -637,25 +740,25 @@
const today = new Date(now); const today = new Date(now);
const tomorrow = new Date(now); const tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1); tomorrow.setDate(tomorrow.getDate() + 1);
// //
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const todayWeekday = weekdays[today.getDay()]; const todayWeekday = weekdays[today.getDay()];
const todayStr = `今天 (${todayWeekday})`; const todayStr = `今天 (${todayWeekday})`;
// - // -
const month = tomorrow.getMonth() + 1; const month = tomorrow.getMonth() + 1;
const day = tomorrow.getDate(); const day = tomorrow.getDate();
const tomorrowStr = `${month}-${day}`; const tomorrowStr = `${month}-${day}`;
// ----- ----- // ----- -----
const todayTimelist = [{ const todayTimelist = [{
timestr: '自动送达' timestr: '自动送达'
}]; }];
const currentHour = now.getHours(); const currentHour = now.getHours();
const currentMinute = now.getMinutes(); const currentMinute = now.getMinutes();
// //
let nextHour = currentHour; let nextHour = currentHour;
let nextMinute = 30; let nextMinute = 30;
@ -663,7 +766,7 @@
nextHour = currentHour + 1; nextHour = currentHour + 1;
nextMinute = 0; nextMinute = 0;
} }
// 23:30 // 23:30
for (let h = nextHour; h <= 23; h++) { for (let h = nextHour; h <= 23; h++) {
const startMin = (h === nextHour) ? nextMinute : 0; const startMin = (h === nextHour) ? nextMinute : 0;
@ -675,7 +778,7 @@
}); });
} }
} }
// ----- 00:00 ~ 23:30----- // ----- 00:00 ~ 23:30-----
const tomorrowTimelist = []; const tomorrowTimelist = [];
for (let h = 0; h <= 23; h++) { for (let h = 0; h <= 23; h++) {
@ -687,7 +790,7 @@
}); });
} }
} }
this.content = [{ this.content = [{
timezh: todayStr, timezh: todayStr,
timelist: todayTimelist timelist: todayTimelist
@ -805,10 +908,10 @@
.pintuan-left-price { .pintuan-left-price {
width: 55%; width: 55%;
text-align: right; text-align: right;
font-weight: 700; font-weight: 700;
color: #000; color: #000;
display: flex; display: flex;
} }
.goods-content-bottom { .goods-content-bottom {
@ -816,7 +919,8 @@
line-height: 28px; line-height: 28px;
color: #777; color: #777;
} }
.address-box{
.address-box {
background: #fff; background: #fff;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
@ -824,13 +928,15 @@
font-weight: 700; font-weight: 700;
padding: 0 20px; padding: 0 20px;
} }
.time-box{
.time-box {
background: #fff; background: #fff;
display: flex; display: flex;
height: 70px; height: 70px;
padding: 10px; padding: 10px;
} }
.time1{
.time1 {
height: 50px; height: 50px;
flex: 1; flex: 1;
border-radius: 10px; border-radius: 10px;
@ -839,6 +945,7 @@
line-height: 20px; line-height: 20px;
padding-top: 5px; padding-top: 5px;
} }
.radio-check { .radio-check {
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
width: 24px; width: 24px;
@ -848,7 +955,7 @@
line-height: 24px; line-height: 24px;
margin: 0 10px 0 0; margin: 0 10px 0 0;
} }
.radio-no-check { .radio-no-check {
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -856,6 +963,7 @@
border: 1px solid #eee; border: 1px solid #eee;
margin: 0 10px 0 0; margin: 0 10px 0 0;
} }
.buy-bottom { .buy-bottom {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@ -867,7 +975,7 @@
z-index: 99; z-index: 99;
box-shadow: 0 -10px 15px rgba(0, 0, 0, 0.3); box-shadow: 0 -10px 15px rgba(0, 0, 0, 0.3);
} }
.bottom-btn { .bottom-btn {
width: 90%; width: 90%;
height: 50px; height: 50px;
@ -879,6 +987,7 @@
border-radius: 50px; border-radius: 50px;
margin: 10px auto; margin: 10px auto;
} }
.btn { .btn {
width: 95%; width: 95%;
height: 50px; height: 50px;
@ -890,65 +999,158 @@
text-align: center; text-align: center;
margin: 20px auto 0; margin: 20px auto 0;
} }
.ziqu-box{
.ziqu-box {
background: #eee; background: #eee;
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
border-radius: 10px; border-radius: 10px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.ziqu-xuanfu{
.ziqu-xuanfu {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
padding: 5px 10px; padding: 5px 10px;
background: rgba(166, 255, 234, 1); background: rgba(166, 255, 234, 1);
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
font-weight: 700; font-weight: 700;
font-size: 10px; font-size: 10px;
}
.ziqu-address{
display: flex;
height: 50px;
background: #fff;
width: 90%;
border-radius: 10px;
font-size: 13px;
margin: 30px auto 0;
font-weight: bold;
line-height: 50px;
img{
width: 20px;
height: 20px;
margin: 15px 10px 0 15px;
}
} }
.ziqu-time-box{
width: 90%; .ziqu-address {
margin: 10px auto; display: flex;
display: flex; height: 50px;
font-weight: 700; background: #fff;
width: 90%;
border-radius: 10px;
font-size: 13px;
margin: 30px auto 0;
font-weight: bold;
line-height: 50px;
img {
width: 20px;
height: 20px;
margin: 15px 10px 0 15px;
}
} }
.ziqu-call-box{
.ziqu-time-box {
width: 90%;
margin: 10px auto;
display: flex;
font-weight: 700;
}
.ziqu-call-box {
width: 90%; width: 90%;
display: flex; display: flex;
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
margin: 0 auto 10px; margin: 0 auto 10px;
} }
.ziqu-call{
flex: 1; .ziqu-call {
flex: 1;
} }
.book-popup-content{
.book-popup-content {
position: relative; position: relative;
height: 600px; height: 600px;
width: 100%; width: 100%;
padding: 10px; padding: 10px;
overflow: scroll; overflow: scroll;
} }
.vue-ref{
.vue-ref {
border-radius: 10px !important; border-radius: 10px !important;
} }
</style>
.pintuan-popup {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/780a024aefb7431ba21cf16efc8a482e.png') no-repeat;
background-size: 100%;
width: 300px;
height: 480px;
position: relative;
}
.kaituan1 {
height: 60px;
font-size: 22px;
font-weight: 700;
margin-top: 10px;
}
.kaituan1-title {
position: relative;
text-align: center;
img {
width: 60px;
height: 11px;
position: absolute;
bottom: 0;
right: 125px;
}
}
.kaituan1-title1 {
font-size: 15px;
height: 30px;
line-height: 30px;
text-align: center;
}
.kaituan2 {
display: flex;
width: 90%;
margin: 20px auto;
}
.kaituan22 {
flex: 1;
}
.kaituan3 {
height: 40px;
line-height: 40px;
text-align: center;
color: #777;
}
.kaituan4 {
width: 85%;
height: 50px;
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
border-radius: 50px;
text-align: center;
line-height: 50px;
font-size: 15px;
font-weight: 700;
margin: 10px auto;
}
.kaituan5 {
margin: 20px 0 20px;
}
.weipincheng {
width: 45px;
height: 45px;
background: rgba(166, 255, 234, 0.24);
border-radius: 45px;
text-align: center;
font-size: 60rpx;
font-weight: 700;
margin-left: -6rpx;
z-index: 97;
color: #02fbdd;
border: 1px solid #a6ffea;
line-height: 40px;
margin: 0 auto;
}
</style>
Loading…
Cancel
Save