|
|
@@ -9,6 +9,7 @@
|
|
|
<view class="tui-pro-title app-size-32">
|
|
|
<text v-if="productInfo.presell == 1">【预售】</text>
|
|
|
<text v-if="Number(productInfo.discountPrice) > 0">【推荐】</text>
|
|
|
+ <text v-if="productInfo.variety == 1" class="variety-tag">【多颜色】</text>
|
|
|
{{ productInfo.name}}
|
|
|
</view>
|
|
|
<button
|
|
|
@@ -103,10 +104,48 @@ export default {
|
|
|
previewContent: [],
|
|
|
id:0,
|
|
|
shopId:0,
|
|
|
- ghsInfo:{}
|
|
|
+ ghsInfo:{},
|
|
|
+ xjData: {},
|
|
|
+ hasColorInfo: {}
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {},
|
|
|
+ onShow() {
|
|
|
+ // 监听选颜色页面 (xj.vue) 确认后的返回事件与数据
|
|
|
+ if (this.xjData && this.xjData.hasUpdate == 1) {
|
|
|
+ this.customData = (this.hasColorInfo && this.hasColorInfo.id) ? this.hasColorInfo : this.productInfo;
|
|
|
+ if (this.xjData.cancel == 1) {
|
|
|
+ const customData = {
|
|
|
+ ...this.customData,
|
|
|
+ bigCount: 0,
|
|
|
+ smallCount: 0,
|
|
|
+ itemPrice: this.customData.price
|
|
|
+ };
|
|
|
+ this.addItemEvent(customData);
|
|
|
+ } else {
|
|
|
+ const num = Number(this.xjData.stock) || 0;
|
|
|
+ const price = this.xjData.price || this.customData.price;
|
|
|
+ const customData = {
|
|
|
+ ...this.customData,
|
|
|
+ bigCount: num,
|
|
|
+ smallCount: 0,
|
|
|
+ itemPrice: price,
|
|
|
+ bigPrice: price,
|
|
|
+ smallPrice: 0
|
|
|
+ };
|
|
|
+ this.addItemEvent(customData);
|
|
|
+ if (this.popupAction === 'buy') {
|
|
|
+ this.$util.pageTo({ url: this.getAffirmUrl(), type: 2 });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '已加入购物车',
|
|
|
+ duration: 1500
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.xjData = {};
|
|
|
+ },
|
|
|
mounted() {},
|
|
|
computed: {
|
|
|
...mapGetters({ shopUser: "getShopUser",loginInfo: "getLoginInfo" })
|
|
|
@@ -176,6 +215,31 @@ export default {
|
|
|
}
|
|
|
return true
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 跳转到多颜色花材选颜色页面 (xj.vue)
|
|
|
+ * @param {Object} info 花材商品信息
|
|
|
+ * @param {string} actionType 操作类型: 'cart' 加入购物车, 'buy' 立即购买
|
|
|
+ */
|
|
|
+ goToSpecialVariety(info, actionType = 'cart') {
|
|
|
+ this.popupAction = actionType;
|
|
|
+ this.hasColorInfo = info;
|
|
|
+ const stock = Number(info.stock) || 0;
|
|
|
+ if (stock <= 0) {
|
|
|
+ uni.showToast({ title: "没有库存", icon: "none" });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const ghsId = this.option.ghsId || (this.ghsInfo && this.ghsInfo.id) || '';
|
|
|
+ const ptItemId = info.itemId || info.id || 0;
|
|
|
+ this.$util.pageTo({
|
|
|
+ url: "/pagesPurchase/xj",
|
|
|
+ query: {
|
|
|
+ stock: info.stock,
|
|
|
+ price: info.price,
|
|
|
+ ghsId: ghsId,
|
|
|
+ ptItemId: ptItemId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
openCartPopup() {
|
|
|
if (!this.checkLogin()) {
|
|
|
return
|
|
|
@@ -188,6 +252,10 @@ export default {
|
|
|
this.$msg('暂无库存')
|
|
|
return
|
|
|
}
|
|
|
+ if (this.productInfo.variety == 1) {
|
|
|
+ this.goToSpecialVariety(this.productInfo, 'cart')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.popupAction = 'cart'
|
|
|
this.buyNum = 1
|
|
|
this.popupShow = true
|
|
|
@@ -204,6 +272,10 @@ export default {
|
|
|
this.$msg('暂无库存')
|
|
|
return
|
|
|
}
|
|
|
+ if (this.productInfo.variety == 1) {
|
|
|
+ this.goToSpecialVariety(this.productInfo, 'buy')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.popupAction = 'buy'
|
|
|
this.buyNum = 1
|
|
|
this.popupShow = true
|
|
|
@@ -341,6 +413,23 @@ export default {
|
|
|
.shop-intro {
|
|
|
background: #fff;
|
|
|
padding: 30upx 0 10upx 30upx;
|
|
|
+ .variety-tag {
|
|
|
+ color: #049e2c;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .variety-action-row {
|
|
|
+ margin: 10upx 0 20upx;
|
|
|
+ .variety-button {
|
|
|
+ display: inline-block;
|
|
|
+ border: 2upx solid #049e2c;
|
|
|
+ border-radius: 24upx;
|
|
|
+ padding: 10upx 30upx;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #049e2c;
|
|
|
+ font-weight: bold;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
.tui-pro-titbox {
|
|
|
margin: 30upx 0 20upx;
|
|
|
@include disFlex(center, space-between);
|