|
|
@@ -1,7 +1,29 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
+ <template v-if="Data.is_sell != 1">
|
|
|
+ <div class="qtmd mar_b20" v-if="goodsInfo.shipping_method == 2">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb">
|
|
|
+ <view class="list_name">发货方式</view>
|
|
|
+ <view class="list_con flex_r flex_jb">
|
|
|
+ <div class="select_tab" @click="onprom(0)" :class="{st_active:prom_type===0}">快递邮寄</div>
|
|
|
+ <div class="select_tab" @click="onprom(1)" :class="{st_active:prom_type===1}">到店自提</div>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </div>
|
|
|
+ <div class="qtmd mar_b20" v-else>
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb">
|
|
|
+ <view class="list_name">发货方式</view>
|
|
|
+ <view class="list_con flex_r flex_jb">
|
|
|
+ <div class="list_con" v-if="prom_type==0">快递邮寄</div>
|
|
|
+ <div class="list_con" v-else>到店自提</div>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<!-- 收货地址 -->
|
|
|
- <view class="address" v-if="Data.is_sell != 1 && Data.prom_type == 0">
|
|
|
+ <view class="address mar_b20" v-if="Data.is_sell != 1 && prom_type != 1">
|
|
|
<block v-if="DefaultAddress.name" >
|
|
|
<view class="add_head flex_r flex_ac flex_jb">
|
|
|
<view class="user_info flex_r flex_ac">
|
|
|
@@ -17,7 +39,7 @@
|
|
|
<view class="set_text">修改</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="add_name mar_t20">{{ DefaultAddress.address }}</view>
|
|
|
+ <view class="add_name mar_t20">{{ DefaultAddress.province + ' ' + DefaultAddress.city + ' ' + DefaultAddress.area + ' ' + DefaultAddress.street + ' ' + DefaultAddress.address }}</view>
|
|
|
</block>
|
|
|
<block v-else>
|
|
|
<view class="add_address flex_c flex_ac flex_jc" @tap="chooseWXaddress('add')">
|
|
|
@@ -27,8 +49,9 @@
|
|
|
</block>
|
|
|
</view>
|
|
|
<!-- 收货地址-end -->
|
|
|
+
|
|
|
<!-- 商品信息 -->
|
|
|
- <view class="goods_info mar_t20">
|
|
|
+ <view class="goods_info mar_b20">
|
|
|
<view class="info_type">{{ modularName }}</view>
|
|
|
<view class="goods flex_r">
|
|
|
<image class="goods_img" :src="goodsInfo.original_img" mode=""></image>
|
|
|
@@ -46,12 +69,12 @@
|
|
|
</view>
|
|
|
<!-- 商品信息-end -->
|
|
|
<!-- 订单信息 -->
|
|
|
- <view class="order mar_t20">
|
|
|
+ <view class="order">
|
|
|
<view class="order_list flex_r flex_ac flex_jb">
|
|
|
<view class="list_name">数量</view>
|
|
|
<view class="list_con">{{ Data.num }}</view>
|
|
|
</view>
|
|
|
- <view class="order_list flex_r flex_ac flex_jb" v-if="Data.is_sell != 1 && Data.prom_type == 0">
|
|
|
+ <view class="order_list flex_r flex_ac flex_jb" v-if="Data.is_sell != 1 && prom_type != 1">
|
|
|
<view class="flex_r flex_ac">
|
|
|
<view class="list_name">运费</view>
|
|
|
<view class="list_con p_color">({{ freight }}元/每套)</view>
|
|
|
@@ -136,6 +159,8 @@ export default {
|
|
|
freight: 0, //运费
|
|
|
userinfo: {},
|
|
|
obligation: 0, //待支付
|
|
|
+
|
|
|
+ prom_type: 0,
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
@@ -143,9 +168,11 @@ export default {
|
|
|
},
|
|
|
onLoad(e) {
|
|
|
this.Data = e;
|
|
|
- this.loadData(e);
|
|
|
+ this.getuserInfo();
|
|
|
this.loadAddress();
|
|
|
- this.userinfo = uni.getStorageSync("userinfo");
|
|
|
+ this.loadData(e);
|
|
|
+ // this.userinfo = uni.getStorageSync("userinfo");
|
|
|
+
|
|
|
// 1零售 2批发 3精品 4今日值买
|
|
|
this.modularName = this.tidyTpye(e.type);
|
|
|
},
|
|
|
@@ -153,19 +180,27 @@ export default {
|
|
|
// this.$refs.popup.open('top');
|
|
|
},
|
|
|
methods: {
|
|
|
+ onprom(va){
|
|
|
+ this.prom_type = va
|
|
|
+ this.loadData(this.Data);
|
|
|
+ },
|
|
|
loadData(da) {
|
|
|
post("goods/goodsDetail", da).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
this.goodsInfo = res.data.data;
|
|
|
- post("goods/freight", { type: da.type }).then((res) => {
|
|
|
+ if(this.goodsInfo.shipping_method != 2) this.prom_type = this.goodsInfo.shipping_method
|
|
|
+ post("goods/freight", { type: da.type, id: da.id }).then((res) => {
|
|
|
if (res.code === 0) this.freight = res.data.freight;
|
|
|
|
|
|
// 计算待支付
|
|
|
let p = this.Data.type == 2 ? this.goodsInfo.trade_price : this.goodsInfo.cost_price; //商品单价
|
|
|
- let y = (this.Data.is_sell == 1 || this.Data.prom_type == 1) ? 0 : this.freight; // 运费 寄卖的话退运费为0
|
|
|
- let a = this.$h.Mul(p,this.Data.num) + this.$h.Mul(y,this.Data.num); //商品总价
|
|
|
+ let y = (this.Data.is_sell == 1 || this.prom_type == 1) ? 0 : this.freight; // 运费 寄卖、自提 运费为0
|
|
|
+ let a1 = this.$h.Mul(p,this.Data.num); //商品总价
|
|
|
+ let a = this.$h.Add(this.$h.Mul(p,this.Data.num), this.$h.Mul(y,this.Data.num)); //商品总价加运费
|
|
|
+ let b1 = this.$h.Sub(a1,this.userinfo.user_money); //待支付金额 零售&批发 运费必须现金支付
|
|
|
let b = this.$h.Sub(a,this.userinfo.user_money); //待支付金额
|
|
|
if (["4", "5", "6"].includes(this.Data.type)) this.obligation = a;
|
|
|
+ else if (["1", "2"].includes(this.Data.type)) this.obligation = b1 > 0 ? this.$h.Add(b1, y) : y;
|
|
|
else this.obligation = b > 0 ? b : 0;
|
|
|
});
|
|
|
}
|
|
|
@@ -220,12 +255,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
chooseWXaddress(va) {
|
|
|
- // this.getwexinAddress()
|
|
|
let a = va != "add" ? this.DefaultAddress.id : "add";
|
|
|
this.$refs.userAddress.open(a);
|
|
|
-
|
|
|
- // this.goto("/pages/xghc-addrress/userAddress");
|
|
|
},
|
|
|
+
|
|
|
// 支付
|
|
|
payment() {
|
|
|
let type = "H5";
|
|
|
@@ -258,6 +291,7 @@ export default {
|
|
|
address_id: that.DefaultAddress.id || '',
|
|
|
regional_code: that.DefaultAddress.regional_code || '',
|
|
|
trade_type: type,
|
|
|
+ prom_type: that.prom_type,
|
|
|
price: that.goodsInfo.cost_price,
|
|
|
}).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
@@ -301,6 +335,7 @@ export default {
|
|
|
address_id: that.DefaultAddress.id || '',
|
|
|
regional_code: that.DefaultAddress.regional_code || '',
|
|
|
trade_type: type,
|
|
|
+ prom_type: that.prom_type,
|
|
|
price: that.goodsInfo.cost_price,
|
|
|
}).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
@@ -341,6 +376,15 @@ export default {
|
|
|
loadDa(da) {
|
|
|
this.DefaultAddress = da;
|
|
|
},
|
|
|
+
|
|
|
+ // 获取userinfo
|
|
|
+ async getuserInfo() {
|
|
|
+ let res = await post("/user/userinfo")
|
|
|
+ if (res.code === 0) {
|
|
|
+ uni.setStorageSync("userinfo", res.data.data);
|
|
|
+ this.userinfo = res.data.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -393,8 +437,8 @@ page {
|
|
|
}
|
|
|
|
|
|
.add_name {
|
|
|
- width: 448rpx;
|
|
|
- overflow: hidden;
|
|
|
+ // width: 448rpx;
|
|
|
+ // overflow: hidden;
|
|
|
font-size: 24rpx;
|
|
|
color: #868686;
|
|
|
}
|
|
|
@@ -575,4 +619,34 @@ page {
|
|
|
}
|
|
|
|
|
|
// 底部操作栏-end
|
|
|
+
|
|
|
+.qtmd{
|
|
|
+ width: 100%;
|
|
|
+ padding: 28rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ .select_tab{
|
|
|
+ margin-left: 30rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ &:first-child{
|
|
|
+ margin-left: 0;
|
|
|
+ }
|
|
|
+ &::before{
|
|
|
+ content: "";
|
|
|
+ display: inline-block;
|
|
|
+ width: 32rpx;
|
|
|
+ height: 32rpx;
|
|
|
+ background-image: url("~@/static/img/weixuanzhong_icon.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 6rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .st_active{
|
|
|
+ &::before{
|
|
|
+ background-image: url("~@/static/img/xuanzhong_icon.png");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|