Browse Source

【优化】 商品详情页没有规格时的处理

【新增】 确认下单页日期时间选择并修复checkbox报错的问题
master
邓平艺 4 years ago
parent
commit
60af351a79
  1. 24
      pages/goodsDetail/index.vue
  2. 39
      pages/order/confirm_order.vue

24
pages/goodsDetail/index.vue

@ -98,6 +98,8 @@
</view>
</view>
</view>
<block v-if="$isRight(goods_detail.spec)">
<!-- 景区类型弹窗 -->
<u-calendar v-model="show" mode="date" zIndex="100000" :monthPrice="goods_detail.spec[type_index].list"
:min-date='goods_detail.spec[type_index].date_start'
@ -146,6 +148,7 @@
</view>
</view>
</u-popup>
</block>
<!-- 餐厅类型 -->
<view v-if="goods_detail.product.extends && goods_detail.product && goods_detail.product.type == 3">
@ -183,7 +186,6 @@
</view>
</view>
</view>
<!-- 酒店类型 -->
<view v-if="goods_detail.product && goods_detail.product.extends && goods_detail.product.type == 1">
<view class="goods-detail" v-if="goods_detail.product.extends.field_1_name"
@ -210,6 +212,8 @@
</view>
</view>
</view>
<block v-if="$isRight(goods_detail.spec)">
<!-- 酒店类型弹窗 -->
<u-calendar v-model="hotel_show_range" mode="range" zIndex="100000" :monthPrice="goods_detail.spec[type_index].list"
:min-date='goods_detail.spec[type_index].date_start'
@ -266,6 +270,8 @@
</view>
</view>
</u-popup>
</block>
<!-- 旅游路线类型 -->
<view
v-if="goods_detail.product && goods_detail.product.type == 0 && goods_detail.product.extends.field_0_project">
@ -298,6 +304,8 @@
<!-- <zwyCalendar class="lf-m-t-20" type="sign" :startTime="'2021-10-01'" :endTime="'2021-11-01'"/> -->
</view>
</view>
<block v-if="$isRight(goods_detail.spec)">
<!-- 旅游路线类型弹窗 -->
<u-popup v-model="travel_route" mode="bottom" :closeable="true" border-radius="20">
<view class="lf-p-32">
@ -433,6 +441,8 @@
</view>
</view>
</u-popup>
</block>
<!-- 公共部分 -->
<!-- 商品详情 -->
<view class="goods-detail" v-if="goods_detail.know">
@ -558,6 +568,16 @@
if(this.goods_detail) {
this.getShopDistance();
}
if(!this.$isRight(this.goods_detail.spec)){
uni.showModal({
title: '',
content: '该商品暂无规格,无法购买',
showCancel: false,
success: result => {
this.$toBack();
}
})
}
this.is_collect = Boolean(res.data.is_collect) || false;
}).catch(err => {
this.skeletonLoading = false;
@ -576,7 +596,7 @@
const self_latitude = res.latitude
const self_longitude = res.longitude
console.log('当前经纬度',self_latitude,self_longitude,res);
if(that.$isRight(that.goods_detail.product.extends)) {
if(that.goods_detail.product && that.$isRight(that.goods_detail.product.extends)) {
const shop_latitude = that.goods_detail.product.extends.field_2_latitude;
const shop_longitude = that.goods_detail.product.extends.field_2_longitude;
console.log('商家经纬度',shop_latitude,shop_longitude);

39
pages/order/confirm_order.vue

@ -14,7 +14,6 @@
<u-icon name="phone"></u-icon>
</button>
</view> -->
<view class="padding-lr lf-m-b-40 lf-m-t-30" :class="item.type == 'text'?'lf-row-between':''" v-for="(item,index) of form_list" :key="index">
<text class="lf-color-555 lf-font-28" v-once>{{item.field}}</text>
<input type="text" v-if="item.type == 'text'" v-model="info[item.field]" @blur="computedAge()" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" :placeholder="`请输入`+item.field"/>
@ -42,6 +41,11 @@
</u-checkbox-group>
</view>
<view class="lf-m-t-20" v-if="item.type == 'datetime'" @click="showDateTime = true">
<text>{{ info[item.field] || '请选择日期' }}</text>
<u-picker mode="time" v-model="showDateTime" :params="dateTimeParams" @confirm="dateTimeConfirm($event, item.field)"></u-picker>
</view>
<view class="lf-m-t-20" v-if="item.type == 'textarea'">
<view class="cu-self menu" style="margin-top: 30rpx; position: relative;">
<textarea :cursor-spacing="120" maxlength="300" :adjust-position="true" type="text" v-model="info[item.field]" style="background-color: #F8F8F8;border-radius: 20rpx;" class="text-left lf-font-28 area-self lf-w-100 lf-p-20" placeholder="请输入内容" />
@ -61,9 +65,6 @@
</view>
</view>
</view>
</view>
<self-line/>
<view class="lf-bg-white lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32">
@ -235,7 +236,16 @@
image_name: '',
if_image_complatet: false,
check_box_name: '',
buy_num: 0
buy_num: 0,
showDateTime: false ,//
dateTimeParams: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: false
}
}
},
onLoad(e) {
@ -246,8 +256,18 @@
this.buy_num = e.buy_num;
console.log('出来的数量',this.buy_num)
this.order_id = e.order_id;
this.form_type = JSON.parse(decodeURIComponent(e.form_type));;
this.form_list = this.form_type.fields;
this.form_type = JSON.parse(decodeURIComponent(e.form_type));
// checkbox
let form_list = this.form_type.fields.map(item => {
if(item.type == 'checkbox'){
item.options = item.options.map(o => {
return {name: o, checked: false};
})
}
return item;
})
this.form_list = form_list;
console.log('表单格式',this.form_list)
var arr = e.spec_id.split(",")
console.log(arr)
@ -289,6 +309,11 @@
uni.$off('payState');
},
methods: {
//
dateTimeConfirm(event, info_key){
let { year, month, day, hour, minute } = event;
this.info[info_key] = `${year}-${month}-${day} ${hour}:${minute}`;
},
valChange(e) {
this.buy_num = e.value;
this.getGoodsData(this.pay_type);

Loading…
Cancel
Save