Commit a3d2f44a by 岑成威

feat:新增场景选择

1 parent 20a30d28

3.04 MB | W: | H:

3.05 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>
<view class="scene-list">
<template v-for="(i, index) in listData">
<view
:key="index"
@click="choose(i)"
:class="['item flex', { active: checkActive(i) }]"
>
<view
class="scene-type-tag"
:style="{ background: sceneTag.bg, color: sceneTag.color }"
>{{ sceneTag.label }}</view>
<view class="sprite-icon icon-tag-checked"></view>
{{ i.staffName }}
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
import popupmixin from './popupmixin'
const SCENE_TYPE_TAG_MAP = {
0: { label: '轻改', bg: '#5575f51a', color: '#5575f5' },
1: { label: '权益', bg: '#4bc8fe1a', color: '#4bc8fe' },
2: { label: '保险', bg: '#00baad1a', color: '#00baad' },
3: { label: '二手车', bg: '#fe624b1a', color: '#fe624b' },
4: { label: '其他', bg: '#ff9d2e1a', color: '#ff9d2e' }
}
export default {
mixins: [popupmixin],
name: 'SceneList',
inject: ['userInfo'],
data () {
return {
}
},
computed: {
idKey () {
let { params: { idKey }, sceneType } = this
return Array.isArray(idKey) ? idKey[sceneType] : idKey
},
sceneTag () {
const n = Number(this.sceneType)
const key = n >= 0 && n <= 4 ? n : 4
return SCENE_TYPE_TAG_MAP[key] || SCENE_TYPE_TAG_MAP[4]
}
},
mounted () {
},
methods: {
async getList (searchValue, search) {
const { userInfo, params } = this,
{ cacheData } = params
this.currentId = ''
if (!search && cacheData && cacheData.length) {
this.initData(cacheData)
if (searchValue) this.handleSearch(searchValue)
return
}
this.componentLoading(params)
const { shopMerchantId, sceneType, merchantId } = userInfo,
apiTargetName = sceneType == 1 || params.defeat ? 'getEmployeeList' : 'getOrderScreenEmployeeList',
apiParams = {
merchantId: params.idKey == 'sellerUserId' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'sellerUserId' ? '' : [sceneType],
}
if (searchValue) apiParams.name = searchValue
const data = await uni.$api.popupApi[apiTargetName](apiParams)
this.updateParams(params, data || [])
},
initData (list) {
const { idKey, data } = this
if (data[idKey]) {
this.currentId = data[idKey]
let item = list.find(i => i.uuid == this.currentId)
console.log(item)
this.$emit('choose', item)
}
this.list = list
this.$emit('onComplete')
},
handleSearch (searchValue) {
const { sceneType } = this
if (sceneType == 1) {
this.list = []
this.getList(searchValue, true)
} else this.originalDataSearch(searchValue)
},
originalDataSearch (searchValue) {
console.log(searchValue, '===')
if (!searchValue) this.searchStatus = false
else {
searchValue = searchValue.toUpperCase()
let { list } = this,
employeeList = JSON.parse(JSON.stringify(list)),
arr = []
employeeList.map(e => {
if (e.staffName && e.staffName.toUpperCase().indexOf(searchValue) != -1) arr.push(e)
})
this.searchList = arr
this.searchStatus = true
}
},
choose (i) {
let { idKey, data } = this,
userId = data.deliveryUserId,
referrerId = data.deliveryId,
deliveryUserId = data.userId,
deliveryId = data.referrerId,
value = {
userId,
deliveryUserId,
referrerId,
deliveryId
}[idKey]
if (['referrerId', 'userId', 'deliveryId', 'deliveryUserId'].includes(idKey) && value == i.uuid) return uni.showToast({
title: '销售顾问/录单员与交付专员不能选取同一人',
icon: 'none',
mask: true
})
this.currentId = i.uuid
this.$emit('choose', i)
},
checkActive (i) {
let { currentId, idKey, data } = this
return currentId ? i.uuid == currentId : i.uuid == data[idKey]
}
}
}
</script>
<style scoped lang="scss">
.scene-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
align-items: center;
justify-content: start;
height: toRpx(144);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
padding: 0 toRpx(32);
box-sizing: border-box;
.scene-type-tag {
flex-shrink: 0;
margin-right: toRpx(16);
height: toRpx(48);
line-height: toRpx(48);
padding: 0 toRpx(12);
border-radius: toRpx(12);
font-size: toRpx(24);
font-weight: 500;
box-sizing: border-box;
}
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
......@@ -390,6 +390,16 @@ const componentConfig = {
loadComplete: false,
searchValue: '',
noData: false
}
},
29: {
name: 'SceneList',
title: '场景名称',
hideSearch: true,
idKey: 'senceCode',
cacheData: [],
loadComplete: false,
searchValue: '',
noData: false
},
}
export default { componentConfig }
......@@ -52,6 +52,7 @@ import Options from './components/Options.vue'
import CarBrand from './components/CarBrand.vue'
import Gearbox from './components/Gearbox.vue'
import OrderTypePopup from './components/OrderTypePopup.vue'
import SceneList from './components/SceneList.vue'
export default {
components: {
......@@ -75,7 +76,8 @@ export default {
Options,
CarBrand,
Gearbox,
OrderTypePopup
OrderTypePopup,
SceneList
},
name: '',
props: {
......
<template>
<view class="employee-list">
<view @click="currentIds = []" :class="['item flex', { active: !currentIds.length }]">
<view class="sprite-icon icon-tag-checked"></view>
全部
</view>
<template v-for="(i, index) in list">
<view :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
<view class="sprite-icon icon-tag-checked"></view>
{{ i.staffName }}
</view>
</template>
</view>
</template>
<script type="text/ecmascript-6">
export default {
name: 'EmployeeList',
inject: ['userInfo'],
data () {
return {
list: [],
currentIds: []
}
},
props: {
params: Object,
data: [Array, Object],
},
watch: {
currentIds: {
handler (val) {
let { params: { idKey } } = this
this.$emit('choose', {
key: idKey,
value: val.length ? val : null
})
},
deep: true
}
},
mounted () {
this.getList()
},
methods: {
async getList () {
const { userInfo, params } = this,
{ cacheData } = params
if (cacheData && cacheData.length) {
this.initList(cacheData)
return
}
const { shopMerchantId, sceneType, merchantId } = userInfo,
data = await uni.$api.popupApi.getOrderScreenEmployeeList({
merchantId: params.idKey == 'transferIds' ? merchantId : shopMerchantId,
sceneList: params.idKey == 'transferIds' ? '' : [sceneType]
})
if (data && data.length) {
this.initList(data)
params.cacheData = data
this.$emit('update:params', params)
}
},
initList (list) {
let { data, params: {idKey} } = this
this.list = list
let paramsData = idKey ? data[idKey] : data
if (paramsData && paramsData.length) paramsData.map(e => {
this.currentIds.push(e)
})
this.$emit('onComplete')
},
choose (i) {
if (i) {
let { uuid } = i,
{ currentIds } = this,
index = currentIds.indexOf(uuid)
if (index == -1) this.currentIds.push(uuid)
else this.currentIds.splice(index, 1)
}
},
checkActive (i) {
let { currentIds } = this,
active = false
if (currentIds.length) active = currentIds.includes(i.uuid)
return active
// return this.currentIds.includes(i.uuid)
},
}
}
</script>
<style scoped lang="scss">
.employee-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: toRpx(32);
margin: 0 toRpx(48);
.item {
justify-content: center;
height: toRpx(72);
border-radius: toRpx(8);
border: toRpx(2) solid #dce0e6;
box-sizing: border-box;
position: relative;
color: #333333;
font-size: toRpx(32);
.sprite-icon {
display: none;
position: absolute;
top: 0;
right: 0;
}
}
.active {
border-color: #2c66f7;
background: #ecf1ff;
color: #2c66f7;
.sprite-icon {
display: block;
}
}
}
</style>
\ No newline at end of file
const screenList = [
{
title: '场景名称',
componentName: 'SceneList',
params: {
cacheData: [],
idKey: 'senceCode'
},
hasToggle: true,
toggle: false
},
{
title: '转化人员',
suffix: 'merchantName',
componentName: 'EmployeeList',
......
......@@ -32,6 +32,7 @@
import Popup from '@/components/Popup.vue'
import config from './config'
import EmployeeList from './components/EmployeeList.vue'
import SceneList from './components/SceneList.vue'
import TimeList from './components/TimeList.vue'
import OrderStatusList from './components/OrderStatusList.vue'
import PayList from './components/PayList.vue'
......@@ -47,7 +48,8 @@ export default {
PayList,
CourseOptionList,
ContractList,
ErrorOrderList
ErrorOrderList,
SceneList
},
name: 'OrderScreen',
props: {
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 3
const index = 2
/**
*
0本地
......
......@@ -510,7 +510,8 @@ export default {
this.popupTitle = {
0: pointsMultiRole == 'Y' ? '销售顾问/录单员' : '推荐人',
4: '车型',
13: payType == 2 ? '4S店收款时间' : '嘀加收款时间'
13: payType == 2 ? '4S店收款时间' : '嘀加收款时间',
29:'确认业务场景名称'
}[this.popupType]
// 确保 orderPopup 引用存在后再调用 open 方法
if (this.$refs.orderPopup && this.$refs.orderPopup.open) {
......
......@@ -44,6 +44,12 @@
</view>
<view class="order-list align-center">
<view class="order flex align-center">
<view class="order-label">场景名称</view>
<view class="order-value flex">{{ goodsOrderApplyStatus[orderCardDetail.approveStatus] || '-' }}</view>
</view>
</view>
<view class="order-list align-center">
<view class="order flex align-center">
<view class="order-label">审批状态</view>
<view class="order-value flex">{{ goodsOrderApplyStatus[orderCardDetail.approveStatus] || '-' }}</view>
</view>
......
const FORM_LIST = [
[
{
label: '场景名称',
value: 'senceCode',
type: 'select',
key: 'senceCode',
required: true
},
{
label: '销售顾问/录单员',
value: 'referrer',
type: 'select',
......@@ -407,6 +414,11 @@ const popupTypeEnum = {
// 订单类型弹窗(OrderTypePopup)
key: 'djOrderType',
list: ''
},
29: {
// 场景名称弹窗(SceneList)
key: 'senceCode',
list: 'sceneList'
}
}
const titleList = [null, { addHtml: 'customer' }, { name: '车辆信息' }, { name: '增值车损险' }, { name: '其他信息' }]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!