|
@@ -64,7 +64,7 @@ import asyncRequest from "@/apis/product/index";
|
|
|
export default {
|
|
|
mixins: [resToken],
|
|
|
computed: {
|
|
|
- ...mapGetters(["ad", "goodsNum"]),
|
|
|
+ ...mapGetters(["ad", "goodsNum", "goodsUnit"]),
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -94,8 +94,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async getaddress() {
|
|
|
- let res = await this.set_user_goodsNum(this.num || this.goodsNum);
|
|
|
- if (res && res.code === 0) {
|
|
|
+ let numRes = await this.set_user_goodsNum(this.num || this.goodsNum);
|
|
|
+ let unitRes = await this.set_user_goodsUnit(
|
|
|
+ this.radioV || this.goodsUnit
|
|
|
+ );
|
|
|
+ if (numRes && numRes.code === 0 && unitRes && unitRes.code === 0) {
|
|
|
window.vm.$router.push({
|
|
|
path: "/address",
|
|
|
query: {
|
|
@@ -144,8 +147,11 @@ export default {
|
|
|
unit: v1.name,
|
|
|
};
|
|
|
this.productList.push(item);
|
|
|
- this.changePitem(0);
|
|
|
});
|
|
|
+ let index = this.productList.findIndex(v1 => {
|
|
|
+ return v1.id == this.goodsUnit+"";
|
|
|
+ });
|
|
|
+ this.changePitem(index === -1 ? 0 : index);
|
|
|
}
|
|
|
},
|
|
|
async initData(id) {
|
|
@@ -155,7 +161,6 @@ export default {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
this.$store.dispatch("user/set_ad", {}).then((res) => {
|
|
|
- console.log(res);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -185,8 +190,7 @@ export default {
|
|
|
.then(async () => {
|
|
|
await this.placeHttpOrder();
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
+ .catch(() => {});
|
|
|
} else {
|
|
|
this.show_title("请选择收货地址!");
|
|
|
}
|
|
@@ -197,7 +201,7 @@ export default {
|
|
|
let model = {
|
|
|
addrid: this.ad.id,
|
|
|
num: this.num + "",
|
|
|
- unit_id:this.radioV
|
|
|
+ unit_id: this.radioV,
|
|
|
};
|
|
|
let res = await asyncRequest.add(model);
|
|
|
this.loading = false;
|
|
@@ -224,6 +228,13 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ async set_user_goodsUnit(unit) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$store.dispatch("user/set_goodsUnit", unit).then((res) => {
|
|
|
+ resolve(res);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -364,9 +375,9 @@ export default {
|
|
|
padding: 5px 0 0 16px;
|
|
|
}
|
|
|
button {
|
|
|
- background: #F4D022 ;
|
|
|
+ background: #f4d022;
|
|
|
color: #333;
|
|
|
- border: 1px solid #F4D022 ;
|
|
|
+ border: 1px solid #f4d022;
|
|
|
border-radius: 10px;
|
|
|
overflow: hidden;
|
|
|
margin: 0 16px 0 0;
|