|
@@ -2,6 +2,8 @@
|
|
|
混合结算页(花束+花材),立即购买
|
|
混合结算页(花束+花材),立即购买
|
|
|
用途:商城混合购物车确认下单,支持多种配送方式、红包、贺卡与匿名配送
|
|
用途:商城混合购物车确认下单,支持多种配送方式、红包、贺卡与匿名配送
|
|
|
整单优惠:会员折扣与门店满减互斥,左侧名称、右侧 -¥N,只展示优惠金额更大的一项
|
|
整单优惠:会员折扣与门店满减互斥,左侧名称、右侧 -¥N,只展示优惠金额更大的一项
|
|
|
|
|
+ 团购开团/参团:立即购买模式进入,不享会员折扣/门店满减、不可用红包,提交走开团/参团接口
|
|
|
|
|
+ 团购跑腿与购物车结算同源:展示门店启用的跑腿方式,提交后由后端按混合单规则重算运费
|
|
|
布局:贺卡/匿名/备注后为运费+折扣+红包同一卡片;贺卡默认不需要,匿名默认否,备注单行
|
|
布局:贺卡/匿名/备注后为运费+折扣+红包同一卡片;贺卡默认不需要,匿名默认否,备注单行
|
|
|
顶部公告:/shop-notice/show-list position=8(订单提交),公告条与分类页 shop-category 同款(noticeBar)
|
|
顶部公告:/shop-notice/show-list position=8(订单提交),公告条与分类页 shop-category 同款(noticeBar)
|
|
|
限购超限 / 库存不足:create-mix-order 返回超限或库存不足商品后红框高亮,并写入本地供购物车继续展示
|
|
限购超限 / 库存不足:create-mix-order 返回超限或库存不足商品后红框高亮,并写入本地供购物车继续展示
|
|
@@ -66,7 +68,7 @@
|
|
|
<view class="modify-link" @click="modifyItem">
|
|
<view class="modify-link" @click="modifyItem">
|
|
|
<!-- 原 iconfont 36upx,颜色随文案 #77c34f -->
|
|
<!-- 原 iconfont 36upx,颜色随文案 #77c34f -->
|
|
|
<zui-svg-icon icon="general-cartFull" :width="18" :height="18" color="#77c34f" style="margin-right: 8rpx" />
|
|
<zui-svg-icon icon="general-cartFull" :width="18" :height="18" color="#77c34f" style="margin-right: 8rpx" />
|
|
|
- <text>返回修改</text>
|
|
|
|
|
|
|
+ <text>{{ isGroupBuyCheckout ? '返回团购' : '返回修改' }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="product-total">
|
|
<view class="product-total">
|
|
|
<text class="product-total-label">商品合计</text>
|
|
<text class="product-total-label">商品合计</text>
|
|
@@ -360,8 +362,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <!-- 运费、会员折扣、红包同一卡片;红包行单独可点,避免点运费也弹层 -->
|
|
|
|
|
- <view class="affirm-card fee-card fee-hb-card">
|
|
|
|
|
|
|
+ <!-- 运费、会员折扣、红包同一卡片;团购单不展示折扣与红包 -->
|
|
|
|
|
+ <view class="affirm-card fee-card fee-hb-card" v-if="showFeeHbCard">
|
|
|
<view class="fee-row" v-if="Number(form.unMeetSendCost) > 0">
|
|
<view class="fee-row" v-if="Number(form.unMeetSendCost) > 0">
|
|
|
<text class="fee-label">运费</text>
|
|
<text class="fee-label">运费</text>
|
|
|
<text class="accent-text">¥{{ form.unMeetSendCost }}</text>
|
|
<text class="accent-text">¥{{ form.unMeetSendCost }}</text>
|
|
@@ -375,6 +377,7 @@
|
|
|
<text :class="wholeDiscountAmountClass">{{ wholeDiscountAmountText }}</text>
|
|
<text :class="wholeDiscountAmountClass">{{ wholeDiscountAmountText }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view
|
|
<view
|
|
|
|
|
+ v-if="!isGroupBuyCheckout"
|
|
|
class="hb-row-inner"
|
|
class="hb-row-inner"
|
|
|
:class="{ 'fee-row--follow': Number(form.unMeetSendCost) > 0 || !!wholeDiscountLabel }"
|
|
:class="{ 'fee-row--follow': Number(form.unMeetSendCost) > 0 || !!wholeDiscountLabel }"
|
|
|
@click="openHbPopup"
|
|
@click="openHbPopup"
|
|
@@ -486,12 +489,15 @@
|
|
|
/**
|
|
/**
|
|
|
* 混合结算页(花束+花材),立即购买
|
|
* 混合结算页(花束+花材),立即购买
|
|
|
* 花束与花材合并下单,支持跑腿/自取/快递等多种配送及红包抵扣
|
|
* 花束与花材合并下单,支持跑腿/自取/快递等多种配送及红包抵扣
|
|
|
|
|
+ * 团购开团/参团从详情页以立即购买进入:不打折不用红包,提交走 /group-buy/create 或 /group-buy/join
|
|
|
|
|
+ * 团购跑腿与混合单同源:结算页展示跑腿,后端按 calcMixRunnerFreight 重算运费
|
|
|
* 配送时间弹层:最近7天 + 10分钟时段,默认当前时间推后一小时,不可选过去
|
|
* 配送时间弹层:最近7天 + 10分钟时段,默认当前时间推后一小时,不可选过去
|
|
|
* 跑腿运费:包运费花束 / 不包运费花束 / 纯花材满减;calcType 跑腿或自定义,跑腿异常兜底自定义
|
|
* 跑腿运费:包运费花束 / 不包运费花束 / 纯花材满减;calcType 跑腿或自定义,跑腿异常兜底自定义
|
|
|
*/
|
|
*/
|
|
|
import SpriteIcon from "@/components/sprite-icon/index.vue";
|
|
import SpriteIcon from "@/components/sprite-icon/index.vue";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
import { createMixOrder, inform } from "@/api/order";
|
|
import { createMixOrder, inform } from "@/api/order";
|
|
|
|
|
+import { createGroup, joinGroup } from "@/api/group-buy";
|
|
|
import { allDeliveryQuotes } from "@/api/express/delivery";
|
|
import { allDeliveryQuotes } from "@/api/express/delivery";
|
|
|
import { getUserDistance } from "@/api/express";
|
|
import { getUserDistance } from "@/api/express";
|
|
|
import { currentInfo } from "@/api/user";
|
|
import { currentInfo } from "@/api/user";
|
|
@@ -628,6 +634,7 @@ export default {
|
|
|
this.list = this.buildMergedCartList();
|
|
this.list = this.buildMergedCartList();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ this.syncGroupBuyNavTitle();
|
|
|
|
|
|
|
|
this.loadShopInfo();
|
|
this.loadShopInfo();
|
|
|
this.loadSelectedAddress();
|
|
this.loadSelectedAddress();
|
|
@@ -723,6 +730,9 @@ export default {
|
|
|
* 是否至少有一个满足商品范围、活动限制及最低消费的红包。
|
|
* 是否至少有一个满足商品范围、活动限制及最低消费的红包。
|
|
|
*/
|
|
*/
|
|
|
hasAvailableHb() {
|
|
hasAvailableHb() {
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
if (!this.hbData || this.hbData.length === 0) {
|
|
if (!this.hbData || this.hbData.length === 0) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -730,6 +740,26 @@ export default {
|
|
|
return isHbAvailable(item, this.hbProductList, this.allPriceFun);
|
|
return isHbAvailable(item, this.hbProductList, this.allPriceFun);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 团购立即购买:单商品开团/参团,不走购物车混合单
|
|
|
|
|
+ */
|
|
|
|
|
+ isGroupBuyCheckout() {
|
|
|
|
|
+ return (this.list || []).some((item) => item && item.activityType === "groupBuy");
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 团购结算动作:create 开团 / join 参团 */
|
|
|
|
|
+ groupBuyCheckoutAction() {
|
|
|
|
|
+ const row = (this.list || []).find((item) => item && item.activityType === "groupBuy");
|
|
|
|
|
+ return row && row.groupBuyAction === "join" ? "join" : "create";
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 费用+红包卡片:团购只在有附加运费时展示,且不含折扣/红包
|
|
|
|
|
+ */
|
|
|
|
|
+ showFeeHbCard() {
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ return Number(this.form.unMeetSendCost) > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ },
|
|
|
/**
|
|
/**
|
|
|
* 秒杀花束行合计。秒杀已是活动价,不进入会员折/门店满减基数,与后端 seckillGoodsPrice 对齐。
|
|
* 秒杀花束行合计。秒杀已是活动价,不进入会员折/门店满减基数,与后端 seckillGoodsPrice 对齐。
|
|
|
*/
|
|
*/
|
|
@@ -783,6 +813,10 @@ export default {
|
|
|
* 会员折扣与门店满减互斥结果:type=member|shop|none,amount 为优惠额。
|
|
* 会员折扣与门店满减互斥结果:type=member|shop|none,amount 为优惠额。
|
|
|
*/
|
|
*/
|
|
|
wholeDiscountPick() {
|
|
wholeDiscountPick() {
|
|
|
|
|
+ // 团购价已是活动价,整单不再叠加会员折扣或门店满减
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ return { type: "none", amount: 0 };
|
|
|
|
|
+ }
|
|
|
return this.pickWholeOrderDiscount(this.wholeDiscountBasePrice, this.mixMeetCutBigNum);
|
|
return this.pickWholeOrderDiscount(this.wholeDiscountBasePrice, this.mixMeetCutBigNum);
|
|
|
},
|
|
},
|
|
|
/** 确认页费用行左侧:会员折扣 / 门店满减优惠 */
|
|
/** 确认页费用行左侧:会员折扣 / 门店满减优惠 */
|
|
@@ -964,7 +998,7 @@ export default {
|
|
|
showDeliveryTimeSection() {
|
|
showDeliveryTimeSection() {
|
|
|
return ![3, 4].includes(Number(this.form.sendType));
|
|
return ![3, 4].includes(Number(this.form.sendType));
|
|
|
},
|
|
},
|
|
|
- /** 可选购买方式:接口 xhPsMethod 启用项,按 sort 升序 */
|
|
|
|
|
|
|
+ /** 可选购买方式:接口 xhPsMethod 启用项,按 sort 升序;团购与混合单展示同一套 */
|
|
|
sendTypeOptions() {
|
|
sendTypeOptions() {
|
|
|
return this.getEnabledPsMethods().map((method) => {
|
|
return this.getEnabledPsMethods().map((method) => {
|
|
|
const value = Number(method.style);
|
|
const value = Number(method.style);
|
|
@@ -1489,9 +1523,9 @@ export default {
|
|
|
this.defaultAddressLoaded = true;
|
|
this.defaultAddressLoaded = true;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- /** 打开红包选择弹层(整行可点) */
|
|
|
|
|
|
|
+ /** 打开红包选择弹层(整行可点);团购单不可用红包 */
|
|
|
openHbPopup() {
|
|
openHbPopup() {
|
|
|
- if (!this.hasAvailableHb) {
|
|
|
|
|
|
|
+ if (this.isGroupBuyCheckout || !this.hasAvailableHb) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (this.$refs.hbSelectRef && this.$refs.hbSelectRef.openPopup) {
|
|
if (this.$refs.hbSelectRef && this.$refs.hbSelectRef.openPopup) {
|
|
@@ -2313,7 +2347,7 @@ export default {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.$util.confirmModal({ content: "确认提交?" }, () => {
|
|
|
|
|
|
|
+ this.$util.confirmModal({ content: this.isGroupBuyCheckout ? "确认提交团购订单?" : "确认提交?" }, () => {
|
|
|
this.submitMyForm();
|
|
this.submitMyForm();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -2357,7 +2391,8 @@ export default {
|
|
|
unMeetSendCost: this.form.unMeetSendCost || 0
|
|
unMeetSendCost: this.form.unMeetSendCost || 0
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- if (this.hasAvailableHb && this.selectedHbId) {
|
|
|
|
|
|
|
+ // 团购单不使用红包;普通混合单才带上选中的红包
|
|
|
|
|
+ if (!this.isGroupBuyCheckout && this.hasAvailableHb && this.selectedHbId) {
|
|
|
params.hbId = this.selectedHbId;
|
|
params.hbId = this.selectedHbId;
|
|
|
params.hbAmount = this.selectedHb.amount;
|
|
params.hbAmount = this.selectedHb.amount;
|
|
|
}
|
|
}
|
|
@@ -2400,23 +2435,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
uni.showLoading({ mask: true });
|
|
uni.showLoading({ mask: true });
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ this.submitGroupBuyOrder(params, hdId);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
createMixOrder(params).then((res) => {
|
|
createMixOrder(params).then((res) => {
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
if (res.code && res.code == 1) {
|
|
if (res.code && res.code == 1) {
|
|
|
this.clearLimitExceedState();
|
|
this.clearLimitExceedState();
|
|
|
- const account = this.option.account ? this.option.account : uni.getStorageSync("account") || 0;
|
|
|
|
|
- const getPayType = res.data.getPayType ? res.data.getPayType : 0;
|
|
|
|
|
- const totalPrice = res.data.totalPrice ? res.data.totalPrice : 0;
|
|
|
|
|
- const orderSn = res.data.orderSn ? res.data.orderSn : "";
|
|
|
|
|
- const id = res.data.id ? res.data.id : 0;
|
|
|
|
|
- this.$util.pageTo({
|
|
|
|
|
- url: "/pages/callback/pay?account=" + account + "&id=" + id + "&hdId=" + hdId + "&pageStatus=1&getPayType=" + getPayType + "&totalPrice=" + totalPrice + "&orderSn=" + orderSn,
|
|
|
|
|
- type: 2
|
|
|
|
|
- });
|
|
|
|
|
- // 仅下单成功才清空购物车记忆;失败时保留,便于返回购物车减数量
|
|
|
|
|
- if (!this.isBuyNow) {
|
|
|
|
|
- this.removeMemory();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.goPayAfterOrder(res.data || {}, hdId);
|
|
|
} else if (this.applyLimitExceedFromResponse(res)) {
|
|
} else if (this.applyLimitExceedFromResponse(res)) {
|
|
|
this.$msg(res.msg || "商品超出可购买数量");
|
|
this.$msg(res.msg || "商品超出可购买数量");
|
|
|
} else {
|
|
} else {
|
|
@@ -2430,7 +2457,80 @@ export default {
|
|
|
this.$msg(err.msg);
|
|
this.$msg(err.msg);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 团购提交:走开团或参团接口,带上结算页选好的配送方式(含跑腿平台报价字段),不传红包。
|
|
|
|
|
+ * 跑腿运费以后端 calcMixRunnerFreight 重算为准,与混合单一致。
|
|
|
|
|
+ * hideError 避免拦截器短 toast 被 hideLoading 立刻盖掉。
|
|
|
|
|
+ */
|
|
|
|
|
+ submitGroupBuyOrder(params, hdId) {
|
|
|
|
|
+ const row = (this.list || []).find((item) => item && item.activityType === "groupBuy") || {};
|
|
|
|
|
+ const activityGoodsId = Number(row.activityGoodsId) || 0;
|
|
|
|
|
+ const groupBuyId = Number(row.groupBuyId) || 0;
|
|
|
|
|
+ const goodsNum = Number(row.bigCount) || 1;
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ activityGoodsId,
|
|
|
|
|
+ groupBuyId,
|
|
|
|
|
+ goodsNum
|
|
|
|
|
+ };
|
|
|
|
|
+ delete payload.hbId;
|
|
|
|
|
+ delete payload.hbAmount;
|
|
|
|
|
+ delete payload.product;
|
|
|
|
|
+ const isJoin = this.groupBuyCheckoutAction === "join";
|
|
|
|
|
+ if (isJoin && groupBuyId <= 0) {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ this.$msg("拼团无效");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!isJoin && activityGoodsId <= 0) {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ this.$msg("团购商品无效");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const request = isJoin
|
|
|
|
|
+ ? joinGroup(payload, { hideError: true })
|
|
|
|
|
+ : createGroup(payload, { hideError: true });
|
|
|
|
|
+ request.then((res) => {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ if (res.code && res.code == 1 && res.data) {
|
|
|
|
|
+ this.goPayAfterOrder(res.data, hdId);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (res && res.msg) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ mask: true,
|
|
|
|
|
+ duration: 3000
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((err) => {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ this.$msg((err && err.msg) || "提交失败");
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 下单成功跳转待付款页(混合单与团购单共用)
|
|
|
|
|
+ */
|
|
|
|
|
+ goPayAfterOrder(data, hdId) {
|
|
|
|
|
+ const account = this.option.account ? this.option.account : uni.getStorageSync("account") || 0;
|
|
|
|
|
+ const getPayType = data.getPayType ? data.getPayType : 0;
|
|
|
|
|
+ const totalPrice = data.totalPrice ? data.totalPrice : 0;
|
|
|
|
|
+ const orderSn = data.orderSn ? data.orderSn : "";
|
|
|
|
|
+ const id = data.id ? data.id : 0;
|
|
|
|
|
+ this.$util.pageTo({
|
|
|
|
|
+ url: "/pages/callback/pay?account=" + account + "&id=" + id + "&hdId=" + hdId + "&pageStatus=1&getPayType=" + getPayType + "&totalPrice=" + totalPrice + "&orderSn=" + orderSn,
|
|
|
|
|
+ type: 2
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!this.isBuyNow) {
|
|
|
|
|
+ this.removeMemory();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
modifyItem() {
|
|
modifyItem() {
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ this.$util.pageTo(1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
const account = this.option.account ? this.option.account : uni.getStorageSync("account") || 0;
|
|
const account = this.option.account ? this.option.account : uni.getStorageSync("account") || 0;
|
|
|
const hdId = this.option.hdId ? this.option.hdId : uni.getStorageSync("hdId") || 0;
|
|
const hdId = this.option.hdId ? this.option.hdId : uni.getStorageSync("hdId") || 0;
|
|
|
this.$util.pageTo({ url: "/pages/home/cart?account=" + account + "&hdId=" + hdId, type: 2 });
|
|
this.$util.pageTo({ url: "/pages/home/cart?account=" + account + "&hdId=" + hdId, type: 2 });
|
|
@@ -2474,6 +2574,17 @@ export default {
|
|
|
this.limitExceedList = [];
|
|
this.limitExceedList = [];
|
|
|
clearMixLimitExceed();
|
|
clearMixLimitExceed();
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 团购结算改导航标题,避免仍显示「立即购买」
|
|
|
|
|
+ */
|
|
|
|
|
+ syncGroupBuyNavTitle() {
|
|
|
|
|
+ if (!this.isGroupBuyCheckout) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
|
|
+ title: this.groupBuyCheckoutAction === "join" ? "确认参团" : "确认开团"
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
showItemTips(item) {
|
|
showItemTips(item) {
|
|
|
if (!item) {
|
|
if (!item) {
|
|
|
return false;
|
|
return false;
|
|
@@ -2505,6 +2616,12 @@ export default {
|
|
|
* 若不拦截会连打三次 /hb/available-hb;失败时清标记以便重试。
|
|
* 若不拦截会连打三次 /hb/available-hb;失败时清标记以便重试。
|
|
|
*/
|
|
*/
|
|
|
getHbData() {
|
|
getHbData() {
|
|
|
|
|
+ if (this.isGroupBuyCheckout) {
|
|
|
|
|
+ this.hbData = [];
|
|
|
|
|
+ this.selectedHbId = null;
|
|
|
|
|
+ this.selectedHb = null;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!this.shopInfo || !this.shopInfo.id) {
|
|
if (!this.shopInfo || !this.shopInfo.id) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|