添加:商品绑定代理中省公司后下单特殊处理

This commit is contained in:
wuhui_zzw 2024-04-19 16:39:47 +08:00
parent 26c761bc2d
commit a4e794a4c5
1 changed files with 199 additions and 39 deletions

View File

@ -278,7 +278,7 @@
<!-- #endif -->
</view>
</view>
<view style='height:120rpx;'></view>
<view class="bottom-empty"></view>
</scroll-view>
</view>
<view class='footer acea-row row-between-wrapper'>
@ -408,7 +408,44 @@
<view class="close-btn" @click="closeAgreePopup">关闭</view>
</view>
</uni-popup>
</view>
<!-- 所在地区选择 -->
<uni-popup ref="provincePopup" type="bottom">
<view class="province-select-content">
<view class="item-box title">请选择城市</view>
<scroll-view scroll-y="true" class="scroll-view">
<view
class="item-box list-item"
v-for="(item, index) in province_list"
@click="selectedProvince(item)"
:key="index"
v-if="item.province_name">
{{ item.province_name || '' }}
</view>
</scroll-view>
</view>
</uni-popup>
<!-- 发货地址选择 -->
<uni-popup ref="sendProvincePopup" type="bottom">
<view class="province-select-content">
<view class="item-box title">请选择发货城市</view>
<scroll-view scroll-y="true" class="scroll-view">
<view
class="item-box list-item"
v-for="(item, index) in province_has_info_list"
@click="selectedSendProvince(item)"
:key="index"
v-if="item.province_name">
{{ item.province_name || '' }}
</view>
</scroll-view>
</view>
</uni-popup>
</view>
</template>
<script>
@ -610,6 +647,16 @@
news: {},
countdown_timer: 0,
intervalId: '',
//
agent_two_ids: [],
province_list: [],//
province_has_list: [],// ids
province_has_info_list: [],//
current_province_info: [],//
send_province_info: [],//
};
},
computed:{
@ -1069,7 +1116,6 @@
});
let that = this;
getProductDetail(that.id).then(res => {
uni.hideLoading();
let storeInfo = res.data;
if (storeInfo.video_link && storeInfo.slider_image.length > 1) {
this.videoCoverImg = storeInfo.slider_image[0]
@ -1099,8 +1145,12 @@
that.$set(that, 'min_count', res.data.once_min_count);
that.$set(that, 'svipData', res.data.show_svip_info || null);
that.$set(that, 'svipPrice', res.data.show_svip_info && res.data.show_svip_info.show_svip_price || false);
//
that.$set(that, 'agent_two_ids', res.data.agent_two_ids || [])
that.$set(that, 'province_list', res.data.province_list || [])
that.$set(that, 'province_has_list', res.data.province_has_list || [])
uni.setNavigationBarTitle({
uni.setNavigationBarTitle({
title: storeInfo.store_name.substring(0, 7) + "..."
})
that.$set(that, 'storeImage', that.storeInfo.image);
@ -1126,16 +1176,7 @@
//
let merchant = res.data.merchant || {};
let merId = Number(merchant.mer_id) || 0;
console.log("相关商户信息")
console.log(merId)
that.$set(that.storeInfo, 'merchant', (Number(merId) > 0 ? merchant : {}));
console.log("商户信息");
console.log(that.storeInfo.merchant);
//
that.$set(that, 'buy_agreement', res.data.buy_agreement ? (res.data.buy_agreement.content || '') : '');
if(that.buy_agreement) that.is_agree = false;
@ -1155,6 +1196,12 @@
that.getPricrRule(that.storeInfo.cate_id)
that.$nextTick(function() {
that.getCouponList();
//
if(Object.values(that.province_list).length > 0){
that.provinceListHandle();
}else{
uni.hideLoading();
}
})
}).catch(err => {
//
@ -1443,30 +1490,30 @@
product_attr_unique: that.attr.productSelect !== undefined ? that.attr.productSelect.unique : "",
source: this.source,
product_type: 0,
spread_id: this.currSpid
};
postCartAdd(q)
.then(function(res) {
that.isOpen = that.attr.cartAttr = false;
let cartId = res.data.cart_id
if (news) {
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + cartId
});
} else {
that.$util.Tips({
title: "添加购物车成功",
success: () => {
that.getCartCount(true);
}
});
}
})
.catch(res => {
return that.$util.Tips({
title: res
});
});
spread_id: this.currSpid,
province_here_id: that.current_province_info.mer_id || 0,// id
province_send_id: that.send_province_info.mer_id || 0,// id
};
postCartAdd(q).then(function (res) {
that.isOpen = that.attr.cartAttr = false;
let cartId = res.data.cart_id
if (news) {
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + cartId
});
} else {
that.$util.Tips({
title: "添加购物车成功",
success: () => {
that.getCartCount(true);
}
});
}
}).catch(res => {
return that.$util.Tips({
title: res
});
});
},
/**调用check接口判断是否超出限购数量*/
isExceedLimit(){
@ -1790,10 +1837,92 @@
},
closeAgreePopup(){
this.$refs.agreePopup.close();
}
},
// -
provinceListHandle(){
let _this = this;
if(Object.values(_this.current_province_info) <= 0) this.$refs.provincePopup.open('bottom');
},
// -
selectedProvince(item) {
let _this = this;
this.$refs.provincePopup.close();
_this.current_province_info = item;//
//
if (Object.values(_this.province_has_list).includes(Number(item.mer_id))) {
//
// console.log(' ')
_this.send_province_info = item;//
} else {
//
// console.log(' ')
_this.getProvinceHasList();//
if (Object.values(_this.province_has_info_list).length >= 2) {
//
// console.log('')
uni.showModal({
title: '提示',
content: '本地区暂无库存,请选择发货地区!',
confirmText: '去选择',
showCancel: false,
success: (res) => {
_this.$refs.sendProvincePopup.open('bottom');
}
});
}
else if (Object.values(_this.province_has_info_list).length == 1) {
// 1
// console.log('1')
_this.send_province_info = _this.province_has_info_list[0];//
}
else {
//
// console.log('')
uni.showModal({
title: '提示',
content: '暂无库存!!',
confirmText: '返回首页',
showCancel: false,
success: (res) => {
if (res.confirm) {
uni.switchTab({
url: '/pages/index/index'
});
}
}
});
return false;
}
}
},
// -
getProvinceHasList(){
let _this = this;
let list = [];
Object.values(_this.province_list).forEach((item) => {
if(Object.values(_this.province_has_list).includes(Number(item.mer_id))){
list[Object.values(list).length] = Object.assign({}, item);
}
})
_this.province_has_info_list = Object.values(list);
},
// -
selectedSendProvince(item){
this.send_province_info = Object.assign({}, item);//
this.$refs.sendProvincePopup.close();
},
}
}
</script>
<style lang="scss" scoped>
.agree-content{
height: 80vh!important;
@ -1843,6 +1972,37 @@
text-align: center;
}
}
.bottom-empty{
height: 120rpx;
height: calc(120rpx+ constant(safe-area-inset-bottom)) !important; /// IOS<11.2/
height: calc(120rpx + env(safe-area-inset-bottom)) !important; /// IOS>11.2/
}
.province-select-content{
height: 100vh!important;
background: #ffffff;
padding: 200rpx 0 50rpx 0;
position: relative;
.item-box{
padding: 0 25rpx;
height: 70rpx;
line-height: 70rpx;
font-size: 30rpx;
}
.title{
background-color: #f5f5f5;
}
.scroll-view{
height: calc(100vh - (200rpx + 70rpx));
width: 100%;
.list-item{
border-bottom: 2rpx solid #cccccc;
}
}
}
.ml8{
top:2rpx
}
@ -1936,7 +2096,7 @@
color: #FBB324;
}
.product-con .footer {
padding: 0 20rpx 0 30rpx;
padding: 0 25rpx 0 25rpx;
position: fixed;
left: 0;
bottom: 0;