|
@@ -90,6 +90,7 @@
|
|
|
<view class="btn" v-else>去结算</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-toast ref="uToast"></u-toast>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -98,6 +99,7 @@
|
|
|
mixins: [MescrollMixin], // 使用mixin
|
|
|
data() {
|
|
|
return {
|
|
|
+ hasAddr:false,
|
|
|
buyNowId:null,//立即购买id
|
|
|
buyNowName:'',//立即购买商品
|
|
|
staticUrl:this.$commonConfig.staticUrl,
|
|
@@ -160,6 +162,9 @@
|
|
|
this.buyNowId = page.buyNowId;
|
|
|
this.buyNowName = page.buyNowName;
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ this.getAddrList();
|
|
|
+ },
|
|
|
methods: {
|
|
|
/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
|
|
|
downCallback(){
|
|
@@ -291,18 +296,41 @@
|
|
|
submitorder(){
|
|
|
// console.log('submitorder',this.selectGoods);
|
|
|
let param = {};
|
|
|
+ if(!this.hasAddr){
|
|
|
+ // this.$refs.uToast.show({
|
|
|
+ // type: 'error',
|
|
|
+ // title: '提示',
|
|
|
+ // message: "请先去'我的-地址管理'设置收货地址!",
|
|
|
+ // duration:3000
|
|
|
+ // })
|
|
|
+ uni.showModal({
|
|
|
+ title: '温馨提示',
|
|
|
+ content: '请先设置地址!',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.$u.route('/center/addrlist', {
|
|
|
+ from: 'cart'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
param.goodsList = this.selectGoods.map(item=>{
|
|
|
return {goodsId:item.goodsId,quantity:item.quantity}
|
|
|
})
|
|
|
- // console.log('param',param);
|
|
|
- this.$u.api.getSettlement(param).then(res=>{
|
|
|
- uni.$u.route('/shopping/submitorder', {
|
|
|
- selectGoods: JSON.stringify(res.data),
|
|
|
- });
|
|
|
- // console.log('submitorder',res.data);
|
|
|
- }).catch(err=>{
|
|
|
- console.log('getSettlement',err.data);
|
|
|
- })
|
|
|
+ this.$u.vuex('cartGoods', param.goodsList);
|
|
|
+ uni.$u.route('/shopping/submitorder', {});
|
|
|
+ // // console.log('param',param);取消在这个获取订单结算详情
|
|
|
+ // this.$u.api.getSettlement(param).then(res=>{
|
|
|
+ // console.log('submitorder',res.data);
|
|
|
+ // // return
|
|
|
+ // uni.$u.route('/shopping/submitorder', {
|
|
|
+ // selectGoods: JSON.stringify(res.data),
|
|
|
+ // });
|
|
|
+ // }).catch(err=>{
|
|
|
+ // console.log('getSettlement',err.data);
|
|
|
+ // })
|
|
|
},
|
|
|
delSelect(){
|
|
|
let that = this;
|
|
@@ -322,7 +350,19 @@
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ getAddrList(){
|
|
|
+ this.$u.api.addrList().then(res=>{
|
|
|
+ // this.dataList = res.data.rows;
|
|
|
+ if( res.data.total>0){
|
|
|
+ this.hasAddr = true;
|
|
|
+ }else{
|
|
|
+ this.hasAddr = false;
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('getAddrList',err.data);
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|