You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1019 lines
38 KiB
1019 lines
38 KiB
<template>
|
|
<view class="formItem" v-if="logocome && formData">
|
|
<view v-for="(item, key, index) in formData" class="dis-flex" style="line-height: 100upx;" :key="key">
|
|
<!-- v-if="
|
|
item.id == 'text' ||
|
|
item.id == 'textarea' ||
|
|
item.id == 'select' ||
|
|
item.id == 'checkbox' ||
|
|
item.id == 'time' ||
|
|
item.id == 'datetime' ||
|
|
item.id == 'city'
|
|
" -->
|
|
<span :class="item.id == 'datetime'?'m-t':''" style="display: inline-block;width: 200upx;text-align: right;margin-right: 20upx;">
|
|
{{ item.data.title }}
|
|
<text class="c-ff4444 f-28 p-l-20" style="padding-left: 10upx;line-height: 10upx;">{{item.data.is_required == 1?'*':' '}}</text>
|
|
</span>
|
|
<!-- 文本 -->
|
|
<input
|
|
:placeholder="`${item.data.placeholder}`"
|
|
:maxlength="item.data.length != '' ? Number(item.data.length) : 9999"
|
|
v-model="createOrderInfo[key].data"
|
|
v-if="item.id == 'text'"
|
|
:adjust-position="false"
|
|
style="position: relative;height: 100upx;line-height: 100upx;margin-left: 0;"
|
|
class="flex-box"
|
|
/>
|
|
<!-- 文本域 -->
|
|
<textarea
|
|
:placeholder="`${item.data.placeholder}`"
|
|
:maxlength="item.data.length != '' ? Number(item.data.length) : 9999"
|
|
class="f-26 flex-box"
|
|
v-model="createOrderInfo[key].data"
|
|
placeholder-style="font-size: 26upx"
|
|
:style="{ height: item.data.height + 'rpx',marginTop:'32rpx'}"
|
|
v-if="item.id == 'textarea'"
|
|
:adjust-position="false"
|
|
/>
|
|
<!-- <picker v-if="item.id=='select'" mode="selector" class="dataPicker" :range="item.data.options"
|
|
:value="createOrderInfo['aa']" v-model="createOrderInfo['aa']">
|
|
<view class="uni-input" style="font-size: 20upx;">{{ createOrderInfo['aa'] || item.data.options[0]}}</view>
|
|
</picker> -->
|
|
<!-- 单项选择器 -->
|
|
<lb-picker class="flex-box" v-if="item.id == 'select' && item.data.options" @confirm="confirm($event,'select' + key)" :list="item.data.options" v-model="createOrderInfo['select' + key]" mode="selector">
|
|
<button class="t-r" style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 100upx;width: 100%;">
|
|
{{ createOrderInfo['select' + key] || item.data.options[0] }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 多选框 -->
|
|
<view class="dis-flex t-r" style="flex-wrap: wrap;width: 100%;align-content: flex-end;flex: 1;margin-top: 26upx;" v-if="item.id == 'checkbox' && createOrderInfo[key + 'multiple']">
|
|
<view
|
|
:class="items.check ? 'dynamiccheck' : 'dynamicnocheck'"
|
|
v-for="(items, indexs) in createOrderInfo[key + 'multiple']"
|
|
:key="indexs"
|
|
@click="dycheck(key, item, indexs, index, items.check)"
|
|
>
|
|
{{ items.name }}
|
|
</view>
|
|
</view>
|
|
<!-- 时间 -->
|
|
<view class="flex-box" style='pointer-events:auto;' v-if="item.id == 'time'">
|
|
<ruiDatePicker
|
|
fields="minute"
|
|
start="1970-00-00 00:00"
|
|
end="2100-12-30 23:59"
|
|
:value="item.data.value || item.data.datetime_local"
|
|
@change="bindChange($event,key,1)"
|
|
:iftime="item.id == 'time'"
|
|
></ruiDatePicker>
|
|
|
|
<!-- </view> -->
|
|
</view>
|
|
<!-- 时间段 -->
|
|
<view style="flex: 1;line-height: 50upx;" v-if="item.id == 'datetime'">
|
|
<view >
|
|
<ruiDatePicker
|
|
fields="minute"
|
|
start="1970-00-00 00:00"
|
|
end="2100-12-30 23:59"
|
|
:value="item.data.value?item.data.value[0]:item.data.start_time"
|
|
@change="bindChange($event,key,2)"
|
|
></ruiDatePicker>
|
|
</view>
|
|
<view style="padding: 0 20upx;font-size: 30upx;line-height: 30upx;font-size: 20upx;padding-left: 100upx;">
|
|
至
|
|
</view>
|
|
<view >
|
|
<ruiDatePicker
|
|
fields="minute"
|
|
start="1970-00-00 00:00"
|
|
end="2100-12-30 23:59"
|
|
:value="item.data.value?item.data.value[1]: item.data.end_time"
|
|
@change="bindChange($event,key,3)"
|
|
></ruiDatePicker>
|
|
</view>
|
|
<!-- <text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;height: 0;position: relative;bottom: 96upx;"></text> -->
|
|
</view>
|
|
<!-- 城市 -->
|
|
<view class="flex-box" style="margin-top: 20upx;" v-if="item.id == 'city'">
|
|
<!-- 区 -->
|
|
<lb-picker
|
|
v-if="item.data.area == 'true' && item.data.city == 'false' && item.data.province == 'false'"
|
|
:list="area"
|
|
v-model="createOrderInfo['area' + key]"
|
|
mode="selector"
|
|
@confirm="confirm($event,'area' + key)"
|
|
>
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 62upx;">
|
|
{{ createOrderInfo['area' + key] || area[0] }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 市 -->
|
|
<lb-picker
|
|
v-else-if="item.data.area == 'false' && item.data.city == 'true' && item.data.province == 'false'"
|
|
:list="city"
|
|
v-model="createOrderInfo['city' + key]"
|
|
mode="selector"
|
|
@confirm="confirm($event,'area' + key)"
|
|
>
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;">
|
|
{{ createOrderInfo['city' + key] || city[0] }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;line-height: 62upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 省 -->
|
|
<lb-picker
|
|
v-else-if="item.data.area == 'false' && item.data.city == 'false' && item.data.province == 'true'"
|
|
:list="province"
|
|
v-model="createOrderInfo['province' + key]"
|
|
mode="selector"
|
|
@confirm="confirm($event,'province' + key)"
|
|
>
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 62upx;">
|
|
{{ createOrderInfo['province' + key] || province[0] }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 省市 -->
|
|
<lb-picker
|
|
v-else-if="item.data.area == 'false' && item.data.city == 'true' && item.data.province == 'true'"
|
|
:level="2"
|
|
:list="provincecity"
|
|
@confirm="confirm($event,'provincecity' + key)"
|
|
v-model="createOrderInfo['provincecity' + key]"
|
|
mode="multiSelector"
|
|
>
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 62upx;">
|
|
{{ createOrderInfo['provincecity' + key].length > 0?`${createOrderInfo['provincecity' + key][0]}-${createOrderInfo['provincecity' + key][1]}`:`${provincecity[0].label}-${provincecity[0].children[0].label}` }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 市区 -->
|
|
<lb-picker
|
|
v-else-if="item.data.area == 'true' && item.data.city == 'true' && item.data.province == 'false'"
|
|
:list="cityarea"
|
|
v-model="createOrderInfo['cityarea' + key]"
|
|
mode="multiSelector"
|
|
@confirm="confirm($event,'cityarea' + key)"
|
|
:level="2"
|
|
>
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 62upx;">
|
|
{{ createOrderInfo['cityarea' + key].length > 0?`${createOrderInfo['cityarea' + key][0]}-${createOrderInfo['cityarea' + key][1]}`:`${cityarea[0].label}-${cityarea[0].children[0].label}` }}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- 省市区 -->
|
|
<lb-picker
|
|
v-else-if="item.data.area == 'true' && item.data.city == 'true' && item.data.province == 'true'"
|
|
:list="provincecityarea"
|
|
:level="3"
|
|
@confirm="confirm($event,'provincecityarea' + key)"
|
|
v-model="createOrderInfo['provincecityarea' + key]"
|
|
mode="multiSelector">
|
|
<button style="background-color: #fafafa;font-size: 26upx;text-align: left;padding: 0;line-height: 62upx;">
|
|
{{
|
|
createOrderInfo['provincecityarea' + key].length > 0
|
|
?`${createOrderInfo['provincecityarea' + key][0]}-${createOrderInfo['provincecityarea' + key][1]}-${createOrderInfo['provincecityarea' + key][2]}`
|
|
:item.data.value?`${item.data.value[0]}-${item.data.value[1]}-${item.data.value[1]}`:`${provincecityarea[0].label}-${provincecityarea[0].children[0].label}-${provincecityarea[0].children[0].children[0].label}`
|
|
}}
|
|
<text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;margin-right: 20upx;"></text>
|
|
</button>
|
|
</lb-picker>
|
|
<!-- <text class="iconfont icon-right col-9" style="float: right;font-size: 26upx;height: 0;position: relative;bottom: 80upx;"></text> -->
|
|
</view>
|
|
<view v-if="item.id == 'img' && item.data.number == 1">
|
|
<!-- 图片预览循环模板 -->
|
|
<view class="imgPreview" style="position: relative;" v-if="createOrderInfo[key].data && createOrderInfo[key].data.length > 0">
|
|
<image :src="createOrderInfo[key].data" />
|
|
<image
|
|
:src="imgfixUrls + 'merchant/close.png'"
|
|
style="width: 40upx;height: 40upx;position: absolute;right: 20upx;top: 20upx;"
|
|
class="close"
|
|
@click="closeLogo(key)"
|
|
/>
|
|
</view>
|
|
<!-- 图片预览循环模板 -->
|
|
<view class="userImgUpdata" @click="uploadFiles(1,key)" v-else>
|
|
<image style="width: 420upx;height:330upx;margin-top: 40upx;" :src="imgfixUrls + 'tpsz.png'" />
|
|
</view>
|
|
</view>
|
|
<view v-if="item.id == 'img' && item.data.number > 1" style="display: flex;justify-content: flex-start;flex-direction: row;align-items: center;text-align: left;flex-wrap: wrap;flex: 1;margin-top: 20upx;">
|
|
<!-- 图片预览循环模板 -->
|
|
<view
|
|
class="imgPreview"
|
|
v-for="(items, indexs) in createOrderInfo['img' + key]"
|
|
style="flex:30%;max-width: 28%;position: relative;margin-right: 20upx;height: 150upx;"
|
|
:key="indexs"
|
|
>
|
|
<image :src="items" style="width: 130upx;height: 130upx;" />
|
|
<image
|
|
:src="imgfixUrls + 'merchant/close.png'"
|
|
style="width: 30upx;height: 30upx;position: absolute;right: -6upx;top: 0;"
|
|
class="close"
|
|
@click="closePreview(items, key)"
|
|
/>
|
|
</view>
|
|
|
|
<!-- <view class="imgPreview" v-for="(items, indexs) in type2Url" style="flex:31%;max-width: 25%;" :key="indexs" v-else>
|
|
<image :src="items" />
|
|
<image :src="imgfixUrls + 'merchant/close.png'" class="close" @click="closePreview(items,index)" />
|
|
</view> -->
|
|
<!-- 图片预览循环模板 -->
|
|
<view
|
|
class="userImgUpdata"
|
|
@click="uploadFiles(2, key,Number(item.data.number))"
|
|
style="flex:30%;max-width: 29%;width: 130upx;height: 130upx;border: 1upx solid #CCCCCC;border-radius: 10upx;position: relative;margin-right: 20upx;margin-bottom: 20upx;"
|
|
v-if="createOrderInfo['img' + key] ? createOrderInfo['img' + key].length !== Number(item.data.number) : true"
|
|
>
|
|
<image style="width: 40upx;height: 40upx;margin: auto;padding: 40upx;" :src="imgfixUrls + 'merchant/addImg.svg'" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import App from '@/common/js/app.js';
|
|
// #ifdef H5
|
|
import wxApi from '@/common/js/wxApi.js';
|
|
// #endif
|
|
import LbPicker from '@/components/lb-picker';
|
|
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
|
export default{
|
|
data(){
|
|
return{
|
|
createOrderInfo:{},
|
|
province: [],
|
|
city: [],
|
|
area: [],
|
|
provincecity: [],
|
|
cityarea: [],
|
|
provincecityarea: [],
|
|
logocome:true,
|
|
formList:{},
|
|
ifrequired:true,
|
|
type1Url: '',
|
|
type1Urlon: '',
|
|
type2Url: [],
|
|
type2Urlon: [],
|
|
localIds: '',
|
|
uploadlength: 0,
|
|
inputs:{
|
|
|
|
},
|
|
imgs:{},
|
|
formData:null
|
|
}
|
|
},
|
|
props: {
|
|
orderSubmitInfo:{
|
|
type: Object,
|
|
default: {}
|
|
},
|
|
gopay:{
|
|
type: Boolean,
|
|
default :false
|
|
},
|
|
gopaytwo:{
|
|
type: Boolean,
|
|
default :false
|
|
}
|
|
},
|
|
components:{
|
|
LbPicker,
|
|
ruiDatePicker
|
|
},
|
|
methods:{
|
|
datasValue(){
|
|
let _this = this;
|
|
let count = 0;
|
|
console.log(_this.orderSubmitInfo,'初始化数据')
|
|
//
|
|
if (_this.orderSubmitInfo.diyform) {
|
|
for (let key in _this.orderSubmitInfo.diyform.list) {
|
|
//
|
|
if (_this.orderSubmitInfo.diyform.list[key].id == 'img' && Number(_this.orderSubmitInfo.diyform.list[key].data.number) > 1) {
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: [],
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
|
|
if(_this.createOrderInfo['img' + key]){
|
|
_this.createOrderInfo['img' + key] = _this.createOrderInfo['img' + key];
|
|
}else{
|
|
_this.createOrderInfo['img' + key] = [];
|
|
}
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo['img' + key] = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
}
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].id == 'checkbox') {
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: [],
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
|
|
_this.createOrderInfo[key + 'multiple'] = [];
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.options){
|
|
_this.orderSubmitInfo.diyform.list[key].data.options.map(item => {
|
|
let obj = {
|
|
name: item,
|
|
check: false
|
|
};
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
_this.orderSubmitInfo.diyform.list[key].data.value.map(items=>{
|
|
if(items == item){
|
|
obj = {
|
|
name: item,
|
|
check: true
|
|
};
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
// obj.name = item;
|
|
// obj.check = false;
|
|
_this.createOrderInfo[key + 'multiple'].push(obj);
|
|
console.log(_this.createOrderInfo[key + 'multiple']);
|
|
//
|
|
//
|
|
});
|
|
}
|
|
|
|
console.log(_this.createOrderInfo[key + 'multiple'],999999999999999999999999);
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].id == 'time') {
|
|
_this.createOrderInfo['show' + key] = false;
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: _this.addtime(_this.orderSubmitInfo.diyform.list[key].data.time_stamp),
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
_this.orderSubmitInfo.diyform.list[key].data.datetime_local= _this.orderSubmitInfo.diyform.list[key].data.datetime_local.replace(/T/g," ");
|
|
console.log(_this.createOrderInfo[key].data,_this.orderSubmitInfo.diyform.list[key].data.datetime_local);
|
|
_this.orderSubmitInfo.diyform.list[key].data.datetime_local = _this.orderSubmitInfo.diyform.list[key].data.datetime_local.substring(0,_this.orderSubmitInfo.diyform.list[key].data.datetime_local.length-3);
|
|
//
|
|
console.log(_this.createOrderInfo[key].data,_this.orderSubmitInfo.diyform.list[key].data.datetime_local);
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
}
|
|
//
|
|
} else if (
|
|
_this.orderSubmitInfo.diyform.list[key].id == 'text' ||
|
|
_this.orderSubmitInfo.diyform.list[key].id == 'textarea' ||
|
|
_this.orderSubmitInfo.diyform.list[key].id == 'select' ||
|
|
(_this.orderSubmitInfo.diyform.list[key].id == 'img' && Number(_this.orderSubmitInfo.diyform.list[key].data.number) == 1)
|
|
) {
|
|
// 文本处理
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: '',
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
if(_this.orderSubmitInfo.diyform.list[key].id == 'img'){
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value[0];
|
|
console.log(_this.createOrderInfo[key].data,_this.orderSubmitInfo.diyform.list[key].data.value[0])
|
|
_this.imgs[key] = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
}
|
|
}else{
|
|
|
|
if(_this.orderSubmitInfo.diyform.list[key].id == 'select'){
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
_this.createOrderInfo['select' + key] = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
}
|
|
}else{
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data = _this.orderSubmitInfo.diyform.list[key].data.value;
|
|
}
|
|
}
|
|
}
|
|
// if(_this.orderSubmitInfo.diyform.list[key].id == 'select'){
|
|
// _this.createOrderInfo['select' + count] = _this.orderSubmitInfo.diyform.list[key].data.options[0];
|
|
// }
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].id == 'datetime') {
|
|
_this.createOrderInfo['start' + key] = false;
|
|
_this.createOrderInfo['end' + key] = false;
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: [],
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
_this.createOrderInfo[key].data[0] = _this.addtime(_this.orderSubmitInfo.diyform.list[key].data.start_time_stamp);
|
|
|
|
_this.createOrderInfo[key].data[1] = _this.addtime(_this.orderSubmitInfo.diyform.list[key].data.end_time_stamp);
|
|
_this.orderSubmitInfo.diyform.list[key].data.end_time= _this.orderSubmitInfo.diyform.list[key].data.end_time.replace(/T/g," ");
|
|
_this.orderSubmitInfo.diyform.list[key].data.end_time = _this.orderSubmitInfo.diyform.list[key].data.end_time.substring(0,_this.orderSubmitInfo.diyform.list[key].data.end_time.length-3);
|
|
_this.orderSubmitInfo.diyform.list[key].data.start_time= _this.orderSubmitInfo.diyform.list[key].data.start_time.replace(/T/g," ");
|
|
_this.orderSubmitInfo.diyform.list[key].data.start_time = _this.orderSubmitInfo.diyform.list[key].data.start_time.substring(0,_this.orderSubmitInfo.diyform.list[key].data.start_time.length-3);
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo[key].data[0] = _this.orderSubmitInfo.diyform.list[key].data.value[0];
|
|
_this.createOrderInfo[key].data[1] = _this.orderSubmitInfo.diyform.list[key].data.value[1];
|
|
}
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].id == 'city') {
|
|
_this.createOrderInfo[key] = {
|
|
id: _this.orderSubmitInfo.diyform.list[key].id,
|
|
data: [],
|
|
count: count,
|
|
key:key,
|
|
title:_this.orderSubmitInfo.diyform.list[key].data.title
|
|
};
|
|
_this.createOrderInfo['show' + key] = false;
|
|
let str = '';
|
|
if (_this.orderSubmitInfo.diyform.list[key].data.province) {
|
|
_this.createOrderInfo[key].data.push(str);
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].data.city) {
|
|
_this.createOrderInfo[key].data.push(str);
|
|
} else if (_this.orderSubmitInfo.diyform.list[key].data.area) {
|
|
_this.createOrderInfo[key].data.push(str);
|
|
}
|
|
let citys = uni.getStorageSync('cityList');
|
|
citys = JSON.stringify(citys)
|
|
.replace(/name/g, 'label')
|
|
.replace(/id/g, 'value')
|
|
.replace(/area/g, 'children')
|
|
.replace(/dist/g, 'children');
|
|
citys = JSON.parse(citys);
|
|
_this.province = [];
|
|
_this.city = [];
|
|
_this.area = [];
|
|
|
|
_this.provincecityarea = citys;
|
|
_this.provincecityarea.map(item => {
|
|
item.value = item.label;
|
|
_this.province.push(item.label);
|
|
item.children.map(items => {
|
|
items.value = items.label;
|
|
_this.city.push(items.label);
|
|
items.children.map(i => {
|
|
i.value = i.label;
|
|
_this.area.push(i.label);
|
|
});
|
|
});
|
|
});
|
|
_this.provincecity = _this.provincecityarea;
|
|
if (
|
|
_this.orderSubmitInfo.diyform.list[key].data.area == 'true' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.city == 'true' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.province == 'true'
|
|
) {
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo['provincecityarea' + key] = [];
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[0]);
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[1]);
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[2]);
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[0])
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[1])
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[2])
|
|
}else{
|
|
_this.createOrderInfo['provincecityarea' + key] = [];
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.provincecityarea[0].label);
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.provincecityarea[0].children[0].label);
|
|
_this.createOrderInfo['provincecityarea' + key].push(_this.provincecityarea[0].children[0].children[0].label);
|
|
}
|
|
|
|
} else if (
|
|
_this.orderSubmitInfo.diyform.list[key].data.area == 'false' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.city == 'true' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.province == 'true'
|
|
) {
|
|
_this.provincecity.map(item => {
|
|
item.children.map(items => {
|
|
delete items.children;
|
|
});
|
|
});
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo['provincecity' + key] = [];
|
|
_this.createOrderInfo['provincecity' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[0]);
|
|
_this.createOrderInfo['provincecity' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[1]);
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[0])
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[1])
|
|
}else{
|
|
_this.createOrderInfo['provincecity' + key] =[];
|
|
_this.createOrderInfo['provincecity' + key].push(_this.provincecity[0].label);
|
|
_this.createOrderInfo['provincecity' + key].push(_this.provincecity[0].children[0].label);
|
|
}
|
|
|
|
} else if (
|
|
_this.orderSubmitInfo.diyform.list[key].data.area == 'true' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.city == 'true' &&
|
|
_this.orderSubmitInfo.diyform.list[key].data.province == 'false'
|
|
) {
|
|
_this.provincecityarea.map(item => {
|
|
item.children.map(items => {
|
|
_this.cityarea.push(items);
|
|
});
|
|
});
|
|
if(_this.orderSubmitInfo.diyform.list[key].data.value){
|
|
_this.createOrderInfo['cityarea' + key] = [];
|
|
_this.createOrderInfo['cityarea' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[0]);
|
|
_this.createOrderInfo['cityarea' + key].push(_this.orderSubmitInfo.diyform.list[key].data.value[1]);
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[0])
|
|
_this.createOrderInfo[key].data.push(_this.orderSubmitInfo.diyform.list[key].data.value[1])
|
|
}else{
|
|
_this.createOrderInfo['cityarea' + key] = [];
|
|
_this.createOrderInfo['cityarea' + key].push(_this.cityarea[0].label);
|
|
_this.createOrderInfo['cityarea' + key].push(_this.cityarea[0].children[0].label);
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(_this.provincecity);
|
|
|
|
|
|
// _this.createOrderInfo['cityarea' + key] = [cityarea[0].label,cityarea[0].children[0].label];
|
|
|
|
|
|
console.log(_this.createOrderInfo, _this.city, _this.area);
|
|
}
|
|
count++;
|
|
}
|
|
|
|
//
|
|
}
|
|
console.log(_this.createOrderInfo);
|
|
_this.formData = _this.orderSubmitInfo.diyform.list;
|
|
},
|
|
inputValue(e,key){
|
|
// this.$set(this.createOrderInfo, key, e.detail.value);
|
|
// console.log(this.createOrderInfo)
|
|
this.createOrderInfo[key].data = e.detail.value;
|
|
// console.log(this.inputs[key],key);
|
|
this.logocome = !this.logocome;
|
|
this.logocome = !this.logocome;
|
|
},
|
|
confirm(e,key){
|
|
console.log(e,key);
|
|
this.$set(this.createOrderInfo, key, e.value);
|
|
this.logocome = !this.logocome;
|
|
this.logocome = !this.logocome;
|
|
},
|
|
bindChange(e,key,num){
|
|
console.log(e,key);
|
|
if(num == 1){
|
|
this.createOrderInfo[key].data = e;
|
|
}else if(num == 2){
|
|
this.createOrderInfo[key].data[0] = e;
|
|
}else{
|
|
this.createOrderInfo[key].data[1] = e;
|
|
}
|
|
|
|
},
|
|
dycheck(key, data, index, i, ck) {
|
|
// createOrderInfo['p' + index];
|
|
let _this = this;
|
|
console.log(_this.formData)
|
|
if (!ck) {
|
|
_this.createOrderInfo[key + 'multiple'][index].check = true;
|
|
//
|
|
let itemName = _this.formData[key].data.options[index];
|
|
_this.createOrderInfo[key].data.push(itemName);
|
|
} else {
|
|
_this.createOrderInfo[key + 'multiple'][index].check = false;
|
|
_this.createOrderInfo[key].data.map((item, j) => {
|
|
if (item == _this.formData[key].data.options[index]) {
|
|
_this.createOrderInfo[key].data.splice(j, 1);
|
|
}
|
|
});
|
|
}
|
|
_this.logocome = !_this.logocome;
|
|
_this.logocome = !_this.logocome;
|
|
},
|
|
addtime(value) {
|
|
//
|
|
let time = value * 1000;
|
|
if (typeof time == 'undefined') {
|
|
return '';
|
|
} else {
|
|
let date = new Date(parseInt(time));
|
|
let y = date.getFullYear();
|
|
let MM = date.getMonth() + 1;
|
|
MM = MM < 10 ? '0' + MM : MM;
|
|
let d = date.getDate();
|
|
d = d < 10 ? '0' + d : d;
|
|
let h = date.getHours();
|
|
h = h < 10 ? '0' + h : h;
|
|
let m = date.getMinutes();
|
|
m = m < 10 ? '0' + m : m;
|
|
let s = date.getSeconds();
|
|
s = s < 10 ? '0' + s : s;
|
|
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
|
|
}
|
|
},
|
|
closePreview(item, key) {
|
|
let _this = this;
|
|
let userArray = ['a'];
|
|
if (_this.createOrderInfo['img' + key]) {
|
|
_this.createOrderInfo['img' + key].map((items, index) => {
|
|
if (items == item) {
|
|
console.log(_this.createOrderInfo['img' + key], 1111111111111);
|
|
_this.createOrderInfo['img' + key].splice(index, 1);
|
|
_this.logocome = !_this.logocome;
|
|
_this.logocome = !_this.logocome;
|
|
}
|
|
});
|
|
}
|
|
console.log(this.type2Url, _this.createOrderInfo['img' + key]);
|
|
},
|
|
uplodephone(length, localIds, key,numbers) {
|
|
let _this = this;
|
|
wxApi.uoloadIg(localIds[length], data => {
|
|
if (data.errMsg === 'uploadImage:ok') {
|
|
uni.showLoading({});
|
|
let requestData = {
|
|
upload_type: 2,
|
|
id: data.serverId
|
|
};
|
|
App._post_form(
|
|
'&do=uploadFiles',
|
|
requestData,
|
|
res => {
|
|
if (res.errno === 0) {
|
|
let num = length + 1;
|
|
if (_this.createOrderInfo['img' + key].length == numbers) {
|
|
uni.showToast({
|
|
title: `最多上传${numbers}张图片`,
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
_this.createOrderInfo['img' + key].push(res.data.img);
|
|
if (num < _this.uploadlength) {
|
|
uni.setTimeout(_this.uplodephone(num, _this.localIds, key), 500);
|
|
}else{
|
|
uni.$emit('update',{msg:'页面更新'})
|
|
}
|
|
_this.logocome = !_this.logocome;
|
|
_this.logocome = !_this.logocome;
|
|
// _this.userInfo.thumbs.push(res.data.image);
|
|
}
|
|
},
|
|
false,
|
|
() => {
|
|
uni.hideLoading();
|
|
}
|
|
);
|
|
} else {
|
|
uni.hideLoading();
|
|
App.showError('上传失败');
|
|
}
|
|
});
|
|
},
|
|
// 文件上传接口
|
|
async uploadFiles(type, key,numbers) {
|
|
let _this = this;
|
|
_this.$emit('ononahow');
|
|
// #ifdef H5
|
|
if(App.getClientType() == 2){
|
|
let res = await App.browser_upload(9);
|
|
if (type == 1) {
|
|
console.log(res);
|
|
let img = await App._upLoad(res.tempFilePaths[0]);
|
|
_this.type1Url = img.data.img;
|
|
_this.type1Urlon = img.data.image;
|
|
_this.imgs[key] = _this.type1Url;
|
|
_this.createOrderInfo[key].data = _this.type1Url;
|
|
console.log(_this.createOrderInfo[key]);
|
|
} else if (type == 2) {
|
|
for (let i = 0; i < res.tempFilePaths.length; i++) {
|
|
let imgs = await App._upLoad(res.tempFilePaths[i]);
|
|
// _this.type2Url = _this.createOrderInfo['img' + key];
|
|
if (_this.createOrderInfo['img' + key].length == numbers) {
|
|
uni.showToast({
|
|
title: '最多上传九张图片',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
console.log(_this.type2Url, _this.createOrderInfo['img' + key]);
|
|
_this.createOrderInfo['img' + key].push(imgs.data.img);
|
|
_this.type2Urlon.push(imgs.data.image);
|
|
// _this.createOrderInfo['img' + key] = _this.type2Url;
|
|
}
|
|
|
|
// res.tempFilePaths.map(item=>{
|
|
// let imgs = await App._upLoad(item);
|
|
// })
|
|
}
|
|
|
|
return
|
|
}
|
|
if (type == 2) {
|
|
wxApi.choseImage(res => {
|
|
// let length
|
|
|
|
_this.localIds = res.localIds;
|
|
_this.uploadlength = res.localIds.length;
|
|
_this.uplodephone(0, _this.localIds, key,numbers);
|
|
}, numbers);
|
|
} else {
|
|
wxApi.choseImage(res => {
|
|
wxApi.uoloadIg(res.localIds[0], data => {
|
|
if (data.errMsg === 'uploadImage:ok') {
|
|
uni.showLoading({});
|
|
let requestData = {
|
|
upload_type: 2,
|
|
id: data.serverId
|
|
};
|
|
App._post_form(
|
|
'&do=uploadFiles',
|
|
requestData,
|
|
res => {
|
|
if (type == 1) {
|
|
_this.type1Url = res.data.img;
|
|
_this.type1Urlon = res.data.image;
|
|
_this.imgs[key] = _this.type1Url;
|
|
_this.createOrderInfo[key].data = _this.type1Url;
|
|
uni.$emit('update',{msg:'页面更新'})
|
|
}
|
|
_this.logocome = !_this.logocome;
|
|
_this.logocome = !_this.logocome;
|
|
},
|
|
false,
|
|
() => {
|
|
uni.hideLoading();
|
|
}
|
|
);
|
|
} else {
|
|
uni.hideLoading();
|
|
App.showError('上传失败');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// #endif
|
|
// #ifndef H5
|
|
wx.chooseImage({
|
|
count: numbers,
|
|
sourceType: ['album', 'camera'],
|
|
success: async function(res) {
|
|
if (type == 1) {
|
|
console.log(res);
|
|
let img = await App._upLoad(res.tempFilePaths[0]);
|
|
_this.type1Url = img.data.img;
|
|
_this.type1Urlon = img.data.image;
|
|
_this.imgs[key] = _this.type1Url;
|
|
_this.createOrderInfo[key].data = _this.type1Url;
|
|
console.log(_this.createOrderInfo[key]);
|
|
} else if (type == 2) {
|
|
for (let i = 0; i < res.tempFilePaths.length; i++) {
|
|
let imgs = await App._upLoad(res.tempFilePaths[i]);
|
|
// _this.type2Url = _this.createOrderInfo['img' + key];
|
|
if (_this.createOrderInfo['img' + key].length == numbers) {
|
|
uni.showToast({
|
|
title: '最多上传九张图片',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
console.log(_this.type2Url, _this.createOrderInfo['img' + key]);
|
|
_this.createOrderInfo['img' + key].push(imgs.data.img);
|
|
_this.type2Urlon.push(imgs.data.image);
|
|
// _this.createOrderInfo['img' + key] = _this.type2Url;
|
|
}
|
|
|
|
// res.tempFilePaths.map(item=>{
|
|
// let imgs = await App._upLoad(item);
|
|
// })
|
|
}
|
|
}
|
|
});
|
|
// #endif
|
|
},
|
|
closeLogo(key, item) {
|
|
let _this = this;
|
|
_this.type1Url = '';
|
|
_this.type1Urlon = '';
|
|
_this.createOrderInfo[key].data = '';
|
|
_this.imgs[key] = ''
|
|
// _this.userInfo['m' + index] = '';
|
|
// _this.$set(_this.createOrderInfo, 'p' + index, '');
|
|
_this.logocome = !_this.logocome;
|
|
_this.logocome = !_this.logocome;
|
|
},
|
|
},
|
|
computed:{
|
|
|
|
},
|
|
watch:{
|
|
gopaytwo(){
|
|
this.datasValue();
|
|
},
|
|
'gopay': {
|
|
handler(newData, oldData) {
|
|
let _this = this;
|
|
let data = Object.assign({}, _this.createOrderInfo);
|
|
console.log(data,_this.formData);
|
|
//
|
|
let name = null;
|
|
let datas = [];
|
|
let thiscity = [];
|
|
if(_this.orderSubmitInfo.diyform){
|
|
for (let key in _this.formData) {
|
|
if (_this.formData[key].id == 'city') {
|
|
if (
|
|
_this.formData[key].data.province == 'true' &&
|
|
_this.formData[key].data.city == 'false' &&
|
|
_this.formData[key].data.area == 'false'
|
|
) {
|
|
name = 'province';
|
|
thiscity = _this.province[0];
|
|
} else if (
|
|
_this.formData[key].data.province == 'false' &&
|
|
_this.formData[key].data.city == 'true' &&
|
|
_this.formData[key].data.area == 'false'
|
|
) {
|
|
name = 'city';
|
|
thiscity = _this.city[0];
|
|
} else if (
|
|
_this.formData[key].data.province == 'false' &&
|
|
_this.formData[key].data.city == 'false' &&
|
|
_this.formData[key].data.area == 'true'
|
|
) {
|
|
name = 'area';
|
|
thiscity = _this.area[0];
|
|
} else if (
|
|
_this.formData[key].data.province == 'false' &&
|
|
_this.formData[key].data.city == 'true' &&
|
|
_this.formData[key].data.area == 'true'
|
|
) {
|
|
name = 'cityarea';
|
|
thiscity.push(_this.cityarea[0].label);
|
|
thiscity.push(_this.cityarea[0].children[0].label);
|
|
} else if (
|
|
_this.formData[key].data.province == 'true' &&
|
|
_this.formData[key].data.city == 'true' &&
|
|
_this.formData[key].data.area == 'false'
|
|
) {
|
|
name = 'provincecity';
|
|
thiscity.push(_this.provincecity[0].label);
|
|
thiscity.push(_this.provincecity[0].children[0].label);
|
|
} else if (
|
|
_this.formData[key].data.province == 'true' &&
|
|
_this.formData[key].data.city == 'true' &&
|
|
_this.formData[key].data.area == 'true'
|
|
) {
|
|
name = 'provincecityarea';
|
|
thiscity.push(_this.provincecity[0].label);
|
|
thiscity.push(_this.provincecity[0].children[0].label);
|
|
thiscity.push(_this.provincecity[0].children[0].children[0].label);
|
|
}
|
|
}
|
|
console.log(data)
|
|
//
|
|
for (let j in data) {
|
|
if (data[j] instanceof Object) {
|
|
// for(let k in _this.inputs){
|
|
// if(k == j){
|
|
// data[j] = _this.inputs[k];
|
|
// }
|
|
// }
|
|
|
|
if (data[j].id == 'select' && _this.formData[key].id == 'select') {
|
|
data[key].data = data['select' + key] || _this.formData[key].data.options[0];
|
|
//
|
|
} else if (data[j].id == 'img' && _this.formData[key].id == 'img' && j == key) {
|
|
if(_this.formData[key].data.number == 1){
|
|
let imgs = _this.imgs[key];
|
|
if(data[key].data){
|
|
imgs = data[key].data;
|
|
}
|
|
data[key].data = new Array;
|
|
if(imgs){
|
|
data[key].data.push(imgs);
|
|
}
|
|
}else{
|
|
data[key].data = data['img' + key] || [];
|
|
}
|
|
|
|
} else if (data[j].id == 'city' && _this.formData[key].id == 'city') {
|
|
if (data[name + key]) {
|
|
data[key].data = data[name + key];
|
|
} else {
|
|
//
|
|
data[key].data = thiscity;
|
|
}
|
|
}
|
|
if (data[j].id == _this.formData[key].id && j == key) {
|
|
console.log(j,key);
|
|
//
|
|
datas.push(data[j]);
|
|
if (_this.formData[key].data.is_required == 1) {
|
|
if (data[j].data instanceof Array && data[j].data.length == 0) {
|
|
console.log(data[j].id,'进来了',_this.formData[key].id,j,key);
|
|
_this.ifrequired = false;
|
|
return
|
|
} else if (!data[j].data) {
|
|
_this.ifrequired = false;
|
|
return
|
|
}
|
|
_this.ifrequired = true;
|
|
|
|
}
|
|
}
|
|
// console.log(data)
|
|
|
|
|
|
}
|
|
// console.log(datas,9191919191919);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
_this.formList = datas;
|
|
|
|
},
|
|
deep: true
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.dynamiccheck {
|
|
// width: 100upx;
|
|
padding: 0 30upx;
|
|
font-size: 20upx;
|
|
border-radius: 10upx;
|
|
border: 1upx solid #ff4444;
|
|
color: #ffffff;
|
|
background-color: #ff4444;
|
|
height: 50upx;
|
|
line-height: 50upx;
|
|
margin-right: 10upx;
|
|
margin-bottom: 20upx;
|
|
// flex: 0.15;
|
|
}
|
|
.dynamicnocheck {
|
|
// width: 100upx;
|
|
padding: 0 30upx;
|
|
font-size: 20upx;
|
|
border-radius: 10upx;
|
|
border: 1upx solid #ff4444;
|
|
color: #ff4444;
|
|
// flex: 0.15;
|
|
height: 50upx;
|
|
line-height: 50upx;
|
|
margin-right: 10upx;
|
|
margin-bottom: 20upx;
|
|
}
|
|
.formItem{
|
|
// padding: 0 30upx;
|
|
padding-top: 30upx;
|
|
|
|
> view {
|
|
// border-bottom: 1px solid #eeeeee;
|
|
background-color: #fafafa;
|
|
border-radius: 10upx;
|
|
margin-bottom: 20upx;
|
|
}
|
|
|
|
> view:last-child {
|
|
border: none;
|
|
}
|
|
|
|
> view {
|
|
> span {
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
width: 200upx;
|
|
font-size: 24upx;
|
|
|
|
color: rgba(51, 51, 51, 1);
|
|
}
|
|
|
|
> input {
|
|
margin-left: 40upx;
|
|
display: inline-block;
|
|
width: 350upx;
|
|
height: 82upx;
|
|
color: rgba(51, 51, 51, 1);
|
|
font-size: 24upx;
|
|
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
}
|
|
.m-t{
|
|
margin-top: 14upx;
|
|
}
</style>
|
|
|