|
@@ -28,7 +28,7 @@
|
|
|
<view class="input">
|
|
|
手机号<input type='number' placeholder='请输入手机号码' placeholder-class='placeholder' v-model="delivery.mobile"></input>
|
|
|
</view>
|
|
|
- <textarea placeholder-style="color:#ccc;font-size:28rpx;" placeholder="示例: 浙江省 台州市 椒江区 市府大道12号" v-model="delivery.address" />
|
|
|
+ <textarea placeholder-style="color:#ccc;font-size:28rpx;" placeholder="示例: 浙江省 台州市 椒江区 市府大道12号" v-model="delivery.address" @blur="getExtraFreight"/>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="gift">
|
|
@@ -40,7 +40,7 @@
|
|
|
</view>
|
|
|
<radio-group @change="changeProduct" v-if="productList.length > 0">
|
|
|
<view class="product" v-for="(item , index) in productList" :key="index">
|
|
|
- <radio :value="index.toString()" />
|
|
|
+ <radio :value="index.toString()" :checked="index == current"/>
|
|
|
<image :src="item.img"></image>
|
|
|
<view class="info">
|
|
|
<view>{{item.title}}</view>
|
|
@@ -57,6 +57,7 @@
|
|
|
<view class="bottom">
|
|
|
<view>
|
|
|
<view>礼品金额:<text>¥{{price}}</text>,运费:<text>¥{{freight}}</text></view>
|
|
|
+ <view v-if="extraFreight">偏远地区加钱:<text>¥{{extraFreight}}</text></view>
|
|
|
<view class="total">总价:<text>¥{{total}}</text></view>
|
|
|
</view>
|
|
|
<button @click="submit">提交订单</button>
|
|
@@ -111,9 +112,11 @@
|
|
|
warehouse: [],
|
|
|
warehouseData: [],
|
|
|
warehouseId: '',
|
|
|
+ warehouseIndex: '',
|
|
|
expId: '',
|
|
|
productList: [],
|
|
|
productId: '',
|
|
|
+ current: -1,
|
|
|
delivery: {
|
|
|
out_order_id: '',
|
|
|
name: '',
|
|
@@ -123,6 +126,7 @@
|
|
|
},
|
|
|
price: 0,
|
|
|
freight: 0,
|
|
|
+ extraFreight: 0,
|
|
|
total: 0,
|
|
|
payData: {}
|
|
|
}
|
|
@@ -166,12 +170,14 @@
|
|
|
that.platformId = evt.target.value;
|
|
|
that.tabWarehouse(that.platformId);
|
|
|
that.warehouseId = that.warehouse[0].id;
|
|
|
+ that.warehouseIndex = 0;
|
|
|
if(that.warehouse[0].expCode.length > 0){
|
|
|
that.expId = that.warehouse[0].expCode[0].id;
|
|
|
that.freight = parseFloat(that.warehouse[0].expCode[0].money);
|
|
|
that.total = that.price + that.freight;
|
|
|
}
|
|
|
that.getProductList();
|
|
|
+ that.getExtraFreight();
|
|
|
},
|
|
|
//选择平台后切换仓库
|
|
|
tabWarehouse:function(id){
|
|
@@ -191,15 +197,18 @@
|
|
|
title: '请先选择数据来源平台'
|
|
|
});
|
|
|
that.warehouseId = that.warehouse[index].id;
|
|
|
+ that.warehouseIndex = index;
|
|
|
if(that.warehouse[index].expCode.length > 0){
|
|
|
that.expId = that.warehouse[index].expCode[0].id;
|
|
|
that.freight = parseFloat(that.warehouse[index].expCode[0].money);
|
|
|
- that.total = that.price + that.freight;
|
|
|
}else{
|
|
|
that.freight = 0;
|
|
|
- that.total = that.price + that.freight;
|
|
|
}
|
|
|
+ that.current = -1;
|
|
|
+ that.productId = '';
|
|
|
+ that.price = 0;
|
|
|
that.getProductList();
|
|
|
+ that.getExtraFreight();
|
|
|
},
|
|
|
changeProduct:function(evt) {
|
|
|
let that = this;
|
|
@@ -207,9 +216,24 @@
|
|
|
title: '请先选择数据来源平台'
|
|
|
});
|
|
|
let index = evt.target.value;
|
|
|
+ that.current = index;
|
|
|
that.productId = that.productList[index].id;
|
|
|
that.price = parseFloat(that.productList[index].price);
|
|
|
- that.total = that.price + that.freight;
|
|
|
+ that.total = (parseFloat(that.price) + parseFloat(that.freight) + parseFloat(that.extraFreight)).toFixed(2);
|
|
|
+ },
|
|
|
+ //偏远地区加钱
|
|
|
+ getExtraFreight:function () {
|
|
|
+ let that = this;
|
|
|
+ if(that.delivery.address.indexOf("北京") != -1){
|
|
|
+ that.extraFreight = parseFloat(that.warehouse[that.warehouseIndex].beijing);
|
|
|
+ }
|
|
|
+ if(that.delivery.address.indexOf("上海") != -1){
|
|
|
+ that.extraFreight = parseFloat(that.warehouse[that.warehouseIndex].shanghai);
|
|
|
+ }
|
|
|
+ if(that.delivery.address.indexOf("青海") != -1){
|
|
|
+ that.extraFreight = parseFloat(that.warehouse[that.warehouseIndex].qinghai);
|
|
|
+ }
|
|
|
+ that.total = (parseFloat(that.price) + parseFloat(that.freight) + parseFloat(that.extraFreight)).toFixed(2);
|
|
|
},
|
|
|
submit: function() {
|
|
|
let that = this;
|
|
@@ -228,18 +252,22 @@
|
|
|
if (!that.delivery.address) return that.$util.Tips({
|
|
|
title: '请输入收货地址'
|
|
|
});
|
|
|
+ if(that.delivery.address.indexOf("新疆") != -1 || that.delivery.address.indexOf("西藏") != -1) return that.$util.Tips({
|
|
|
+ title: '新疆西藏地区不发货'
|
|
|
+ });
|
|
|
if (!that.productId) return that.$util.Tips({
|
|
|
title: '请选择赠送礼品'
|
|
|
});
|
|
|
let orderAr = [];
|
|
|
orderAr.push(that.delivery);
|
|
|
- submitOrder({
|
|
|
+ submitOrder({
|
|
|
platformId: that.platformId,
|
|
|
warehouseId: that.warehouseId,
|
|
|
proId: that.productId,
|
|
|
expId: that.expId,
|
|
|
orderAr: orderAr,
|
|
|
- mono: ''
|
|
|
+ mono: '',
|
|
|
+ extraFreight: that.extraFreight
|
|
|
}).then(res => {
|
|
|
payOrder({'order_id':res.data.order_id}).then(res => {
|
|
|
that.payData = res.data;
|