Commit 2ef49aa6 by 胡悦

feat: 更新表单组件和样式

- 在 GlCell 组件中,添加输入框失去焦点事件处理
- 修改表单数据结构,更新字段名称以更好地反映数据含义
- 在 CreateOrder 组件中,增强弹窗功能,支持外部数据传递
- 更新样式以改善用户体验,确保输入框和按钮的宽度适应性
- 更新图标样式,添加新的删除图标并调整背景位置
1 parent b4400548

2.54 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
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<!-- 输入框 --> <!-- 输入框 -->
<template v-if="item.type === 'input'"> <template v-if="item.type === 'input'">
<view class="input-box"> <view class="input-box">
<input class="input-value" v-model="formData[item.value]" :placeholder="item.placeholder || '请输入'" <input class="input-value" v-model="formData[item.value]" :type="item.inputType || 'text'" @blur="handleBlur($event, item)" :placeholder="item.placeholder || '请输入'"
:maxlength="item.maxlength || 500" /> :maxlength="item.maxlength || 500" />
<view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]" <view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]"
@click="onValueClick(item)"></view> @click="onValueClick(item)"></view>
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
<!-- 下拉选择 --> <!-- 下拉选择 -->
<template v-else-if="item.type === 'select'"> <template v-else-if="item.type === 'select'">
<view class="value"> <view class="value">
<template v-if="formData[item.value] && formData[item.value][item.key]"> <template v-if="formData[item.value] && formData[item.value]">
<template v-if="item.showText && userInfo && userInfo[item.showText]"> <template v-if="item.showText && userInfo && userInfo[item.showText]">
{{ userInfo[item.showText] }}<text>|</text> {{ userInfo[item.showText] }}<text>|</text>
</template> </template>
{{ formData[item.value][item.key] }} {{ formData[item.value] }}
</template> </template>
<template v-else> <template v-else>
<span class="placeholder">请选择</span> <span class="placeholder">请选择</span>
...@@ -109,6 +109,9 @@ export default { ...@@ -109,6 +109,9 @@ export default {
}, },
onValueClick(item) { onValueClick(item) {
this.$emit('handleValue', item) this.$emit('handleValue', item)
},
handleBlur(e, item) {
this.$emit('inputBlur', e, item)
} }
} }
}; };
...@@ -205,6 +208,7 @@ export default { ...@@ -205,6 +208,7 @@ export default {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
height: 100%; height: 100%;
width: 100%;
.sprite-icon { .sprite-icon {
margin-left: toRpx(8); margin-left: toRpx(8);
...@@ -214,6 +218,7 @@ export default { ...@@ -214,6 +218,7 @@ export default {
.input-value { .input-value {
height: 100%; height: 100%;
text-align: right; text-align: right;
width: 100%;
} }
.input-bottom { .input-bottom {
......
...@@ -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 :formList="formList" :formData="orderObj" @radioChange="radioChange" @handleCell="handleCell"> <GlCell :formList="formList" :formData="orderObj" @radioChange="radioChange" @inputBlur="inputBlur" @handleCell="handleCell">
<template slot="product"> <template slot="product">
<view class="shop-list"> <view class="shop-list">
<view class="shop-item"> <view class="shop-item">
...@@ -87,11 +87,11 @@ ...@@ -87,11 +87,11 @@
</template> </template>
</GlCell> </GlCell>
</view> </view>
<view @click="submit">直接下单</view> <view @click="submit" class="btn">直接下单</view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 弹窗 --> <!-- 弹窗 -->
<order-popup ref="orderPopup" :data="popData" @onConfirm="onConfirm" :popupType="popupType" /> <order-popup ref="orderPopup" :data="orderObj" @onConfirm="onConfirm" :externalData="externalData" :popupType="popupType" />
</view> </view>
</template> </template>
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
}, },
data() { data() {
return { return {
orderObj: { formObj: {
userInfo: {}, userInfo: {},
deliveryUserInfo: {}, deliveryUserInfo: {},
subShopMerchantInfo: {}, subShopMerchantInfo: {},
...@@ -117,16 +117,23 @@ export default { ...@@ -117,16 +117,23 @@ export default {
experienceFlag: 'Y', experienceFlag: 'Y',
payeeType: 0, payeeType: 0,
selectPayType: '3', selectPayType: '3',
carBrand: {} carBrand: {},
customerPhone: ''
}, },
formList: FORM_LIST, formList: FORM_LIST,
userInfo: {}, userInfo: {},
requiredList: [], // 录单设置的必填项 requiredList: [], // 录单设置的必填项
popData: { orderObj: {
customer: {} customer: {},
}, customerSex: '1',
experienceFlag: 'Y',
payeeType: 0
}, // 弹窗传入的数据},
popupType: 0, popupType: 0,
popupTypeEnum, popupTypeEnum,
externalData: [], //弹窗接口数据
subShopMerchantList: [], // 二级流量方列表
employeeList: []
} }
}, },
computed: { computed: {
...@@ -135,9 +142,22 @@ export default { ...@@ -135,9 +142,22 @@ export default {
else return false else return false
} }
}, },
onload(options) {
console.log(options, 'options')
},
mounted() { mounted() {
console.log('mounted') console.log('mounted')
this.userInfo = uni.$storage.get('userInfo') || {} this.userInfo = uni.$storage.get('userInfo') || {}
const { userInfo } = this
// 在原有的 orderObj 对象上新增这些属性
Object.assign(this.orderObj, {
sellerMerchantNam: userInfo.merchantName,
sellerName: userInfo.name,
sellerMerchantId: userInfo.merchantId,
sellerUserId: userInfo.uuid,
merchantId: userInfo.shopMerchantId,
merchantName: userInfo.shopMerchantName
})
this.initData() this.initData()
}, },
methods: { methods: {
...@@ -146,20 +166,22 @@ export default { ...@@ -146,20 +166,22 @@ export default {
this.getShopMerchantPointConfig(userInfo.shopMerchantId) this.getShopMerchantPointConfig(userInfo.shopMerchantId)
this.getSubShopMerchantList(userInfo.shopMerchantId) this.getSubShopMerchantList(userInfo.shopMerchantId)
this.getSetting() this.getSetting()
// this.orderObj.userInfo = { this.getConfig()
// id: 1, this.getEmployeeList()
// name: '测试'
// }
this.orderObj.sellerMerchant = {
sellerUserId: userInfo.uuid,
sellerName: userInfo.name
}
}, },
// 选择行事件 // 选择行事件
handleCell(val) { handleCell(val) {
console.log(val) console.log(val, this.orderObj)
this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key] === val.value) * 1; // 获取当前选中的popupType
console.log(this.popupType) this.popupType = Object.keys(this.popupTypeEnum).find(key => this.popupTypeEnum[key].key === val.value) * 1;
// 获取对应的list字段
const popupConfig = this.popupTypeEnum[this.popupType];
if (popupConfig && popupConfig.list) {
this.externalData = this[popupConfig.list] || [];
} else {
this.externalData = [];
}
console.log(this.popupType, this.externalData, '-------------')
this.$refs.orderPopup.open(); this.$refs.orderPopup.open();
}, },
// 单选框change事件 // 单选框change事件
...@@ -169,13 +191,40 @@ export default { ...@@ -169,13 +191,40 @@ export default {
}, },
onConfirm(val) { onConfirm(val) {
console.log(val, 'onConfirm') console.log(val, 'onConfirm')
const {chooseContent} = val
// 根据popupTypeEnum优化处理 // 根据popupTypeEnum优化处理
const typeKey = this.popupTypeEnum[this.popupType]; const _typeValue = this.popupTypeEnum[this.popupType];
if (typeKey) this.orderObj[typeKey] = val; console.log(_typeValue)
if (typeKey == 'carBrand') { if (_typeValue.key == 'carBrand') {
this.orderObj[typeKey].carInfo = `${val.carBrand}-${val.carChildsBrandName}-${val.carSeriesName}` // 车型
this.$set(this.orderObj, _typeValue.key, `${chooseContent.carBrand}-${chooseContent.carChildsBrandName}-${chooseContent.carSeriesName}`)
this.orderObj.customer = {
...(this.orderObj.customer || {}),
...chooseContent
}
} else if (_typeValue.key == 'couponInfo') {
// 礼券
const {couponName, merchantCouponId, customerCouponCode } = chooseContent
Object.assign(this.orderObj, {
couponName: couponName,
merchantCouponId: merchantCouponId,
customerCouponCode: customerCouponCode
})
this.$set(this.orderObj, 'couponInfo', couponName + customerCouponCode)
} else if (_typeValue.key) {
// this.formObj[_typeValue.key] = chooseContent;
this.orderObj[_typeValue.targetIdKey] = chooseContent[_typeValue.sourceIdKey]
this.$set(this.orderObj, _typeValue.targetNameKey, chooseContent[_typeValue.sourceNameKey])
} }
}, },
// 输入框失去焦点事件
inputBlur(e, val) {
console.log(e, val)
this.orderObj.customer[val.value] = this.orderObj[val.value]
},
checkRequired() {
},
// 提交 // 提交
submit() { submit() {
console.log(this.orderObj) console.log(this.orderObj)
...@@ -195,6 +244,7 @@ export default { ...@@ -195,6 +244,7 @@ export default {
const res = await uni.$api.boutiqueApi.getSubShopMerchantList({ merchantId }) const res = await uni.$api.boutiqueApi.getSubShopMerchantList({ merchantId })
console.log(res, '流量方') console.log(res, '流量方')
if (res && res.length) { if (res && res.length) {
this.subShopMerchantList = res
const cell = this.formList[0].find(item => item.label === '二级流量方'); const cell = this.formList[0].find(item => item.label === '二级流量方');
if (cell) { if (cell) {
cell.hidden = false; cell.hidden = false;
...@@ -233,7 +283,25 @@ export default { ...@@ -233,7 +283,25 @@ export default {
} }
}, },
async getConfig() { async getConfig() {
const res = await uni.$api.boutiqueApi.getYqStoreConfig({
yqMerchantId: this.orderObj.sellerMerchantId
})
console.log(res)
},
// 获取 销售顾问列表
async getEmployeeList() {
const { userInfo, orderObj } = this
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getEmployeeList({
merchantId: orderObj.idKey == 'sellerUserId' ? merchantId : shopMerchantId,
sceneList: orderObj.idKey == 'sellerUserId' ? '' : [sceneType]
})
if (data && data.length) {
this.employeeList = data
this.formObj.userInfo = data[0]
this.$set(this.orderObj, 'employeeName', data[0].staffName)
this.orderObj.userId = data[0].uuid
}
} }
} }
} }
...@@ -246,7 +314,7 @@ export default { ...@@ -246,7 +314,7 @@ export default {
.box { .box {
height: calc(100% - #{toRpx(120)}); height: calc(100% - #{toRpx(120)});
padding-bottom: toRpx(24);
.scroll-view { .scroll-view {
height: 100%; height: 100%;
} }
...@@ -375,9 +443,7 @@ export default { ...@@ -375,9 +443,7 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-bottom: toRpx(1.6) solid #dce1e6; border-bottom: toRpx(1.6) solid #dce1e6;
padding: toRpx(24); padding: toRpx(24); &-left {
&-left {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: toRpx(28); font-size: toRpx(28);
...@@ -419,4 +485,15 @@ export default { ...@@ -419,4 +485,15 @@ export default {
font-size: toRpx(24); font-size: toRpx(24);
color: #999; color: #999;
} }
.btn {
display: flex;
align-items: center;
justify-content: center;
margin: toRpx(88) auto 0;
width: toRpx(1130);
height: toRpx(80);
color: #fff;
border-radius: toRpx(48);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -2,34 +2,34 @@ const FORM_LIST = [ ...@@ -2,34 +2,34 @@ const FORM_LIST = [
[ [
{ {
label: '销售顾问', label: '销售顾问',
value: 'userInfo', value: 'employeeName',
type: 'select', type: 'select',
key: 'staffName', // key: 'staffName',
required: true, required: true,
showText: 'shopMerchantName' showText: 'shopMerchantName'
}, },
{ {
label: '交付专员', label: '交付专员',
value: 'deliveryUserInfo', value: 'deliveryEmployeeName',
type: 'select', type: 'select',
required: true, required: true,
key: 'staffName', // key: 'staffName',
hidden: true, hidden: true,
showText: 'shopMerchantName' showText: 'shopMerchantName'
}, },
{ {
label: '二级流量方', label: '二级流量方',
value: 'subShopMerchantInfo', value: 'subShopMerchantName',
type: 'select', type: 'select',
required: true, required: true,
key: 'subMerchantName', // key: 'subMerchantName',
hidden: true hidden: true
}, },
{ {
label: '转化人员', label: '转化人员',
value: 'sellerUserInfo', value: 'sellerName',
type: 'select', type: 'select',
key: 'staffName', // key: 'staffName',
required: true, required: true,
showText: 'merchantName' showText: 'merchantName'
}, },
...@@ -37,7 +37,7 @@ const FORM_LIST = [ ...@@ -37,7 +37,7 @@ const FORM_LIST = [
[ [
{ {
label: '车主姓名', label: '车主姓名',
value: 'customer', value: 'customerName',
maxlength: '16', maxlength: '16',
type: 'input', type: 'input',
required: true required: true
...@@ -80,7 +80,8 @@ const FORM_LIST = [ ...@@ -80,7 +80,8 @@ const FORM_LIST = [
value: 'customerPhone', value: 'customerPhone',
maxlength: '11', maxlength: '11',
type: 'input', type: 'input',
required: true required: true,
inputType: 'number'
}, },
{ {
label: '选择车型', label: '选择车型',
...@@ -180,7 +181,7 @@ const FORM_LIST = [ ...@@ -180,7 +181,7 @@ const FORM_LIST = [
addHtml: 'package' addHtml: 'package'
}, },
{ {
label: '精品礼券', label: '其他精品',
value: 'couponInfo', value: 'couponInfo',
type: 'select', type: 'select',
key: 'name', key: 'name',
...@@ -271,11 +272,46 @@ const payType = [ ...@@ -271,11 +272,46 @@ const payType = [
] ]
const popupTypeEnum = { const popupTypeEnum = {
0: 'userInfo', 0: {
1: 'deliveryUserInfo', key: 'employeeName',
2: 'subShopMerchantInfo', list: 'employeeList',
3: 'sellerUserInfo', targetIdKey: 'userId',
4: 'carBrand' targetNameKey: 'employeeName',
sourceIdKey: 'uuid',
sourceNameKey: 'staffName'
},
1: {
key: 'deliveryEmployeeName',
list: 'employeeList',
targetIdKey: 'deliveryUserId',
targetNameKey: 'deliveryEmployeeName',
sourceIdKey: 'uuid',
sourceNameKey: 'staffName'
},
2: {
key: 'subShopMerchantName',
list: 'subShopMerchantList',
targetIdKey: 'subShopMerchantId',
targetNameKey: 'subShopMerchantName',
sourceIdKey: 'subMerchantId',
sourceNameKey: 'subMerchantName'
},
3: {
key: 'sellerName',
list: '',
targetIdKey: 'sellerUserId',
targetNameKey: 'sellerName',
sourceIdKey: 'uuid',
sourceNameKey: 'staffName'
},
4: {
key: 'carBrand',
list: ''
},
5: {
key: 'couponInfo',
list: '',
}
} }
export { export {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!