添加:商品绑定代理中省公司后下单特殊处理
This commit is contained in:
parent
26c761bc2d
commit
a4e794a4c5
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue