Commit 253c6473 by 李伟康

Merge branches 'V4.56.0' and 'V4.56.0' of http://192.168.3.233:8090/glsx/gl_tape into V4.56.0

2 parents 044d334d 11651448

2.53 MB | W: | H:

2.54 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<view>
<view v-for="(items, boxIdx) in formList" :key="boxIdx">
<view class="cell-box"> <view class="cell-box">
<view <view v-for="(item, idx) in items" :key="idx" class="cell" @click="onCellClick(item)" :class="[
v-for="(item, index) in fromList"
:key="index"
class="cell"
@click="handleCell(item)"
:class="[
item.noBorder ? '' : 'border', item.noBorder ? '' : 'border',
item.onlyLabel ? 'small-height' : '', item.onlyLabel ? 'small-height' : '',
item.class item.class
]" ]">
> <view :class="['cell-label', { 'only-label': item.onlyLabel }]">
<view :class="['cell-label', item.onlyLabel ? 'only-label' : '']"> <view v-if="item.labellIcon" :class="['sprite-icon', `icon-${item.labellIcon}`]"></view>
{{ item.label }} {{ item.label }}
<view v-if="item.required" class="required">*</view> <view v-if="item.required" class="required">*</view>
</view> </view>
<view class="cell-value"> <view class="cell-value">
<template v-if="item.type == 'input'"> <!-- 输入框 -->
<!-- <view v-if="item.valueIcon" :class="['sprite-icon input-icon', `icon-${item.valueIcon}`]"></view> --> <template v-if="item.type === 'input'">
<input <view class="input-box">
class="input-value" <input class="input-value" v-model="formData[item.value]" :placeholder="item.placeholder || '请输入'"
v-model="formData[item.value]" :maxlength="item.maxlength || 500" />
:placeholder="item.placeholder || '请输入'" <view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]" @click="onValueClick(item)"></view>
:maxlength="item.maxlength || 500" </view>
/>
</template> </template>
<template v-else-if="item.type == 'select'"> <!-- 下拉选择 -->
<view v-if="formData[item.value][item.key]" class="value"> <template v-else-if="item.type === 'select'">
<view v-if="formData[item.value] && formData[item.value][item.key]" class="value">
{{ formData[item.value][item.key] }} {{ formData[item.value][item.key] }}
</view> </view>
<view v-else class="placeholder value"> <view v-else class="placeholder value">
...@@ -35,31 +32,30 @@ ...@@ -35,31 +32,30 @@
<view class="sprite-icon icon-icon-select"></view> <view class="sprite-icon icon-icon-select"></view>
</view> </view>
</template> </template>
<template v-else-if="item.type == 'radio'"> <!-- 单选框 -->
<radio-group class="radio-group value" @change="radioChange($event, item)"> <template v-else-if="item.type === 'radio'">
<label class="uni-list-cell uni-list-cell-pd" v-for="(i, ind) in item.radioList" :key="i.name + item.value"> <radio-group class="radio-group value" @change="onRadioChange($event, item)">
<radio style="transform:scale(0.7)" :value="i.value" :checked="i.value == item.current" /> <label class="uni-list-cell uni-list-cell-pd" v-for="radio in item.radioList"
<view class="radio-name">{{i.name}}</view> :key="radio.value + item.value">
<radio style="transform:scale(0.7)" :value="radio.value" :checked="radio.value == item.current" />
<view class="radio-name">{{ radio.name }}</view>
</label> </label>
</radio-group> </radio-group>
</template> </template>
<template v-else-if="item.type == 'textarea'"> <!-- 多行文本 -->
<textarea class="textarea" v-model="formData[item.value]" :placeholder="item.placeholder || '请输入'" placeholder-class="textarea-placeholder" confirm-type="done" auto-height :maxlength="item.maxlength"></textarea> <template v-else-if="item.type === 'textarea'">
<textarea class="textarea" v-model="formData[item.value]" :placeholder="item.placeholder || '请输入'"
placeholder-class="textarea-placeholder" confirm-type="done" auto-height
:maxlength="item.maxlength"></textarea>
</template> </template>
</view> </view>
</view> </view>
</view> </view>
</view>
</view>
</template> </template>
<script> <script>
const debounce = function(fn, delay = 300) {
let timer = null;
return function(...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(this, args);
}, delay);
};
}
export default { export default {
name: "GlCell", name: "GlCell",
props: { props: {
...@@ -75,30 +71,29 @@ export default { ...@@ -75,30 +71,29 @@ export default {
* radioList: type为radio时传入 * radioList: type为radio时传入
* current: type为radio时传入,设置radio的默认值 * current: type为radio时传入,设置radio的默认值
*/ */
fromList: { formList: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
formData: { formData: {
type: Object, type: Object,
default: () => {} default: () => ({})
}
},
data() {
return {
} }
}, },
methods: { methods: {
handleCell(item) { onCellClick(item) {
if (item.type == 'select') { if (item.type === 'select') {
this.$emit('handleCell', item) this.$emit('handleCell', item);
} }
}, },
radioChange(e, item) { onRadioChange(e, item) {
this.$emit('radioChange', e, item) this.$emit('radioChange', e, item);
},
onValueClick(item) {
this.$emit('handleValue', item)
} }
} }
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -106,6 +101,7 @@ export default { ...@@ -106,6 +101,7 @@ export default {
background-color: #fff; background-color: #fff;
border-radius: toRpx(16); border-radius: toRpx(16);
overflow: hidden; overflow: hidden;
margin-bottom: toRpx(18);
} }
.cell { .cell {
...@@ -132,6 +128,11 @@ export default { ...@@ -132,6 +128,11 @@ export default {
.cell-label { .cell-label {
color: #333; color: #333;
font-size: toRpx(28); font-size: toRpx(28);
display: flex;
align-items: center;
.sprite-icon {
margin-right: toRpx(8);
}
.required { .required {
display: inline-block; display: inline-block;
...@@ -177,7 +178,15 @@ export default { ...@@ -177,7 +178,15 @@ export default {
align-items: center; align-items: center;
height: 100%; height: 100%;
} }
.input-box {
display: flex;
align-items: center;
justify-content: flex-end;
height: 100%;
.sprite-icon {
margin-left: toRpx(8);
}
}
.input-value { .input-value {
height: 100%; height: 100%;
text-align: right; text-align: right;
...@@ -203,12 +212,7 @@ export default { ...@@ -203,12 +212,7 @@ export default {
display: inline-block; display: inline-block;
} }
.input-icon {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.textarea { .textarea {
width: 100%; width: 100%;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="box"> <view class="box">
<scroll-view class="scroll-view" scroll-y="true"> <scroll-view class="scroll-view" scroll-y="true">
<view class="box-content"> <view class="box-content">
<GlCell :fromList="fromList" :formData="formData" @radioChange="radioChange" @handleCell="handleCell"></GlCell> <GlCell :formList="formList" :formData="formData" @radioChange="radioChange" @handleValue="handleValue" @handleCell="handleCell"></GlCell>
</view> </view>
<view @click="submit">直接下单</view> <view @click="submit">直接下单</view>
</scroll-view> </scroll-view>
...@@ -28,7 +28,8 @@ export default { ...@@ -28,7 +28,8 @@ export default {
salesType: '1', salesType: '1',
sexType: '1' sexType: '1'
}, },
fromList: [ formList: [
[
{ {
label: '销售顾问', label: '销售顾问',
value: 'user', value: 'user',
...@@ -36,18 +37,43 @@ export default { ...@@ -36,18 +37,43 @@ export default {
key: 'name', key: 'name',
required: true required: true
}, },
{ {
label: '请选择产品', label: '转化人员',
onlyLabel: true, value: 'user',
type: 'select',
key: 'name',
required: true
},
],
[
{
label: '车主姓名1',
value: 'carName1',
maxlength: '10',
type: 'input',
required: true
},
{
label: '车主姓名1',
value: 'carName1',
maxlength: '10',
type: 'input',
required: true
},
{
label: '车架号',
value: 'carName1',
maxlength: '10',
type: 'input',
required: true, required: true,
noBorder: true valueIcon: 'icon-scanning'
}, },
{ {
label: '手机号', label: '车牌号',
value: 'phone', value: 'carName1',
maxlength: '11', maxlength: '10',
type: 'input' type: 'input',
valueIcon: 'icon-scanning'
}, },
{ {
label: '客户来源', label: '客户来源',
...@@ -82,10 +108,11 @@ export default { ...@@ -82,10 +108,11 @@ export default {
] ]
}, },
{ {
label: '车牌号', label: '车主姓名1',
value: 'carNumber', value: 'carName1',
maxlength: '10',
type: 'input', type: 'input',
valueIcon: 'icon-scanning' required: true
}, },
{ {
label: '车主姓名1', label: '车主姓名1',
...@@ -94,44 +121,174 @@ export default { ...@@ -94,44 +121,174 @@ export default {
type: 'input', type: 'input',
required: true required: true
}, },
],
[
{ {
label: '车主姓名2', label: '销售顾问',
value: 'carName2', value: 'user',
maxlength: '10', type: 'select',
type: 'input', key: 'name',
required: true required: true
}, },
{ {
label: '车主姓名3', label: '请选择产品',
value: 'carName3', onlyLabel: true,
maxlength: '10', required: true,
type: 'input', noBorder: true
},
{
label: '前档',
value: 'user',
type: 'select',
key: 'name',
required: true,
labellIcon: 'front-gear'
},
{
label: '前侧窗玻璃',
value: 'user',
type: 'select',
key: 'name',
required: true,
labellIcon: 'front-window'
},
{
label: '销售顾问',
value: 'user',
type: 'select',
key: 'name',
required: true required: true
}, },
{ {
label: '车主姓名4', label: '销售顾问',
value: 'carName4', value: 'user',
maxlength: '10', type: 'select',
type: 'input', key: 'name',
required: true required: true
}, },
{ {
label: '车主姓名5', label: '销售顾问',
value: 'carName5', value: 'user',
maxlength: '10', type: 'select',
type: 'input', key: 'name',
required: true required: true
}, },
],
[
{ {
label: '车主姓名6', label: '备注',
value: 'carName6', value: 'remark',
maxlength: '100', maxlength: '100',
type: 'textarea', type: 'textarea',
required: true,
placeholder: '请输入 (100字以内)', placeholder: '请输入 (100字以内)',
class: 'cell-row' class: 'cell-row'
}, },
] ]
]
// fromList: [
// {
// label: '销售顾问',
// value: 'user',
// type: 'select',
// key: 'name',
// required: true
// },
// {
// label: '请选择产品',
// onlyLabel: true,
// required: true,
// noBorder: true
// },
// {
// label: '手机号',
// value: 'phone',
// maxlength: '11',
// type: 'input'
// },
// {
// label: '客户来源',
// value: 'salesType',
// type: 'radio',
// current: '1',
// radioList: [
// {
// value: '1',
// name: '售前'
// },
// {
// value: '2',
// name: '售后'
// }
// ]
// },
// {
// label: '性别',
// value: 'sexType',
// type: 'radio',
// current: '1',
// radioList: [
// {
// value: '1',
// name: '男'
// },
// {
// value: '2',
// name: '女'
// }
// ]
// },
// {
// label: '车牌号',
// value: 'carNumber',
// type: 'input',
// valueIcon: 'icon-scanning'
// },
// {
// label: '车主姓名1',
// value: 'carName1',
// maxlength: '10',
// type: 'input',
// required: true
// },
// {
// label: '车主姓名2',
// value: 'carName2',
// maxlength: '10',
// type: 'input',
// required: true
// },
// {
// label: '车主姓名3',
// value: 'carName3',
// maxlength: '10',
// type: 'input',
// required: true
// },
// {
// label: '车主姓名4',
// value: 'carName4',
// maxlength: '10',
// type: 'input',
// required: true
// },
// {
// label: '车主姓名5',
// value: 'carName5',
// maxlength: '10',
// type: 'input',
// required: true
// },
// {
// label: '车主姓名6',
// value: 'carName6',
// maxlength: '100',
// type: 'textarea',
// required: true,
// placeholder: '请输入 (100字以内)',
// class: 'cell-row'
// },
// ]
} }
}, },
methods: { methods: {
...@@ -154,6 +311,10 @@ export default { ...@@ -154,6 +311,10 @@ export default {
console.log(e, val) console.log(e, val)
this.formData[val.value] = e.detail.value this.formData[val.value] = e.detail.value
}, },
handleValue(val) {
console.log(val)
uni.navigateTo({ url: '/pages/boutique/tool/ocr' })
},
submit() { submit() {
console.log(this.formData) console.log(this.formData)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!