添加自定义表单多个选项时页面书写

main
jinna 2 years ago
parent 2b6e83bbba
commit 182b235069
  1. 166
      pages/pages_zhentou/form/form.vue
  2. 2
      pages/pages_zhentou/order/checkOrder.vue
  3. 8
      pages/pages_zhentou/order/order.vue

@ -8,6 +8,9 @@
<img class="top_img" :src="imgPrefix + 'top.png'" alt="">
</view>
<view class="top_content">
<view class="num_box" v-if="orderNum > 1">
表单{{currentNum}}
</view>
<view class="title">
枕头定制信息表
</view>
@ -111,6 +114,11 @@
</uni-forms-item>
</uni-forms>
<button class="btn_box" @click="submit('valiForm')">提交</button>
<view class="button_box">
<p class="button" @click="handlePrev" v-if="currentNum > 1">上一个</p>
<p class="button" @click="jumpOver">跳过</p>
<p class="button" @click="handleNext" v-if="currentNum < orderNum">下一个</p>
</view>
<!-- <uni-popup ref="popup" background-color="#fff" @change="change">
<picker :range="locationArr" @change="cityChange" mode="multiSelector" @columnchange="columnchange"
:value="multiIndex">
@ -334,6 +342,11 @@
value: 2
}, ],
isDisabled:false,
orderNo:'',
orderNum:'',
orderData:[],
currentNum:null,
pageFrom:''
}
},
onShow(){
@ -367,13 +380,106 @@
// console.log(this.a)
this.getData()
console.log(options)
if(options.pageFrom == 'order'){
this.phoneNumber = options.phone
this.getInfo()
}
this.orderNo = options.orderNo
this.orderNum = options.orderNum
this.pageFrom = options.pageFrom
// if(options.pageFrom == 'order'){
// this.phoneNumber = options.phone
// // this.getInfo()
// }
this.getOrderInfo()
// this.getCurrentArea('')
},
methods: {
//
getOrderInfo(type){
uni.request({
url:getApp().globalData.baseUrl + '/blade-desk/custom-made-info/list-by-order-no?orderNo=' + this.orderNo,
method:'GET',
header:{
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
},
success:(res) =>{
console.log(res)
this.orderData = res.data.data;
if(type == 'save'){
if(this.orderData.length == this.orderNum){
if(this.pageFrom == 'order'){
uni.navigateBack({
url:"/pages/pages_zhentou/order/order"
})
}else{
uni.redirectTo({
url:"/pages/pages_zhentou/order/order"
})
}
}else{
this.currentNum = this.orderData.length + 1;
}
}else{
if(this.orderData.length == this.orderNum){
this.currentNum = 1;
this.valiFormData = this.orderData[0]
this.valiFormData.neckShoulderWidth = this.valiFormData.neckShoulderWidth == -1 ? '' : this.valiFormData.neckShoulderWidth;
this.valiFormData.neckLength = this.valiFormData.neckLength == -1 ? '' : this.valiFormData.neckLength;
this.valiFormData.ageRange = this.valiFormData.ageRange == -1 ? '' : this.valiFormData.ageRange;
this.valiFormData.sleepLength = this.valiFormData.sleepLength == -1 ? '' : this.valiFormData.sleepLength;
this.valiFormData.cervicalVertebra = this.valiFormData.cervicalVertebra == -1 ? '' : this.valiFormData.cervicalVertebra;
this.valiFormData.otherNeed = this.valiFormData.otherNeed == -1 ? '' : this.valiFormData.otherNeed;
}else{
this.currentNum = this.orderData.length + 1;
}
}
}
})
},
handlePrev(){
// console.log(this.currentNum - 2)
this.currentNum = this.currentNum - 1;
this.valiFormData = this.orderData[this.currentNum - 1];
if(!this.valiFormData){
this.valiFormData = {}
}else{
this.valiFormData.neckShoulderWidth = this.valiFormData.neckShoulderWidth == -1 ? '' : this.valiFormData.neckShoulderWidth;
this.valiFormData.neckLength = this.valiFormData.neckLength == -1 ? '' : this.valiFormData.neckLength;
this.valiFormData.ageRange = this.valiFormData.ageRange == -1 ? '' : this.valiFormData.ageRange;
this.valiFormData.sleepLength = this.valiFormData.sleepLength == -1 ? '' : this.valiFormData.sleepLength;
this.valiFormData.cervicalVertebra = this.valiFormData.cervicalVertebra == -1 ? '' : this.valiFormData.cervicalVertebra;
this.valiFormData.otherNeed = this.valiFormData.otherNeed == -1 ? '' : this.valiFormData.otherNeed;
}
},
jumpOver(){
if(this.pageFrom == 'order'){
uni.navigateBack({
url:"/pages/pages_zhentou/order/order"
})
}else{
uni.redirectTo({
url:"/pages/pages_zhentou/order/order"
})
}
},
handleNext(){
console.log(this.currentNum)
this.currentNum = this.currentNum + 1
this.valiFormData = this.orderData[this.currentNum - 1];
if(!this.valiFormData){
console.log('123')
this.valiFormData = {}
}else{
console.log('456')
this.valiFormData.neckShoulderWidth = this.valiFormData.neckShoulderWidth == -1 ? '' : this.valiFormData.neckShoulderWidth;
this.valiFormData.neckLength = this.valiFormData.neckLength == -1 ? '' : this.valiFormData.neckLength;
this.valiFormData.ageRange = this.valiFormData.ageRange == -1 ? '' : this.valiFormData.ageRange;
this.valiFormData.sleepLength = this.valiFormData.sleepLength == -1 ? '' : this.valiFormData.sleepLength;
this.valiFormData.cervicalVertebra = this.valiFormData.cervicalVertebra == -1 ? '' : this.valiFormData.cervicalVertebra;
this.valiFormData.otherNeed = this.valiFormData.otherNeed == -1 ? '' : this.valiFormData.otherNeed;
}
},
//
getInfo(){
uni.request({
@ -504,7 +610,7 @@
},
submit(ref) {
this.$refs[ref].validate().then(res => {
// console.log(this.baseFormData);
console.log(this.valiFormData);
let params = {};
params = {
username: this.valiFormData.username,
@ -524,8 +630,11 @@
sleepLength: this.valiFormData.sleepLength,
cervicalVertebra: this.valiFormData.cervicalVertebra,
otherNeed: this.valiFormData.otherNeed,
}
orderNo:this.orderNo,
id:this.valiFormData.id ? this.valiFormData.id : ''
}
console.log(getApp().globalData.baseUrl)
uni.request({
url: getApp().globalData.baseUrl + '/blade-desk/custom-made-info/save',
data: params,
@ -541,7 +650,8 @@
this.multiIndex[0, 0, 0];
this.city = ''
this.province = '';
this.district = ''
this.district = '';
this.getOrderInfo('save')
} else {
uni.showToast({
title: '提交失败',
@ -553,21 +663,6 @@
reject(res)
}
})
// NET.request1(API.save, params, 'post').then(res => {
// console.log(res)
// if (res.code == 200) {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// this.valiFormData = {},
// this.multiIndex[0, 0, 0];
// this.city = ''
// this.province = '';
// this.district = ''
// }
// })
}).catch(err => {
console.log('err', err);
})
@ -773,6 +868,15 @@
.top_content {
padding: 30rpx;
.num_box{
font-family: inherit;
font-size: 40rpx;
font-weight: normal;
color: rgb(7, 0, 89);
text-align: left;
margin-bottom: 16rpx;
}
.title {
font-family: inherit;
font-size: 40rpx;
@ -815,6 +919,24 @@
margin-bottom: 64rpx;
}
.button_box{
width: 100%;
height: 60rpx;
display: flex;
align-self: center;
justify-content: space-between;
// padding: 0 60rpx;
.button{
width: 100rpx;
height: 60rpx;
background: red;
display: flex;
align-items: center;
justify-content: center;
// margin: 0 60rpx;
}
}
.uni-forms-item {
/* background-color: red; */

@ -247,7 +247,7 @@
// ,
handleInfo(){
uni.navigateTo({
url:"/pages/pages_zhentou/form/form?phone=" + this.orderData.buyerPhone + '&pageFrom=order'
url:"/pages/pages_zhentou/form/form?phone=" + this.orderData.buyerPhone + '&pageFrom=order' + '&orderNo='+ this.orderData.orderNo + '&orderNum=' + this.orderData.goodsNum
})
},
//

@ -52,7 +52,7 @@
<p class="btn confirm" v-if="item.status == 3" @click.stop="handleConfirm(item)">确认收货</p>
<p class="btn" v-if="item.status == 1" @click.stop="cancelOrder(item)">取消订单</p>
<p class="btn confirm" @click.stop="goPay(item)" v-if="item.status == 1">立即支付</p>
<p class="btn confirm info" v-if="item.status == 2">完善定制信息</p>
<p class="btn confirm info" v-if="item.status == 2" @click.stop="handleInfo(item)">完善定制信息</p>
<p class="btn" v-if="item.status == 0" @click.stop="handleDelete(item)">删除订单</p>
<p class="btn confirm" v-if="item.status == 0">再次定制</p>
</view>
@ -181,6 +181,12 @@
url: "/pages/pages_zhentou/order/express?logisticsNo=" + row.logisticsNo + '&company=' + row.logisticsCompany + '&companyCode=' +row.logisticsCompanyCode
})
},
// ,
handleInfo(item){
uni.navigateTo({
url:"/pages/pages_zhentou/form/form?phone=" + item.buyerPhone + '&pageFrom=order' + '&orderNo='+ item.orderNo + '&orderNum=' + item.goodsNum
})
},
//
cancelOrder(row){
uni.showModal({

Loading…
Cancel
Save