|
@@ -87,15 +87,15 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="grace-wrap" style="margin-top: 20rpx;">
|
|
|
- <view class="grace-capsule margin" v-if="(item.goods.mode == 1 || item.goods.mode == 3) && mode == 1">
|
|
|
+ <view class="grace-capsule margin" v-if="(item.goods.mode == 1 || item.goods.mode == 3) && mode == 1" @click="openDialog">
|
|
|
<text class="grace-capsule-icon">地址</text>
|
|
|
- <text class="grace-capsule-text">河北省三河市燕郊开发区理想新城一期南区36号楼</text>
|
|
|
+ <text class="grace-capsule-text">{{fetch.area_name}}{{fetch.address}}</text>
|
|
|
</view>
|
|
|
<view class="grace-capsule margin" v-if="(item.goods.mode == 2 || item.goods.mode == 3) && mode == 2">
|
|
|
<text class="grace-capsule-icon grace-icon-br" style="background:#E76B61;">自提</text>
|
|
|
- <picker @change="selfChange" :value="self_index" :range="self_data">
|
|
|
+ <picker @change="storeChange" :value="store_index" :range="store_data">
|
|
|
<text class="picker grace-capsule-text grace-text-br" style="border-color:#E76B61; color:#E76B61;">
|
|
|
- {{self_data[self_index]}}
|
|
|
+ {{store_data[store_index]}}
|
|
|
</text>
|
|
|
</picker>
|
|
|
</view>
|
|
@@ -117,6 +117,42 @@
|
|
|
</view>
|
|
|
</form>
|
|
|
</graceBottomDialog>
|
|
|
+ <graceDialog ref="graceDialog" :isTitle="true" :isCloseBtn="false" :title="`收货地址`" v-on:closeDialog="closeDialog">
|
|
|
+ <view class="content2" slot="content">
|
|
|
+ <form class="grace-form grace-margin-top">
|
|
|
+ <view class="grace-form-item grace-border-b">
|
|
|
+ <text class="grace-form-label">您的姓名</text>
|
|
|
+ <view class="grace-form-body">
|
|
|
+ <input type="text" class="grace-form-input" name="name" v-model="fetch.address_contact" placeholder="请填写联系姓名"></input>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="grace-form-item grace-border-b">
|
|
|
+ <text class="grace-form-label">联系电话</text>
|
|
|
+ <view class="grace-form-body">
|
|
|
+ <input type="number" class="grace-form-input" name="mobile" v-model="fetch.address_mobile" placeholder="请填写联系电话"></input>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="grace-form-item grace-border-b">
|
|
|
+ <text class="grace-form-label">所在地区</text>
|
|
|
+ <view class="grace-form-body" @tap="openPicker">
|
|
|
+ <input type="text" class="grace-form-input" name="area" :value="fetch.area_name" disabled placeholder="请选择所在地区"></input>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="grace-form-item">
|
|
|
+ <text class="grace-form-label">详细地址</text>
|
|
|
+ <view class="grace-form-body">
|
|
|
+ <input type="text" class="grace-form-input" name="address" v-model="fetch.address" placeholder="请填写详细地址"></input>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </form>
|
|
|
+ </view>
|
|
|
+ <view slot="btns" class="grace-space-between">
|
|
|
+ <text class="grace-dialog-buttons" @tap="closeDialog">关闭</text>
|
|
|
+ <text class="grace-dialog-buttons grace-blue" @tap="setAddress">确认</text>
|
|
|
+ </view>
|
|
|
+ </graceDialog>
|
|
|
+
|
|
|
<y-Fab :bottom="20" :right="140" v-if="!attrIsShow" @click="buyNow" bgColor="#e55d52" text="购买"></y-Fab>
|
|
|
<y-Fab :bottom="20" :right="260" v-if="!attrIsShow" @click="showModal" bgColor="#0fa5e5" text="评价"></y-Fab>
|
|
|
<block v-if="index == -1">
|
|
@@ -125,7 +161,8 @@
|
|
|
<view v-if="showComment">
|
|
|
<dever-publish :title="title" :is_upload="true" @hideModal="hideModal" @getRefresh="getRefresh" :type="key" :type_id="item.goods.id" :api="api"></dever-publish>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ <graceAddressPicker v-if="address_default.length > 0" :value="address_default" :show="graceAddressPickerShow" @confirm="pickerConfirm" @close="closePicker" cancelTColor="关闭"></graceAddressPicker>
|
|
|
+ </view>
|
|
|
<!-- 底部 -->
|
|
|
|
|
|
</gracePage>
|
|
@@ -172,36 +209,75 @@ export default {
|
|
|
showComment : false,
|
|
|
fetch : {
|
|
|
info : [],
|
|
|
+ address : '',
|
|
|
+ area_name : '',
|
|
|
+ store : [],
|
|
|
},
|
|
|
- mode : 1,
|
|
|
- self_data : [],
|
|
|
- self_index : 0,
|
|
|
+ mode : -1,
|
|
|
+ store_data : [],
|
|
|
+ store_index : 0,
|
|
|
+ store_relation : [],
|
|
|
freight_price : 0,
|
|
|
+ old_freight_price : 0,
|
|
|
+ graceAddressPickerShow : false,
|
|
|
+ address_default : [],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.self_data[0] = '河北省三河市燕郊开发区理想新城一期南区';
|
|
|
- this.self_data[1] = '北京';
|
|
|
this.bottom[this.index] = this;
|
|
|
if (this.item.goods.freight) {
|
|
|
this.freight_price = this.item.goods.freight.price;
|
|
|
}
|
|
|
|
|
|
+ if (this.item.goods.mode == 1 || this.item.goods.mode == 3) {
|
|
|
+ this.mode = 1;
|
|
|
+ } else if (this.item.goods.mode == 2 || this.item.goods.mode == 3) {
|
|
|
+ this.mode = 2;
|
|
|
+ }
|
|
|
+
|
|
|
this.getInfo();
|
|
|
this.getData(1);
|
|
|
},
|
|
|
methods:{
|
|
|
+ openPicker : function() {
|
|
|
+ this.graceAddressPickerShow = true;
|
|
|
+ },
|
|
|
+ pickerConfirm : function(e){
|
|
|
+ console.info(e);
|
|
|
+ this.fetch.area_name = e.names[0] + ' ' + e.names[1] + ' ' + e.names[2];
|
|
|
+ this.fetch.area_id = e.codes[0] + ',' + e.codes[1] + ',' + e.codes[2];
|
|
|
+ this.closePicker();
|
|
|
+ },
|
|
|
+ closePicker : function () {
|
|
|
+ this.graceAddressPickerShow = false;
|
|
|
+ },
|
|
|
// 获取地理位置,运费等信息
|
|
|
getInfo : function() {
|
|
|
-
|
|
|
+ var self = this;
|
|
|
+ var data = {};
|
|
|
+ data.goods_id = this.item.goods.id;
|
|
|
+ data.noloading = 1;
|
|
|
+ this.Dever.get(this, 'app/user/?l=api.goods', data, function(t) {
|
|
|
+ self.address_default = self.fetch.area_id.split(',');
|
|
|
+ if (t && t.store) {
|
|
|
+ var j = 0;
|
|
|
+ for (var i in t.store) {
|
|
|
+ self.store_data[j] = t.store[i].name;
|
|
|
+ self.store_relation[j] = i;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*
|
|
|
this.Dever.getLocation('wgs84', '', function(t) {
|
|
|
if (t && t.longitude && t.longitude) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
+ */
|
|
|
},
|
|
|
getData : function(page) {
|
|
|
if (this.active == 0) {
|
|
@@ -216,23 +292,23 @@ export default {
|
|
|
this.getData(1);
|
|
|
}
|
|
|
},
|
|
|
- selfChange : function(e) {
|
|
|
- this.self_index = e.detail.value;
|
|
|
+ storeChange : function(e) {
|
|
|
+ this.store_index = e.detail.value;
|
|
|
},
|
|
|
//打开属性视图
|
|
|
buyNow : function() {
|
|
|
- if (this.item.goods.type == 1) {
|
|
|
+ if (this.item.goods.platform == 1) {
|
|
|
this.attrIsShow = true;
|
|
|
} else {
|
|
|
//this.Dever.alert('加入到口袋里');
|
|
|
- var name = this.item.goods.type_name;
|
|
|
+ var name = this.item.goods.platform_name;
|
|
|
uni.showModal({
|
|
|
content: '该商品是'+name+'平台商品,是否立刻去购买?',
|
|
|
cancelText: '取消',
|
|
|
confirmText: '去购买',
|
|
|
success: res => {
|
|
|
if (res.confirm) {
|
|
|
- if (this.item.goods.type == 2 || this.item.goods.type == 4) {
|
|
|
+ if (this.item.goods.platform == 2 || this.item.goods.platform == 4) {
|
|
|
this.copy(this.item.goods.code);
|
|
|
this.Dever.alert('已复制,请打开' + name + 'APP即可购买该商品');
|
|
|
} else {
|
|
@@ -279,7 +355,15 @@ export default {
|
|
|
data.num = this.buyNum;
|
|
|
data.sku = this.skuId;
|
|
|
data.code = this.Dever.config.code;
|
|
|
+ data.mode = this.mode;
|
|
|
+
|
|
|
+ if (this.mode == 2) {
|
|
|
+ var store = this.fetch.store[this.store_relation[this.store_index]].id;
|
|
|
+ data.store_id = store;
|
|
|
+ }
|
|
|
+
|
|
|
console.log(data);
|
|
|
+ return;
|
|
|
//如果想关闭属性
|
|
|
//this.closeAttr();
|
|
|
this.Dever.post('app/user/?l=pay.product', data, function(t) {
|
|
@@ -305,17 +389,24 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (this.item.goods.freight) {
|
|
|
+ var freight_price = 0;
|
|
|
this.item.goods.freight.first_num = parseInt(this.item.goods.freight.first_num);
|
|
|
var price = parseFloat(this.item.goods.freight.first_price);
|
|
|
- if (this.kuNum > this.item.goods.freight.first_num) {
|
|
|
- var num = this.kuNum - this.item.goods.freight.first_num;
|
|
|
+ if (this.buyNum > this.item.goods.freight.first_num) {
|
|
|
+ var num = this.buyNum - this.item.goods.freight.first_num;
|
|
|
price = parseFloat(price + (this.item.goods.freight.next_price*num));
|
|
|
}
|
|
|
|
|
|
if (this.item.goods.freight.type == 2) {
|
|
|
- this.freight_price = this.payPrice*(price/100);
|
|
|
+ freight_price = this.payPrice*(price/100);
|
|
|
} else {
|
|
|
- this.freight_price = price;
|
|
|
+ freight_price = price;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.mode == 2) {
|
|
|
+ this.old_freight_price = freight_price;
|
|
|
+ } else {
|
|
|
+ this.freight_price = freight_price;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -335,10 +426,30 @@ export default {
|
|
|
this.mode = e.detail.value;
|
|
|
if (this.mode == 2) {
|
|
|
//获取当前位置的自提点
|
|
|
+ this.old_freight_price = this.freight_price;
|
|
|
this.freight_price = 0;
|
|
|
} else {
|
|
|
- this.freight_price = this.item.goods.freight.price;
|
|
|
+ this.freight_price = this.old_freight_price;
|
|
|
}
|
|
|
+ },
|
|
|
+ openDialog : function() {
|
|
|
+ this.$refs.graceDialog.open();
|
|
|
+ },
|
|
|
+
|
|
|
+ closeDialog : function() {
|
|
|
+ this.$refs.graceDialog.hide();
|
|
|
+ },
|
|
|
+
|
|
|
+ setAddress : function() {
|
|
|
+ var data = {};
|
|
|
+ data.code = this.Dever.config.code;
|
|
|
+ data.address_contact = this.fetch.address_contact;
|
|
|
+ data.address_mobile = this.fetch.address_mobile;
|
|
|
+ data.address = this.fetch.address;
|
|
|
+ data.area_id = this.fetch.area_id;
|
|
|
+ data.noloading = 1;
|
|
|
+ this.closeDialog();
|
|
|
+ this.Dever.post('app/user/?l=api.saveAddress', data);
|
|
|
}
|
|
|
},
|
|
|
components:{deverContent, deverPublish, copyText}
|
|
@@ -384,4 +495,9 @@ export default {
|
|
|
.margin{margin:10rpx 10rpx 0 0;}
|
|
|
.grace-border-b{border-color:#F8F8F8;}
|
|
|
.grace-check-item-v{width:100%; padding:15rpx 15rpx;}
|
|
|
+.content1{padding:25rpx; font-size:26rpx; text-align:center; line-height:60rpx;background-color:#F8F8F8; display:block;}
|
|
|
+.content2{padding-left:30rpx; padding-right:80rpx; line-height:50rpx; font-size:26rpx;}
|
|
|
+/* 图片形式 */
|
|
|
+.demo-img{width:580rpx; height:850rpx;}
|
|
|
+.grace-dialog-buttons{width:700rpx; line-height:88rpx; height:88rpx; display:block; overflow:hidden; text-align:center; font-size:26rpx; color:#999999;}
|
|
|
</style>
|