|
|
@@ -121,6 +121,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="limit-buy-tip" v-if="getLimitBuyWarn(item)">
|
|
|
+ {{ getLimitBuyWarn(item) }}
|
|
|
+ </view>
|
|
|
<view style="text-align:right;">
|
|
|
<view class="open-bx" >
|
|
|
<i class="iconfont iconjian" @click.stop="delCurrent(item)" v-if="item.bigCount > 0 || item.smallCount > 0"></i>
|
|
|
@@ -159,6 +162,7 @@ import allMoreSelectInputMins from "@/mixins/allMoreSelectInput";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
import { getInfo } from "@/api/shop";
|
|
|
+import { getLimitBuyInfo } from "@/api/order";
|
|
|
export default {
|
|
|
name: "item",
|
|
|
components: {
|
|
|
@@ -206,6 +210,7 @@ export default {
|
|
|
newCustomGift:{xrFlAmount:0},
|
|
|
isNewCustom:false,
|
|
|
cartItemShow:false,
|
|
|
+ limitBuyWarnList: [],
|
|
|
shopName:'',
|
|
|
shopImg:'',
|
|
|
hdId:0,
|
|
|
@@ -297,11 +302,19 @@ export default {
|
|
|
},
|
|
|
delMemory(){
|
|
|
this.cartItemShow = false
|
|
|
+ this.limitBuyWarnList = []
|
|
|
this.removeMemory()
|
|
|
},
|
|
|
hideCartItem(){
|
|
|
this.cartItemShow = false
|
|
|
},
|
|
|
+ getLimitBuyWarn(item) {
|
|
|
+ const info = this.limitBuyWarnList.find(warnItem => warnItem.id == item.id)
|
|
|
+ if (!info) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ return `超出限购${info.currentBuyNum + info.exceedNum}份`
|
|
|
+ },
|
|
|
loginSuccess() {
|
|
|
this.initData()
|
|
|
},
|
|
|
@@ -495,15 +508,41 @@ export default {
|
|
|
this.$msg("请选择花材")
|
|
|
return
|
|
|
}
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
- let account = this.option.account ? this.option.account : 0
|
|
|
- this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:1})
|
|
|
+ const ghsId = Number(this.option.account) || Number(uni.getStorageSync('account')) || 0
|
|
|
+ if (!ghsId) {
|
|
|
+ this.$msg("缺少店铺信息")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let newList = list.map(item => {
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ bigCount: item.bigCount
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getLimitBuyInfo({ ghsId, list: newList }).then(res => {
|
|
|
+ const limitBuyInfo = Array.isArray(res.data) ? res.data : []
|
|
|
+ const warnList = limitBuyInfo.filter(item => item.specialPrice === false && item.reachLimitBuyNum === true)
|
|
|
+ if (warnList.length > 0) {
|
|
|
+ this.limitBuyWarnList = warnList
|
|
|
+ this.cartItemShow = true
|
|
|
+ this.$msg("有花材超出限购")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.limitBuyWarnList = []
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
+ this.setLimitBuyInfoByType({ type: this.pageType, info: limitBuyInfo });
|
|
|
+ let account = this.option.account ? this.option.account : 0
|
|
|
+ this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:1})
|
|
|
+ }).catch(() => {
|
|
|
+ this.$msg("限购信息获取失败,请稍后重试")
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$msg("请选择花材");
|
|
|
}
|
|
|
},
|
|
|
change(e) {
|
|
|
this.resetSelectInfoByType(this.pageType);
|
|
|
+ this.resetLimitBuyInfoByType(this.pageType);
|
|
|
if (this.tabIndex == e.index) {
|
|
|
return false;
|
|
|
} else {
|
|
|
@@ -900,6 +939,7 @@ export default {
|
|
|
justify-content: center;
|
|
|
flex: 1;
|
|
|
margin-left: 20upx;
|
|
|
+ position: relative;
|
|
|
.info-line {
|
|
|
margin-bottom: 20upx;
|
|
|
display: flex;
|
|
|
@@ -924,6 +964,15 @@ export default {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ .limit-buy-tip {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 86upx;
|
|
|
+ color: red;
|
|
|
+ font-size: 24upx;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
.open-bx {
|
|
|
align-items: center;
|