Commit d1d4fe2e by 岑成威

feat:场景选择新增

1 parent cdc53c63
Showing 42 changed files with 1005 additions and 56 deletions
...@@ -540,6 +540,10 @@ module.exports = { ...@@ -540,6 +540,10 @@ module.exports = {
getSceneMarketConfig() { getSceneMarketConfig() {
return api.getMock("glsk-oss-config"); return api.getMock("glsk-oss-config");
}, },
/** 获取用户场景列表 */
getUserScene(data) {
return api.post("dj.api.smartcarlife.scene.config.getUserScene", data);
},
fetchApiConfig(bucketName, systemSource = "dj") { fetchApiConfig(bucketName, systemSource = "dj") {
return api.post( return api.post(
"dj.api.script.common.aliyun.oss.acs.sts.credentials/1.0.0?bucketName=" + "dj.api.script.common.aliyun.oss.acs.sts.credentials/1.0.0?bucketName=" +
......
...@@ -238,6 +238,7 @@ Component({ ...@@ -238,6 +238,7 @@ Component({
// wx.$util.showToast(message) // wx.$util.showToast(message)
// } // }
}) })
this.getSceneList()
this.setOrderStatusList() this.setOrderStatusList()
this.setInviteStatusList() this.setInviteStatusList()
}, },
...@@ -415,6 +416,43 @@ Component({ ...@@ -415,6 +416,43 @@ Component({
}) })
} }
}, },
getSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', staffName: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', staffName: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', staffName: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', staffName: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', staffName: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', staffName: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', staffName: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', staffName: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
let userInfo = wx.$util.getUserInfo()
api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
}).then(res => {
let { code, data } = res
let list = (code == 0 && data && data.length) ? data : MOCK_SCENE_LIST
this.setData({
['form.sceneList.data']: [
{ staffName: '全部', active: true, value: '' },
...list.map(e => ({
...e,
staffName: e.name || e.staffName,
value: e.baseSceneCode
}))
]
})
}).catch(() => {
this.setData({
['form.sceneList.data']: [
{ staffName: '全部', active: true, value: '' },
...MOCK_SCENE_LIST.map(e => ({ ...e, value: e.baseSceneCode }))
]
})
})
},
getGoodsTypeList() { getGoodsTypeList() {
api.getGoodsTypeList().then(res => { api.getGoodsTypeList().then(res => {
let { code, data, message } = res let { code, data, message } = res
......
...@@ -42,6 +42,23 @@ ...@@ -42,6 +42,23 @@
</block> </block>
</view> </view>
</view> </view>
<view class="box">
<view class="title">
场景名称
</view>
<view class="list-box">
<block wx:for="{{form.sceneList.data}}" wx:key="index">
<view
class="item text-center {{item.active?'active':''}}"
bindtap="choose"
data-list-name="sceneList"
data-index="{{index}}"
>
{{item.staffName}}
</view>
</block>
</view>
</view>
<block wx:if="{{type == 1}}"> <block wx:if="{{type == 1}}">
<view class="box"> <view class="box">
<view class="title"> <view class="title">
......
...@@ -48,6 +48,10 @@ module.exports = { ...@@ -48,6 +48,10 @@ module.exports = {
type: 'array', type: 'array',
dateKey: 'inviteStatus' dateKey: 'inviteStatus'
}, },
sceneList: {
data: [],
key: 'baseSceneCode',
type: 'array'
},
}, },
} }
\ No newline at end of file \ No newline at end of file
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
range-key="{{item.optionLabel}}"> range-key="{{item.optionLabel}}">
<view class="picker"> <view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" /> <image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}"> <view class="text-hide" wx:if="{{filterUtils.hasValue(formData, item.labelName)}}">
{{formData[item.labelName]}} {{formData[item.labelName]}}
</view> </view>
<text class="placeholder" wx:else>点击选择</text> <text class="placeholder" wx:else>点击选择</text>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<block wx:if="{{item.type == 'region'}}"> <block wx:if="{{item.type == 'region'}}">
<view class="picker" bindtap="showAreaFun"> <view class="picker" bindtap="showAreaFun">
<image class="arrow" src="/components/images/arrow-x.png" /> <image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}"> <view class="text-hide" wx:if="{{filterUtils.hasValue(formData, item.labelName)}}">
{{formData[item.labelName]}} {{formData[item.labelName]}}
</view> </view>
<text class="placeholder" wx:else>点击选择</text> <text class="placeholder" wx:else>点击选择</text>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
bindchange="handleTimeChange" bindchange="handleTimeChange"
data-target="{{item}}"> data-target="{{item}}">
<view class="picker"> <view class="picker">
<view class="text-hide" wx:if="{{formData[item.name]}}">{{formData[item.name]}}</view> <view class="text-hide" wx:if="{{filterUtils.hasValue(formData, item.name)}}">{{formData[item.name]}}</view>
<text class="placeholder" wx:else>点击选择</text> <text class="placeholder" wx:else>点击选择</text>
</view> </view>
</picker> </picker>
......
...@@ -14,6 +14,14 @@ var isShowFn = function (formData, targetItem) { ...@@ -14,6 +14,14 @@ var isShowFn = function (formData, targetItem) {
return flag return flag
} }
// Treat only null/undefined/'' as empty. (0 should be considered a valid value.)
var hasValue = function (obj, key) {
if (!obj) return false
var v = obj[key]
return !(v === undefined || v === null || v === '')
}
module.exports = { module.exports = {
isShowFn: isShowFn isShowFn: isShowFn,
hasValue: hasValue
} }
\ No newline at end of file \ No newline at end of file
...@@ -182,7 +182,7 @@ Component({ ...@@ -182,7 +182,7 @@ Component({
// let orderSellerInfo = util.getSellerInfo() // let orderSellerInfo = util.getSellerInfo()
// 获取上一个订单的销售顾问信息 并且不是再次下单 // 获取上一个订单的销售顾问信息 并且不是再次下单
let result = await api.getLastUserOrderInfo({ let result = await api.getLastUserOrderInfo({
sellerUserId: userInfo.subLoginUser.uuid, sellerUserId: userInfo?.subLoginUser?.uuid || userInfo?.uuid,
}); });
if ( if (
result.data && result.data &&
...@@ -516,11 +516,20 @@ Component({ ...@@ -516,11 +516,20 @@ Component({
// let userInfo = util.getUserInfo() // let userInfo = util.getUserInfo()
// // 保存销售勾选做回显 // // 保存销售勾选做回显
// oderType != 'recorder' && util.setSellerInfo({ ...this.data.orderObj, subLoginMechantId: userInfo.subLoginUser.merchantId }) // oderType != 'recorder' && util.setSellerInfo({ ...this.data.orderObj, subLoginMechantId: userInfo.subLoginUser.merchantId })
const hasSceneSelected =
orderObj.baseSceneCode !== undefined &&
orderObj.baseSceneCode !== null &&
orderObj.baseSceneCode !== '';
const hasSceneType =
orderObj.sceneType !== undefined &&
orderObj.sceneType !== null &&
orderObj.sceneType !== '';
if (type == 1 && hasSceneSelected && hasSceneType) {
thisPage.getOrderBaseGoodsList && thisPage.getOrderBaseGoodsList &&
thisPage.getOrderBaseGoodsList(orderObj.merchantId); thisPage.getOrderBaseGoodsList(orderObj.merchantId, orderObj.sceneType);
thisPage.getSelectOrderGoodsList && thisPage.getSelectOrderGoodsList &&
thisPage.getSelectOrderGoodsList(orderObj.merchantId); thisPage.getSelectOrderGoodsList(orderObj.merchantId, orderObj.sceneType);
}
if (type != 3) { if (type != 3) {
delete orderObj.couponName; delete orderObj.couponName;
......
// components/SideSelectPopup/SideSelectPopup.js // components/SideSelectPopup/SideSelectPopup.js
import api from '~/api/api' import api from '~/api/api'
import sceneData from '~/pages/constant/data'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat' const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat'
const SCENE_NAME_MAP = (sceneData?.sceneList || []).reduce((acc, cur) => {
if (cur && cur.sceneType != null) acc[cur.sceneType] = cur.sceneName
return acc
}, {})
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -150,6 +156,11 @@ Component({ ...@@ -150,6 +156,11 @@ Component({
searchEvent(isReset = false) { searchEvent(isReset = false) {
let { searchValue, selectedMerchantId, searchSelectIndex, pageNum, nothing } = this.data let { searchValue, selectedMerchantId, searchSelectIndex, pageNum, nothing } = this.data
let userInfo = wx.$util.getUserInfo() let userInfo = wx.$util.getUserInfo()
const sceneName =
SCENE_NAME_MAP?.[userInfo?.sceneType] ||
userInfo?.sceneName ||
userInfo?.sceneTypeName ||
''
this.setData({ this.setData({
customSearchFlag: false customSearchFlag: false
}) })
...@@ -173,7 +184,12 @@ Component({ ...@@ -173,7 +184,12 @@ Component({
} }
} }
tempList = this.uniqueByProperty(tempList, 'merchantId') tempList = this.uniqueByProperty(tempList, 'merchantId')
tempList.forEach(v => v.actived = (userInfo?.shopMerchantId === v.merchantId) || (!userInfo?.shopMerchantId && !v.merchantId)) tempList.forEach(v => {
v.actived =
(userInfo?.shopMerchantId === v.merchantId) ||
(!userInfo?.shopMerchantId && !v.merchantId)
v.sceneName = v.sceneName || sceneName
})
this.setData({ this.setData({
storeRangeList: tempList, storeRangeList: tempList,
pageNum: pageNum + 1, pageNum: pageNum + 1,
...@@ -198,6 +214,7 @@ Component({ ...@@ -198,6 +214,7 @@ Component({
val.listStatus = val.upgradeFlag == 'Y' ? 1 : val.upgradeFlag == 'N' ? 2 : (!val.upgradeFlag && val.status == 1) ? 0 : (!val.upgradeFlag && val.status == 2) ? 3 : '' val.listStatus = val.upgradeFlag == 'Y' ? 1 : val.upgradeFlag == 'N' ? 2 : (!val.upgradeFlag && val.status == 1) ? 0 : (!val.upgradeFlag && val.status == 2) ? 3 : ''
val.merchantId = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantId : val.merchantId val.merchantId = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantId : val.merchantId
val.merchantName = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantName : val.merchantName val.merchantName = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantName : val.merchantName
val.sceneName = val.sceneName || sceneName
}) })
let tempList = isReset ? data?.list : this.data.customStoreList.concat(data?.list) let tempList = isReset ? data?.list : this.data.customStoreList.concat(data?.list)
this.setData({ this.setData({
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
</view> </view>
<view class="text_box"> <view class="text_box">
<view class="label">{{item.merchantName}}</view> <view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view> <view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view> </view>
</view> </view>
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
<view class="status_text status_text_{{item.listStatus}}">{{statusText[item.listStatus]}}</view> <view class="status_text status_text_{{item.listStatus}}">{{statusText[item.listStatus]}}</view>
</view> </view>
<view class="label">{{item.merchantName}}</view> <view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view> <view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view> </view>
</view> </view>
......
...@@ -324,6 +324,12 @@ ...@@ -324,6 +324,12 @@
margin-top: var(--fontSize16); margin-top: var(--fontSize16);
} }
.scene_label{
font-size: var(--fontSize24);
color: #999EA8;
margin-top: var(--fontSize8);
}
.wrapper .custom_element .text_box .label{ .wrapper .custom_element .text_box .label{
font-size: var(--fontSize24); font-size: var(--fontSize24);
color: #999EA8; color: #999EA8;
......
// components/SideSelectPopup/SideSelectPopup.js // components/SideSelectPopup/SideSelectPopup.js
import api from '~/api/api' import api from '~/api/api'
import sceneData from '~/pages/constant/data'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat' const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat'
const SCENE_NAME_MAP = (sceneData?.sceneList || []).reduce((acc, cur) => {
if (cur && cur.sceneType != null) acc[cur.sceneType] = cur.sceneName
return acc
}, {})
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -13,9 +19,15 @@ Component({ ...@@ -13,9 +19,15 @@ Component({
if (n) { if (n) {
let userInfo = wx.$util.getUserInfo() || {} let userInfo = wx.$util.getUserInfo() || {}
let { storeList, subIndex } = this.data let { storeList, subIndex } = this.data
const sceneName =
SCENE_NAME_MAP?.[userInfo?.sceneType] ||
userInfo?.sceneName ||
userInfo?.sceneTypeName ||
''
storeList?.map((val, index) => { storeList?.map((val, index) => {
val.actived = false val.actived = false
val.index = index val.index = index
val.sceneName = val.sceneName || sceneName
if (userInfo?.sceneType == 1) { if (userInfo?.sceneType == 1) {
// 切换园区店 // 切换园区店
// if (userInfo?.isSuper && index == subIndex) val.actived = true // if (userInfo?.isSuper && index == subIndex) val.actived = true
...@@ -162,6 +174,11 @@ Component({ ...@@ -162,6 +174,11 @@ Component({
searchEvent(isReset = false) { searchEvent(isReset = false) {
let { searchValue, selectedMerchantId, searchSelectIndex, pageNum, nothing } = this.data let { searchValue, selectedMerchantId, searchSelectIndex, pageNum, nothing } = this.data
let userInfo = wx.$util.getUserInfo() let userInfo = wx.$util.getUserInfo()
const sceneName =
SCENE_NAME_MAP?.[userInfo?.sceneType] ||
userInfo?.sceneName ||
userInfo?.sceneTypeName ||
''
let { storeList } = wx.$util.deepClone(this.data) let { storeList } = wx.$util.deepClone(this.data)
this.setData({ this.setData({
customSearchFlag: false customSearchFlag: false
...@@ -171,6 +188,7 @@ Component({ ...@@ -171,6 +188,7 @@ Component({
storeList.map(i => { storeList.map(i => {
i.active = false i.active = false
if (i.merchantId == selectedMerchantId) i.active = true if (i.merchantId == selectedMerchantId) i.active = true
i.sceneName = i.sceneName || sceneName
return i return i
}) })
// let newArray = storeList.slice(0, 20) // let newArray = storeList.slice(0, 20)
...@@ -182,6 +200,7 @@ Component({ ...@@ -182,6 +200,7 @@ Component({
storeList.map(i => { storeList.map(i => {
i.active = false i.active = false
if (i.merchantId == selectedMerchantId) i.active = true if (i.merchantId == selectedMerchantId) i.active = true
i.sceneName = i.sceneName || sceneName
if (i.merchantName.indexOf(searchValue) != -1 || i.merchantId == searchValue) { if (i.merchantName.indexOf(searchValue) != -1 || i.merchantId == searchValue) {
arr.push(i) arr.push(i)
} }
...@@ -210,6 +229,7 @@ Component({ ...@@ -210,6 +229,7 @@ Component({
val.listStatus = val.upgradeFlag == 'Y' ? 1 : val.upgradeFlag == 'N' ? 2 : (!val.upgradeFlag && val.status == 1) ? 0 : (!val.upgradeFlag && val.status == 2) ? 3 : '' val.listStatus = val.upgradeFlag == 'Y' ? 1 : val.upgradeFlag == 'N' ? 2 : (!val.upgradeFlag && val.status == 1) ? 0 : (!val.upgradeFlag && val.status == 2) ? 3 : ''
val.merchantId = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantId : val.merchantId val.merchantId = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantId : val.merchantId
val.merchantName = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantName : val.merchantName val.merchantName = wx.$hasPermission?.isSuper?.(userInfo) ? val.sellerMerchantName : val.merchantName
val.sceneName = val.sceneName || sceneName
}) })
let tempList = isReset ? data?.list : this.data.customStoreList.concat(data?.list) let tempList = isReset ? data?.list : this.data.customStoreList.concat(data?.list)
this.setData({ this.setData({
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<view><image src="{{IMG_URL}}/store_icon_nobg.png"></image></view> <view><image src="{{IMG_URL}}/store_icon_nobg.png"></image></view>
<view class="text_box"> <view class="text_box">
<view class="label">{{item.merchantName}}</view> <view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view> <view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view> </view>
</view> </view>
...@@ -81,6 +82,7 @@ ...@@ -81,6 +82,7 @@
<view class="status_text status_text_{{item.listStatus}}">{{statusText[item.listStatus]}}</view> <view class="status_text status_text_{{item.listStatus}}">{{statusText[item.listStatus]}}</view>
</view> </view>
<view class="label">{{item.merchantName}}</view> <view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
<view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view> <view class="label_no" wx:if="{{item.merchantId}}">商户号:{{item.merchantId}}</view>
</view> </view>
</view> </view>
......
...@@ -324,6 +324,12 @@ ...@@ -324,6 +324,12 @@
margin-top: var(--fontSize16); margin-top: var(--fontSize16);
} }
.scene_label{
font-size: var(--fontSize24);
color: #999EA8;
margin-top: var(--fontSize8);
}
.wrapper .custom_element .text_box .label{ .wrapper .custom_element .text_box .label{
font-size: var(--fontSize24); font-size: var(--fontSize24);
color: #999EA8; color: #999EA8;
......
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
...@@ -92,13 +92,16 @@ Component({ ...@@ -92,13 +92,16 @@ Component({
cancelName: '存草稿' cancelName: '存草稿'
}, },
vinValid: true, vinValid: true,
createAllGoodsFlag: 1 createAllGoodsFlag: 1,
showSceneSelect: false,
sceneColumns: []
}, },
lifetimes: { lifetimes: {
attached() { attached() {
this.getEmployee() this.getEmployee()
this.getShopMerchantPointConfig() this.getShopMerchantPointConfig()
this.getUserSceneList()
// 没有才走获取档案接口逻辑修改配置,有是必填优先及更高 // 没有才走获取档案接口逻辑修改配置,有是必填优先及更高
// 在createOrderCarQuotationSimple 页面做逻辑判断 // 在createOrderCarQuotationSimple 页面做逻辑判断
// this.getYqStoreConfig() // this.getYqStoreConfig()
...@@ -110,6 +113,62 @@ Component({ ...@@ -110,6 +113,62 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
getUserSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
const userInfo = wx.$util.getUserInfo() || {}
commonApi
.getUserScene({
sceneType: String(userInfo.sceneType ?? ''),
phone: userInfo.phone
})
.then(res => {
const list = res?.code == 0 && res?.data?.length ? res.data : MOCK_SCENE_LIST
this.setData({
sceneColumns: list.map(item => ({
...item,
name: item.name || item.staffName
}))
})
})
.catch(() => {
this.setData({
sceneColumns: MOCK_SCENE_LIST
})
})
},
onCloseSceneSelect() {
this.setData({
showSceneSelect: false
})
},
onConfirmSceneSelect(e) {
const scene = e.detail.value || {}
const thisPage = wx.$router.getPageInstance()
thisPage.setData({
'orderInfo.baseSceneCode': scene.baseSceneCode || '',
'orderInfo.baseSceneName': scene.name || scene.staffName || ''
})
// 切换场景后,重新按场景拉取可选商品
thisPage.resetGoods && thisPage.resetGoods()
this.setData({
showSceneSelect: false
})
},
handleScenePicker() {
this.getUserSceneList()
this.setData({
showSceneSelect: true
})
},
getShopMerchantPointConfig() { getShopMerchantPointConfig() {
console.log(1111111111) console.log(1111111111)
let { userInfo } = this.data let { userInfo } = this.data
...@@ -272,6 +331,10 @@ Component({ ...@@ -272,6 +331,10 @@ Component({
wx.$util.showToast(pointsMultiRole=='Y'?'请选择销售顾问/录单员':'请选择推荐人') wx.$util.showToast(pointsMultiRole=='Y'?'请选择销售顾问/录单员':'请选择推荐人')
return false return false
} }
if (!thisPage.data['orderInfo']['baseSceneCode']) {
wx.$util.showToast('请选择场景名称')
return false
}
if(pointsMultiRole=='Y'){ if(pointsMultiRole=='Y'){
if (!thisPage.data['orderInfo']['deliveryId']) { if (!thisPage.data['orderInfo']['deliveryId']) {
wx.$util.showToast('请选择交付专员') wx.$util.showToast('请选择交付专员')
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
"Gl-Button-Group": "../../../../components/GlButtonGroup/GlButtonGroup", "Gl-Button-Group": "../../../../components/GlButtonGroup/GlButtonGroup",
"store-referrer-picker": "../storeReferrerPicker/storeReferrerPicker", "store-referrer-picker": "../storeReferrerPicker/storeReferrerPicker",
"customerInfo": "/components/CustomerInfo/CustomerInfo", "customerInfo": "/components/CustomerInfo/CustomerInfo",
"car-brands": "/components/CarBrands/CarBrands" "car-brands": "/components/CarBrands/CarBrands",
"van-popup": "/miniprogram_npm/@vant/weapp/popup/index",
"van-picker": "/miniprogram_npm/@vant/weapp/picker/index"
} }
} }
...@@ -24,6 +24,13 @@ ...@@ -24,6 +24,13 @@
<!-- </picker> --> <!-- </picker> -->
</gl-cell> </gl-cell>
</block> </block>
<gl-cell border valueAlign="right" label="场景名称" class="pickerCell" required="{{true}}" requiredAfter="{{true}}" labelWidth="{{defaultLabelWidth}}">
<view class="picker" bindtap="handleScenePicker">
<image class="pickerArrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{orderInfo.baseSceneCode }}">{{orderInfo.baseSceneName }}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</gl-cell>
</view> </view>
<view class="box"> <view class="box">
...@@ -73,3 +80,13 @@ ...@@ -73,3 +80,13 @@
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" apiType="2" /> <customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" apiType="2" />
<car-brands show="{{ carBrandBox }}" bindconfirm="chooseCar" carSeriesId="{{ serviceInfo.carSeriesId || '' }}" equityFlag="true" merchantId="{{ userInfo.default4SStoreInfo.merchantId || undefined }}" /> <car-brands show="{{ carBrandBox }}" bindconfirm="chooseCar" carSeriesId="{{ serviceInfo.carSeriesId || '' }}" equityFlag="true" merchantId="{{ userInfo.default4SStoreInfo.merchantId || undefined }}" />
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
<van-picker
show-toolbar
title="场景名称"
bind:cancel="onCloseSceneSelect"
columns="{{ sceneColumns }}"
value-key="name"
bind:confirm="onConfirmSceneSelect"
/>
</van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -265,6 +265,46 @@ Component({ ...@@ -265,6 +265,46 @@ Component({
this.getsellerUserIdList(userInfo?.merchantId, 0) this.getsellerUserIdList(userInfo?.merchantId, 0)
this.getsellerUserIdList(userInfo?.shopMerchantId, 1) this.getsellerUserIdList(userInfo?.shopMerchantId, 1)
}, },
getSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', staffName: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', staffName: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', staffName: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', staffName: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', staffName: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', staffName: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', staffName: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', staffName: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
let userInfo = wx.$util.getUserInfo() || {}
api
.getUserScene({
sceneType: String(userInfo.sceneType ?? ''),
phone: userInfo.phone
})
.then(res => {
let { code, data } = res
let list = code == 0 && data?.length ? data : MOCK_SCENE_LIST
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...list.map(item => ({
...item,
staffName: item.name || item.staffName,
value: item.baseSceneCode
}))
]
})
})
.catch(() => {
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...MOCK_SCENE_LIST.map(item => ({ ...item, value: item.baseSceneCode }))
]
})
})
},
init() { init() {
let { orderTimeList, payTimeList, abnormalList } = this.data let { orderTimeList, payTimeList, abnormalList } = this.data
let payArr = [ let payArr = [
...@@ -281,6 +321,7 @@ Component({ ...@@ -281,6 +321,7 @@ Component({
['form.payTimeList']: wx.$util.deepClone(payTimeList), ['form.payTimeList']: wx.$util.deepClone(payTimeList),
['form.abnormalFlag']: wx.$util.deepClone(abnormalList) ['form.abnormalFlag']: wx.$util.deepClone(abnormalList)
}) })
this.getSceneList()
}, },
showMore(e) { showMore(e) {
let { type } = e.currentTarget.dataset let { type } = e.currentTarget.dataset
...@@ -532,7 +573,11 @@ Component({ ...@@ -532,7 +573,11 @@ Component({
value, value,
merchantId merchantId
} = i } = i
if (e != 'orderTimeList' && e != 'payTimeList') obj[e] = value if (e === 'sceneList') {
if (value) obj['baseSceneCode'] = value
} else if (e != 'orderTimeList' && e != 'payTimeList') {
obj[e] = value
}
// 订单时间 // 订单时间
if (orderStartDate && orderEndDate) { if (orderStartDate && orderEndDate) {
obj.minCreateTime = `${orderStartDate} 00:00:00` obj.minCreateTime = `${orderStartDate} 00:00:00`
......
...@@ -7,6 +7,19 @@ ...@@ -7,6 +7,19 @@
hidden="{{ !show }}" hidden="{{ !show }}"
> >
<view class="main" style="padding-bottom:{{ btnHeight }}px"> <view class="main" style="padding-bottom:{{ btnHeight }}px">
<view class="box">
<view class="title">场景名称</view>
<view class="list-box">
<block wx:for="{{ form.sceneList }}" wx:key="index">
<view
class="item text-center {{ item.active?'active':'' }}"
bindtap="choose"
data-list-name="sceneList"
data-index="{{ index }}"
>{{item.staffName}}</view>
</block>
</view>
</view>
<!-- 非超管转化人员 --> <!-- 非超管转化人员 -->
<view <view
class="box" class="box"
......
...@@ -103,11 +103,15 @@ const ageList = [ ...@@ -103,11 +103,15 @@ const ageList = [
const salesTypeList = [ const salesTypeList = [
{ {
optionId: 0, optionId: 0,
optionLabel: '售前' optionLabel: '门店引流-售前'
}, },
{ {
optionId: 1, optionId: 1,
optionLabel: '售后' optionLabel: '门店引流-售后'
},
{
optionId: 2,
optionLabel: '自然到店'
} }
] ]
export default { export default {
......
...@@ -175,7 +175,7 @@ const firstObj = { ...@@ -175,7 +175,7 @@ const firstObj = {
{ {
label: "客户来源", label: "客户来源",
name: "salesType", name: "salesType",
labelName: "salesType", labelName: "salesTypeLabel",
type: "select", type: "select",
optionList: constantList.salesTypeList, optionList: constantList.salesTypeList,
optionId: "optionId", optionId: "optionId",
...@@ -307,7 +307,7 @@ const firstObjSimple = { ...@@ -307,7 +307,7 @@ const firstObjSimple = {
{ {
label: "客户来源", label: "客户来源",
name: "salesType", name: "salesType",
labelName: "salesType", labelName: "salesTypeLabel",
type: "select", type: "select",
optionList: constantList.salesTypeList, optionList: constantList.salesTypeList,
optionId: "optionId", optionId: "optionId",
......
...@@ -24,6 +24,7 @@ import { ...@@ -24,6 +24,7 @@ import {
checkAbnormalOrder, checkAbnormalOrder,
} from "~/store/ModalToQueueControl"; } from "~/store/ModalToQueueControl";
import dataForm from "../components/constant/stepData"; import dataForm from "../components/constant/stepData";
import constantList from "../components/constant/constantList";
import NP from "number-precision"; import NP from "number-precision";
import { getProductStrategy, DISCOUNT_TYPE } from "./productStrategy"; import { getProductStrategy, DISCOUNT_TYPE } from "./productStrategy";
Page({ Page({
...@@ -62,7 +63,7 @@ Page({ ...@@ -62,7 +63,7 @@ Page({
carChildsBrandName: "", carChildsBrandName: "",
carSeriesId: "", carSeriesId: "",
carSeriesName: "", carSeriesName: "",
salesType: "售前", salesType: 0,
}, },
mode: 1, mode: 1,
quotationGoodsList: [], //权益商品列表 quotationGoodsList: [], //权益商品列表
...@@ -298,7 +299,6 @@ Page({ ...@@ -298,7 +299,6 @@ Page({
let { outTradeNo, userInfo } = this.data; let { outTradeNo, userInfo } = this.data;
let orderInfo = this.getInsurance(); let orderInfo = this.getInsurance();
let owner = this.getOwnerInfo(); let owner = this.getOwnerInfo();
owner.salesType = owner.salesType == "售后" ? 1 : 0;
orderInfo.owner = owner; orderInfo.owner = owner;
orderInfo.check = true; orderInfo.check = true;
orderInfo.outTradeNo = orderInfo.outTradeNo || outTradeNo; orderInfo.outTradeNo = orderInfo.outTradeNo || outTradeNo;
...@@ -915,7 +915,13 @@ Page({ ...@@ -915,7 +915,13 @@ Page({
parseFloat(owner?.price).toString() != "NaN" parseFloat(owner?.price).toString() != "NaN"
? this.multipliedByHundred(owner?.price) ? this.multipliedByHundred(owner?.price)
: ""; : "";
// orderInfo.owner = owner // 0:门店引流-售前 1:门店引流-售后 2:自然到店
let salesTypeNum = Number(owner.salesType);
if ([0, 1, 2].includes(salesTypeNum)) {
owner.salesType = salesTypeNum;
} else {
owner.salesType = 0;
}
if (owner) { if (owner) {
delete owner?.buyCarTime; delete owner?.buyCarTime;
} }
...@@ -926,7 +932,10 @@ Page({ ...@@ -926,7 +932,10 @@ Page({
let orderInfo = this.getInsurance(); let orderInfo = this.getInsurance();
let owner = this.getOwnerInfo(); let owner = this.getOwnerInfo();
let { userInfo } = this.data; let { userInfo } = this.data;
owner.salesType = owner.salesType == "售后" ? 1 : 0; // 0:门店引流-售前 1:门店引流-售后 2:自然到店
let salesTypeNum = Number(owner.salesType);
owner.salesType =
[0, 1, 2].includes(salesTypeNum) ? salesTypeNum : 0;
orderInfo.owner = owner; orderInfo.owner = owner;
orderInfo.check = check; orderInfo.check = check;
orderInfo.paymentDocList = orderInfo.paymentDocList || []; orderInfo.paymentDocList = orderInfo.paymentDocList || [];
...@@ -1206,8 +1215,20 @@ Page({ ...@@ -1206,8 +1215,20 @@ Page({
if (tableInfo.payType == 2) { if (tableInfo.payType == 2) {
tableInfo.payee = 1; tableInfo.payee = 1;
} }
tableInfo.owner.salesType = // 补齐客户来源展示文案:根据数值 salesType 生成 salesTypeLabel
tableInfo.owner.salesType == 1 ? "售后" : "售前"; if (
tableInfo.owner &&
tableInfo.owner.salesType !== undefined &&
tableInfo.owner.salesType !== null
) {
const salesTypeNum = Number(tableInfo.owner.salesType);
const match = constantList.salesTypeList.find(
(item) => item.optionId === salesTypeNum
);
if (match) {
tableInfo.owner.salesTypeLabel = match.optionLabel;
}
}
tableInfo.owner.ownerGender = tableInfo.owner.ownerGender =
tableInfo.owner.ownerGender || "男"; tableInfo.owner.ownerGender || "男";
this.setData({ this.setData({
...@@ -1400,6 +1421,7 @@ Page({ ...@@ -1400,6 +1421,7 @@ Page({
suitCarPrice: price ? parseFloat((price / 10000).toFixed(6)) : "", suitCarPrice: price ? parseFloat((price / 10000).toFixed(6)) : "",
seriesId: carSeriesId, seriesId: carSeriesId,
sceneType: 0, sceneType: 0,
baseSceneCode: orderInfo?.baseSceneCode || "",
}) })
.then((result) => { .then((result) => {
// debugger // debugger
...@@ -1765,10 +1787,10 @@ Page({ ...@@ -1765,10 +1787,10 @@ Page({
orderInfo.referrerId = customerInfo.salesUuid; orderInfo.referrerId = customerInfo.salesUuid;
orderInfo.referrer = customerInfo.salesName; orderInfo.referrer = customerInfo.salesName;
} }
if (customerInfo.salesType) { // 0:门店引流-售前 1:门店引流-售后 2:自然到店
owner.salesType = "售后"; let salesTypeNum = Number(customerInfo.salesType);
} else { if ([0, 1, 2].includes(salesTypeNum)) {
owner.salesType = "售前"; owner.salesType = salesTypeNum;
} }
this.setData({ this.setData({
owner, owner,
......
import { ImgUrl } from '~/config' import { ImgUrl } from '~/config'
import { quotationGoodsList, defeatOrderCreate } from '../../api' import { quotationGoodsList, defeatOrderCreate } from '../../api'
import commonApi from '~/api/api'
import NP from 'number-precision' import NP from 'number-precision'
import { checkStudyTask, checkAbnormalOrder } from '~/store/ModalToQueueControl' import { checkStudyTask, checkAbnormalOrder } from '~/store/ModalToQueueControl'
Page({ Page({
...@@ -55,13 +56,19 @@ Page({ ...@@ -55,13 +56,19 @@ Page({
saleTypesList: [ saleTypesList: [
{ {
type: 0, type: 0,
name: '售前' name: '门店引流-售前'
}, },
{ {
type: 1, type: 1,
name: '售后' name: '门店引流-售后'
},
{
type: 2,
name: '自然到店'
} }
] ],
showSceneSelect: false,
sceneColumns: []
}, },
/**设置日期 */ /**设置日期 */
setTimeList(dateNum) { setTimeList(dateNum) {
...@@ -102,6 +109,7 @@ Page({ ...@@ -102,6 +109,7 @@ Page({
this.setTimeList() this.setTimeList()
this.handlerUserInfo() this.handlerUserInfo()
this.getGoodsProduct() this.getGoodsProduct()
this.getUserSceneList()
}, },
onRoute(options) { onRoute(options) {
...@@ -131,10 +139,59 @@ Page({ ...@@ -131,10 +139,59 @@ Page({
}, },
showPopup(e) { showPopup(e) {
let { showName } = e.currentTarget.dataset let { showName } = e.currentTarget.dataset
if (showName === 'showSceneSelect') {
this.getUserSceneList()
}
this.setData({ this.setData({
[showName]: true [showName]: true
}) })
}, },
getUserSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {}
commonApi
.getUserScene({
sceneType: String(userInfo.sceneType ?? ''),
phone: userInfo.phone
})
.then(res => {
const list = res?.code == 0 && res?.data?.length ? res.data : MOCK_SCENE_LIST
this.setData({
sceneColumns: list.map(item => ({
...item,
name: item.name || item.staffName
}))
})
})
.catch(() => {
this.setData({
sceneColumns: MOCK_SCENE_LIST
})
})
},
onCloseSceneSelect() {
this.setData({
showSceneSelect: false
})
},
onConfirmSceneSelect(e) {
const scene = e.detail.value || {}
this.setData({
showSceneSelect: false,
'orderObj.baseSceneCode': scene.baseSceneCode || '',
'orderObj.baseSceneName': scene.name || scene.staffName || '',
'orderObj.sceneType': scene.sceneType
})
},
handlerUserInfo() { handlerUserInfo() {
let userInfo = wx.$util.getUserInfo() let userInfo = wx.$util.getUserInfo()
let { orderObj } = this.data let { orderObj } = this.data
...@@ -363,6 +420,7 @@ Page({ ...@@ -363,6 +420,7 @@ Page({
let params = this.defaultMsg, let params = this.defaultMsg,
{ customer, orderObj, deafeatReason, dateObj } = this.data { customer, orderObj, deafeatReason, dateObj } = this.data
if (!orderObj.employeeName) return this.showToast(`请选择推荐人员`) if (!orderObj.employeeName) return this.showToast(`请选择推荐人员`)
if (!orderObj.baseSceneCode) return this.showToast(`请选择场景名称`)
if (!customer.customerName) return this.showToast(`请输入车主姓名`) if (!customer.customerName) return this.showToast(`请输入车主姓名`)
if (!customer.customerPhone) return this.showToast(`请输入车主手机号`) if (!customer.customerPhone) return this.showToast(`请输入车主手机号`)
const phoneRex = /^[1]([3-9])[0-9]{9}$/ const phoneRex = /^[1]([3-9])[0-9]{9}$/
...@@ -376,6 +434,7 @@ Page({ ...@@ -376,6 +434,7 @@ Page({
params.owner.salesType = customer.salesType params.owner.salesType = customer.salesType
params.referrer = orderObj.employeeName params.referrer = orderObj.employeeName
params.referrerId = orderObj.userId params.referrerId = orderObj.userId
params.baseSceneCode = orderObj.baseSceneCode
params.remark = deafeatReason params.remark = deafeatReason
params.defeatOrderTime = dateObj.today + ' 00:00:00' params.defeatOrderTime = dateObj.today + ' 00:00:00'
resolve(params) resolve(params)
......
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
</view> </view>
</gl-cell> </gl-cell>
</view> </view>
<view class="cell">
<gl-cell border valueAlign="right" label="场景名称" requiredAfter labelWidth="var(--fontSize140)" required haveArrow bindclick="showPopup" data-show-name="showSceneSelect" placeholder="点击选择">
<view class="between">
<view class="start text-hide {{ orderObj.baseSceneName?'':'placeholder-class' }}">{{orderObj.baseSceneName || '请选择'}}</view>
</view>
</gl-cell>
</view>
<view class="cell two-cell"> <view class="cell two-cell">
<gl-cell border valueAlign="right" label="车主姓名" titleBtn="客户档案" bindtitleClick="showCustomPop" data-index="{{ ind }}" requiredAfter labelWidth="var(--fontSize390)" required> <gl-cell border valueAlign="right" label="车主姓名" titleBtn="客户档案" bindtitleClick="showCustomPop" data-index="{{ ind }}" requiredAfter labelWidth="var(--fontSize390)" required>
<input placeholder="点击输入" class="input" placeholder-class="placeholder-class" maxlength="16" value="{{ customer.customerName }}" bindinput="input" data-index="{{ ind }}" data-name="customer.customerName" always-embed></input> <input placeholder="点击输入" class="input" placeholder-class="placeholder-class" maxlength="16" value="{{ customer.customerName }}" bindinput="input" data-index="{{ ind }}" data-name="customer.customerName" always-embed></input>
...@@ -25,7 +32,7 @@ ...@@ -25,7 +32,7 @@
</gl-cell> </gl-cell>
<gl-cell border valueAlign="right" label="客户来源" requiredAfter labelWidth="var(--fontSize140)" required haveArrow bindclick="showPopup" data-show-name="salesTypeShow" placeholder="点击选择"> <gl-cell border valueAlign="right" label="客户来源" requiredAfter labelWidth="var(--fontSize140)" required haveArrow bindclick="showPopup" data-show-name="salesTypeShow" placeholder="点击选择">
<view class="between"> <view class="between">
<view class="start text-hide">{{customer.salesType?'售后':'售前'}}</view> <view class="start text-hide">{{ saleTypesList[customer.salesType || 0].name }}</view>
</view> </view>
</gl-cell> </gl-cell>
</view> </view>
...@@ -52,4 +59,14 @@ ...@@ -52,4 +59,14 @@
<van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType"> <van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType">
<van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" /> <van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" />
</van-popup> </van-popup>
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
<van-picker
show-toolbar
title="场景名称"
bind:cancel="onCloseSceneSelect"
columns="{{ sceneColumns }}"
value-key="name"
bind:confirm="onConfirmSceneSelect"
/>
</van-popup>
<study-permission-modal id="customModal" /> <study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
...@@ -78,6 +78,7 @@ Component({ ...@@ -78,6 +78,7 @@ Component({
}) })
this.setInviteStatusList() this.setInviteStatusList()
this.setTrafficEffectiveness() this.setTrafficEffectiveness()
this.getSceneList()
}, },
getScreenList() { getScreenList() {
let { userInfo } = this.data let { userInfo } = this.data
...@@ -280,6 +281,43 @@ Component({ ...@@ -280,6 +281,43 @@ Component({
['form.trafficEffectiveness']: arr ['form.trafficEffectiveness']: arr
}) })
}, },
getSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', staffName: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', staffName: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', staffName: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', staffName: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', staffName: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', staffName: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', staffName: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', staffName: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
let userInfo = wx.$util.getUserInfo()
api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
}).then(res => {
let { code, data } = res
let list = (code == 0 && data && data.length) ? data : MOCK_SCENE_LIST
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...list.map(e => ({
...e,
staffName: e.name || e.staffName,
value: e.baseSceneCode
}))
]
})
}).catch(() => {
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...MOCK_SCENE_LIST.map(e => ({ ...e, value: e.baseSceneCode }))
]
})
})
},
setInviteStatusListDisabled(statusType) { setInviteStatusListDisabled(statusType) {
let { inviteStatusList } = this.data.form let { inviteStatusList } = this.data.form
inviteStatusList.map((e, index) => { inviteStatusList.map((e, index) => {
...@@ -326,6 +364,10 @@ Component({ ...@@ -326,6 +364,10 @@ Component({
obj['inviteStatus'] = value[0] obj['inviteStatus'] = value[0]
delete obj[e] delete obj[e]
} }
if (e == 'sceneList') {
obj['baseSceneCode'] = value
delete obj[e]
}
if (startDate && endDate) { if (startDate && endDate) {
startDate = `${startDate} 00:00:00` startDate = `${startDate} 00:00:00`
endDate = `${endDate} 23:59:59` endDate = `${endDate} 23:59:59`
......
...@@ -85,6 +85,23 @@ ...@@ -85,6 +85,23 @@
</view> </view>
<view class="box"> <view class="box">
<view class="title"> <view class="title">
场景名称
</view>
<view class="list-box">
<block wx:for="{{form.sceneList}}" wx:key="index">
<view
class="item text-center {{item.active?'active':''}}"
bindtap="choose"
data-list-name="sceneList"
data-index="{{index}}"
>
<view class="text-item">{{item.staffName}}</view>
</view>
</block>
</view>
</view>
<view class="box">
<view class="title">
预约时间 预约时间
</view> </view>
<view class="list-box"> <view class="list-box">
......
...@@ -439,7 +439,8 @@ Page({ ...@@ -439,7 +439,8 @@ Page({
let total = 0; let total = 0;
let list = []; let list = [];
if (code == 0) { if (code == 0) {
data.list.map((e) => { const sourceList = Array.isArray(data?.list) ? data.list : [];
sourceList.map((e) => {
if (e.inviteDate) if (e.inviteDate)
e.time = new Date(e.inviteDate).format("yyyy-MM-dd hh:mm:ss"); e.time = new Date(e.inviteDate).format("yyyy-MM-dd hh:mm:ss");
if (e.customerCoupon) { if (e.customerCoupon) {
...@@ -463,14 +464,14 @@ Page({ ...@@ -463,14 +464,14 @@ Page({
!wx.$hasPermission?.isSuper?.(userInfo) && !wx.$hasPermission?.isSuper?.(userInfo) &&
userInfo?.merchantType && userInfo?.merchantType &&
(userInfo.userType == 1 || userInfo?.userType == 2); (userInfo.userType == 1 || userInfo?.userType == 2);
list = data.list.map((item) => { list = sourceList.map((item) => {
// 待预约现在也能撤销 // 待预约现在也能撤销
// item.repeal = userType && [2].includes(item.inviteStatus) // item.repeal = userType && [2].includes(item.inviteStatus)
console.log(userType, [1, 2].includes(item.inviteStatus), "userType"); console.log(userType, [1, 2].includes(item.inviteStatus), "userType");
item.repeal = userType && [1, 2].includes(item.inviteStatus); item.repeal = userType && [1, 2].includes(item.inviteStatus);
return item; return item;
}); });
total = data.total; total = data?.total || 0;
} else { } else {
this.showToast(message); this.showToast(message);
} }
......
...@@ -211,7 +211,8 @@ Component({ ...@@ -211,7 +211,8 @@ Component({
} }
], ],
storeType: 1, // 门店数据类型 默认园区店 storeType: 1, // 门店数据类型 默认园区店
showStoreSelectPopup: false showStoreSelectPopup: false,
sceneList: []
}, },
/** /**
...@@ -256,6 +257,43 @@ Component({ ...@@ -256,6 +257,43 @@ Component({
'form.selectedMerchantList': [] 'form.selectedMerchantList': []
}) })
}, },
getSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', staffName: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', staffName: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', staffName: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', staffName: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', staffName: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', staffName: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', staffName: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', staffName: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
let userInfo = wx.$util.getUserInfo()
api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
}).then(res => {
let { code, data } = res
let list = (code == 0 && data && data.length) ? data : MOCK_SCENE_LIST
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...list.map(e => ({
...e,
staffName: e.name || e.staffName,
value: e.baseSceneCode
}))
]
})
}).catch(() => {
this.setData({
['form.sceneList']: [
{ staffName: '全部', active: true, value: '' },
...MOCK_SCENE_LIST.map(e => ({ ...e, value: e.baseSceneCode }))
]
})
})
},
getScreenList() { getScreenList() {
let { userInfo } = this.data let { userInfo } = this.data
wx.$orderListDateListScreenRefresh = false wx.$orderListDateListScreenRefresh = false
...@@ -335,6 +373,7 @@ Component({ ...@@ -335,6 +373,7 @@ Component({
['form.constructionFlag']: wx.$util.deepClone(constructionStatusList), ['form.constructionFlag']: wx.$util.deepClone(constructionStatusList),
['form.abnormalFlag']: wx.$util.deepClone(abnormalList) ['form.abnormalFlag']: wx.$util.deepClone(abnormalList)
}) })
this.getSceneList()
}, },
showMore(e) { showMore(e) {
let { type } = e.currentTarget.dataset let { type } = e.currentTarget.dataset
...@@ -515,7 +554,11 @@ Component({ ...@@ -515,7 +554,11 @@ Component({
value, value,
merchantId merchantId
} = i } = i
if (e === 'sceneList') {
if (value) obj['baseSceneCode'] = value
} else {
obj[e] = value obj[e] = value
}
// 订单时间 // 订单时间
if (orderStartDate && orderEndDate) { if (orderStartDate && orderEndDate) {
orderStartDate = `${orderStartDate} 00:00:00` orderStartDate = `${orderStartDate} 00:00:00`
......
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
hidden="{{ !show }}" hidden="{{ !show }}"
> >
<view class="main" style="padding-bottom:{{ btnHeight }}px"> <view class="main" style="padding-bottom:{{ btnHeight }}px">
<view class="box">
<view class="title">
场景名称
</view>
<view class="list-box">
<block wx:for="{{form.sceneList}}" wx:key="index">
<view class="item text-center {{item.active?'active':''}}" bindtap="choose" data-list-name="sceneList" data-index="{{index}}">{{item.staffName}}</view>
</block>
</view>
</view>
<!-- 非超管转化人员 --> <!-- 非超管转化人员 -->
<view <view
class="box" class="box"
......
...@@ -27,6 +27,10 @@ Page({ ...@@ -27,6 +27,10 @@ Page({
key: 'djOrderTypeText' key: 'djOrderTypeText'
}, },
{ {
label: '场景名称',
key: 'baseSceneName'
},
{
label: '审批状态', label: '审批状态',
key: 'goodsOrderApplyStatusText', key: 'goodsOrderApplyStatusText',
hideIfEmpty: true hideIfEmpty: true
...@@ -58,6 +62,10 @@ Page({ ...@@ -58,6 +62,10 @@ Page({
key: 'djOrderTypeText' key: 'djOrderTypeText'
}, },
{ {
label: '场景名称',
key: 'baseSceneName'
},
{
label: '审批状态', label: '审批状态',
key: 'goodsOrderApplyStatusText' key: 'goodsOrderApplyStatusText'
}, },
......
...@@ -171,6 +171,18 @@ module.exports = { ...@@ -171,6 +171,18 @@ module.exports = {
getQueryCouponInfoByPhone(data) { getQueryCouponInfoByPhone(data) {
return api.post('dj.api.smartcarlife.customer.queryCouponInfoByPhone', data) return api.post('dj.api.smartcarlife.customer.queryCouponInfoByPhone', data)
}, },
/** 获取转化员上一笔订单的销售顾问 */
getLastUserOrderInfo(data) {
return api.post('dj.api.smartcarlife.order.getLastUser', data)
},
/** 获取用户场景列表 */
getUserScene(data) {
return api.post('dj.api.smartcarlife.scene.config.getUserScene', data)
},
/** 保存用户最近选择场景 */
saveUserScene(data) {
return api.post('dj.api.smartcarlife.scene.recent.saveUserScene', data)
},
/** 根据订单更新技师信息 */ /** 根据订单更新技师信息 */
updateTechnicianInfo(data) { updateTechnicianInfo(data) {
......
...@@ -7,6 +7,7 @@ import { checkStudyTask, checkAbnormalOrder } from '~/store/ModalToQueueControl' ...@@ -7,6 +7,7 @@ import { checkStudyTask, checkAbnormalOrder } from '~/store/ModalToQueueControl'
const app = getApp() const app = getApp()
let toastList = { let toastList = {
employeeName: '销售顾问不能为空', employeeName: '销售顾问不能为空',
baseSceneCode: '场景名称不能为空',
subShopMerchantId: '二级流量方不能为空', subShopMerchantId: '二级流量方不能为空',
customerName: '车主姓名不能为空', customerName: '车主姓名不能为空',
customerPhone: '手机号不能为空', customerPhone: '手机号不能为空',
...@@ -29,9 +30,14 @@ Page({ ...@@ -29,9 +30,14 @@ Page({
orderObj: { orderObj: {
// selectPayType: 2, // selectPayType: 2,
// remark: '' // remark: ''
baseSceneCode: '',
baseSceneName: '',
sceneType: ''
}, },
goodsData: [], goodsData: [],
userInfo: {}, userInfo: {},
showSceneSelect: false,
sceneColumns: [],
notUpgradeOrderList: [ notUpgradeOrderList: [
{ {
customerName: '', customerName: '',
...@@ -277,12 +283,140 @@ Page({ ...@@ -277,12 +283,140 @@ Page({
return (360 * Math.atan(_Y / _X)) / (2 * Math.PI) return (360 * Math.atan(_Y / _X)) / (2 * Math.PI)
}, },
showPopup(e) { showPopup(e) {
let { showName, index } = e.currentTarget.dataset const payload = {
...(e.currentTarget?.dataset || {}),
...(e.detail || {})
}
let { showName, index } = payload
if (showName === 'showSceneSelect') {
this.getUserSceneList()
}
this.setData({ this.setData({
[showName]: true, [showName]: true,
selectCustomIndex: index selectCustomIndex: index
}) })
}, },
async getUserSceneList() {
const MOCK_SCENE_LIST = [
{
uuid: '100101',
name: '精品升级',
baseSceneCode: '100101',
sceneType: 1,
businessType: null
},
{
uuid: '100102',
name: '交新车干配',
baseSceneCode: '100102',
sceneType: 2,
businessType: null
},
{
uuid: '100103',
name: '售后众筹',
baseSceneCode: '100103',
sceneType: 3,
businessType: null
},
{
uuid: '110101',
name: '售前会员权益升级',
baseSceneCode: '110101',
sceneType: 0,
businessType: 1
},
{
uuid: '110102',
name: '售后会员权益升级',
baseSceneCode: '110102',
sceneType: 0,
businessType: 1
},
{
uuid: '110201',
name: '售前延保',
baseSceneCode: '110201',
sceneType: 0,
businessType: 2
},
{
uuid: '110202',
name: '售后延保',
baseSceneCode: '110202',
sceneType: 0,
businessType: 2
},
{
uuid: '120101',
name: '二手车收车',
baseSceneCode: '120101',
sceneType: 7,
businessType: null
}
]
const freshUserInfo = wx.$util.getUserInfo() || {}
const userInfo =
(this.data.userInfo && Object.keys(this.data.userInfo).length
? this.data.userInfo
: freshUserInfo) || {}
try {
const res = await api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
})
const list =
res?.code == 0 && res?.data?.length ? res.data : MOCK_SCENE_LIST
const sceneColumns = list.map(item => ({
...item,
name: item.name || item.staffName
}))
const { orderObj } = this.data
const currentScene =
orderObj.baseSceneCode &&
sceneColumns.find(
item => item.baseSceneCode == orderObj.baseSceneCode
)
this.setData({
userInfo,
sceneColumns,
...(currentScene
? {
'orderObj.baseSceneName': currentScene.name || '',
'orderObj.sceneType': currentScene.sceneType
}
: {})
})
} catch (e) {
this.setData({
userInfo,
sceneColumns: MOCK_SCENE_LIST
})
}
},
onCloseSceneSelect() {
this.setData({
showSceneSelect: false
})
},
onConfirmSceneSelect(e) {
const scene = e.detail.value || {}
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {}
this.setData({
showSceneSelect: false,
'orderObj.baseSceneCode': scene.baseSceneCode || '',
'orderObj.baseSceneName': scene.name || scene.staffName || '',
'orderObj.sceneType': scene.sceneType
})
scene.baseSceneCode &&
api
.saveUserScene({
baseSceneCode: scene.baseSceneCode,
sceneType: scene.sceneType,
phone: userInfo.phone
})
.catch(() => {})
},
input(e) { input(e) {
let { notUpgradeOrderList } = this.data let { notUpgradeOrderList } = this.data
let { value } = e.detail let { value } = e.detail
...@@ -411,7 +545,11 @@ Page({ ...@@ -411,7 +545,11 @@ Page({
createDate: dateObj.today createDate: dateObj.today
} }
if (type == 'success') { if (type == 'success') {
orderObj.preliminaryOrders = notUpgradeOrderList orderObj.preliminaryOrders = (notUpgradeOrderList || []).map(item => ({
...item,
baseSceneCode: orderObj.baseSceneCode,
sceneType: orderObj.sceneType
}))
} else { } else {
orderObj.notUpgradeOrderList = notUpgradeOrderList orderObj.notUpgradeOrderList = notUpgradeOrderList
} }
...@@ -467,7 +605,7 @@ Page({ ...@@ -467,7 +605,7 @@ Page({
// 导入动态校验字段 // 导入动态校验字段
// console.log(requiredList) ...requiredList, // console.log(requiredList) ...requiredList,
let { requiredList } = this.data let { requiredList } = this.data
let target = [...requiredList, 'employeeName'] let target = [...requiredList, 'employeeName', 'baseSceneCode']
try { try {
target.map(key => { target.map(key => {
...@@ -564,7 +702,12 @@ Page({ ...@@ -564,7 +702,12 @@ Page({
onLoad: function (res) { onLoad: function (res) {
this.setTimeList() this.setTimeList()
console.log(res) console.log(res)
const userInfo = wx.$util.getUserInfo() || {}
this.setData({
userInfo
})
res && this.initOPtions(res) res && this.initOPtions(res)
this.getUserSceneList()
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
"car-brands": "/components/CarBrands/CarBrands", "car-brands": "/components/CarBrands/CarBrands",
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles", "merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant", "sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal" "study-permission-modal": "/components/studyPermissionModal/studyPermissionModal",
"van-popup": "/miniprogram_npm/@vant/weapp/popup/index",
"van-picker": "/miniprogram_npm/@vant/weapp/picker/index"
} }
} }
...@@ -59,6 +59,24 @@ ...@@ -59,6 +59,24 @@
</block> </block>
</gl-cell> </gl-cell>
</view> </view>
<view class="baseSceneCode" >
<gl-cell
border
valueAlign="right"
label="场景名称"
requiredAfter
labelWidth="var(--fontSize140)"
required
haveArrow
bindclick="showPopup"
data-show-name="showSceneSelect"
placeholder="点击选择"
>
<block wx:if="{{ orderObj.baseSceneName }}">
<view class="between">{{orderObj.baseSceneName}}</view>
</block>
</gl-cell>
</view>
<view class="subShopMerchantId" wx:if="{{isShowSubShopMerchant}}"> <view class="subShopMerchantId" wx:if="{{isShowSubShopMerchant}}">
<gl-cell <gl-cell
border border
...@@ -285,4 +303,13 @@ ...@@ -285,4 +303,13 @@
selectedSelesMerchantId="{{orderObj.merchantId}}" selectedSelesMerchantId="{{orderObj.merchantId}}"
selectedSubShopMerchantId="{{orderObj.subShopMerchantId || ''}}" /> selectedSubShopMerchantId="{{orderObj.subShopMerchantId || ''}}" />
<study-permission-modal id="customModal" /> <study-permission-modal id="customModal" />
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
<van-picker
show-toolbar
title="场景名称"
bind:cancel="onCloseSceneSelect"
columns="{{ sceneColumns }}"
value-key="name"
bind:confirm="onConfirmSceneSelect"
/>
</van-popup>
...@@ -41,7 +41,8 @@ export const PAYEE_TYPE = { ...@@ -41,7 +41,8 @@ export const PAYEE_TYPE = {
export const SALES_TYPE = { export const SALES_TYPE = {
PRE_SALES: 0, PRE_SALES: 0,
AFTER_SALES: 1 AFTER_SALES: 1,
NATURAL_TO_STORE: 2
} }
const CDN_BASE = const CDN_BASE =
......
...@@ -26,6 +26,7 @@ const app = getApp() ...@@ -26,6 +26,7 @@ const app = getApp()
let time = null let time = null
let toastList = { let toastList = {
userId: '销售顾问不能为空', userId: '销售顾问不能为空',
baseSceneCode: '场景名称不能为空',
subShopMerchantId: '二级流量方不能为空', subShopMerchantId: '二级流量方不能为空',
deliveryUserId: '交付专员不能为空', deliveryUserId: '交付专员不能为空',
customerName: '车主姓名不能为空', customerName: '车主姓名不能为空',
...@@ -110,6 +111,8 @@ Page({ ...@@ -110,6 +111,8 @@ Page({
}, },
deliveryUserId: '', deliveryUserId: '',
deliveryEmployeeName: '', deliveryEmployeeName: '',
baseSceneCode: '',
baseSceneName: '',
// selectPayType: 0, // selectPayType: 0,
selectPayType: PAY_TYPE.SHOP, // 支付方式:默认门店收款 selectPayType: PAY_TYPE.SHOP, // 支付方式:默认门店收款
payeeType: PAYEE_TYPE.SHOP, // 收款方:默认4s店收款 payeeType: PAYEE_TYPE.SHOP, // 收款方:默认4s店收款
...@@ -149,11 +152,15 @@ Page({ ...@@ -149,11 +152,15 @@ Page({
Sourcecolumns: [ Sourcecolumns: [
{ {
type: SALES_TYPE.PRE_SALES, type: SALES_TYPE.PRE_SALES,
name: '售前' name: '门店引流-售前'
}, },
{ {
type: SALES_TYPE.AFTER_SALES, type: SALES_TYPE.AFTER_SALES,
name: '售后' name: '门店引流-售后'
},
{
type: SALES_TYPE.NATURAL_TO_STORE,
name: '自然到店'
} }
], ],
orderTypeList: [ orderTypeList: [
...@@ -161,9 +168,12 @@ Page({ ...@@ -161,9 +168,12 @@ Page({
{ text: '打折策略', value: ORDER_TYPE.DISCOUNT }, { text: '打折策略', value: ORDER_TYPE.DISCOUNT },
{ text: '买赠策略', value: ORDER_TYPE.GIFT }, { text: '买赠策略', value: ORDER_TYPE.GIFT },
{ text: '冲量活动', value: ORDER_TYPE.IMPULSE }, { text: '冲量活动', value: ORDER_TYPE.IMPULSE },
{ text: '组合付款', value: ORDER_TYPE.COMBINATION } { text: '组合付款', value: ORDER_TYPE.COMBINATION },
{ text: '内部结算', value: ORDER_TYPE.INTERNAL_SETTLEMENT }
], ],
orderTypeName: '正常订单', orderTypeName: '正常订单',
showSceneSelect: false,
sceneColumns: [],
packageBox: false, packageBox: false,
skuGoodsBox: false, skuGoodsBox: false,
djPayList: [], // 嘀加收款方对应支付方式 djPayList: [], // 嘀加收款方对应支付方式
...@@ -473,6 +483,9 @@ Page({ ...@@ -473,6 +483,9 @@ Page({
let { showName, positionnnum: positionNum } = let { showName, positionnnum: positionNum } =
e.currentTarget.dataset || e.detail e.currentTarget.dataset || e.detail
if (showName == 'orderTypeBox' && createAllGoodsFlag == 0) return if (showName == 'orderTypeBox' && createAllGoodsFlag == 0) return
if (showName == 'showSceneSelect') {
this.getUserSceneList()
}
console.log(positionNum, 'positionNum') console.log(positionNum, 'positionNum')
console.log(copyGoodsData, 'copyGoodsData') console.log(copyGoodsData, 'copyGoodsData')
let obj = { let obj = {
...@@ -503,6 +516,97 @@ Page({ ...@@ -503,6 +516,97 @@ Page({
goodsData: arr goodsData: arr
}) })
}, },
async getUserSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
const freshUserInfo = wx.$util.getUserInfo() || {}
const userInfo =
(this.data.userInfo && Object.keys(this.data.userInfo).length
? this.data.userInfo
: freshUserInfo) || {}
try {
const res = await api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
})
const list =
res?.code == 0 && res?.data?.length ? res.data : MOCK_SCENE_LIST
const sceneColumns = list.map(item => ({
...item,
name: item.name || item.staffName
}))
const currentScene = sceneColumns.find(
item => item.baseSceneCode == this.data.orderObj.baseSceneCode
)
this.setData({
userInfo,
sceneColumns,
...(currentScene
? {
'orderObj.baseSceneName': currentScene.name || '',
'orderObj.sceneType': currentScene.sceneType
}
: {})
})
} catch (e) {
this.setData({
sceneColumns: MOCK_SCENE_LIST
})
}
},
async prefillLastSeller() {
const { orderObj } = this.data
if (orderObj?.userId) return
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {}
const sellerUserId = userInfo?.subLoginUser?.uuid || userInfo?.uuid
if (!sellerUserId) return
try {
const res = await api.getLastUserOrderInfo({ sellerUserId })
const last = res?.data
if (!last) return
if (last.merchantId != userInfo?.shopMerchantId) return
this.setData({
'orderObj.merchantId': last.merchantId || '',
'orderObj.merchantName': last.merchantName || '',
'orderObj.userId': last.userId || '',
'orderObj.employeeName': last.employeeName || ''
})
} catch (e) {}
},
onCloseSceneSelect() {
this.setData({
showSceneSelect: false
})
},
onConfirmSceneSelect(e) {
const scene = e.detail.value || {}
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {}
this.setData({
showSceneSelect: false,
'orderObj.baseSceneCode': scene.baseSceneCode || '',
'orderObj.baseSceneName': scene.name || scene.staffName || '',
'orderObj.sceneType': scene.sceneType
})
scene.baseSceneCode &&
api.saveUserScene({
baseSceneCode: scene.baseSceneCode,
sceneType: scene.sceneType,
phone: userInfo.phone
}).catch(() => {})
const { orderObj } = this.data
if (orderObj?.userId && orderObj?.merchantId && scene.baseSceneCode) {
this.getOrderBaseGoodsList(orderObj.merchantId, scene.sceneType)
this.getSelectOrderGoodsList(orderObj.merchantId, scene.sceneType)
}
},
input(e) { input(e) {
let { orderObj, userInfo, goodsList } = this.data let { orderObj, userInfo, goodsList } = this.data
let { value } = e.detail let { value } = e.detail
...@@ -1061,6 +1165,7 @@ Page({ ...@@ -1061,6 +1165,7 @@ Page({
// : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode'] // : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = [ let target = [
'userId', 'userId',
'baseSceneCode',
'merchantId', 'merchantId',
'employeeName', 'employeeName',
...requiredList, ...requiredList,
...@@ -1326,12 +1431,18 @@ Page({ ...@@ -1326,12 +1431,18 @@ Page({
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting?.yqPhoneConfig') // console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting?.yqPhoneConfig')
// console.log(options, 'options') // console.log(options, 'options')
const userInfo = wx.$util.getUserInfo() || {}
this.setData({
userInfo
})
if (options.scene) { if (options.scene) {
this.setData(options) this.setData(options)
} }
if (options.orderCode) { if (options.orderCode) {
this.onRoute(options) this.onRoute(options)
} }
this.getUserSceneList()
this.prefillLastSeller()
// 添加埋点 // 添加埋点
wx.$track.setTrackData(0, 'submit_order', {}, '', 1) wx.$track.setTrackData(0, 'submit_order', {}, '', 1)
}, },
...@@ -1411,7 +1522,7 @@ Page({ ...@@ -1411,7 +1522,7 @@ Page({
this.applyCouponFromScene(userInfo, scene) this.applyCouponFromScene(userInfo, scene)
} }
}, },
async getSelectOrderGoodsList(merchantId) { async getSelectOrderGoodsList(merchantId, sceneType = this.data.orderObj.sceneType) {
let { first, orderObj } = this.data let { first, orderObj } = this.data
let packageList = [], let packageList = [],
frontGearArr = [], // 前挡 frontGearArr = [], // 前挡
...@@ -1433,7 +1544,7 @@ Page({ ...@@ -1433,7 +1544,7 @@ Page({
api api
.getSelectOrderGoodsList({ .getSelectOrderGoodsList({
merchantId, merchantId,
sceneType: 1 sceneType: sceneType ?? 1
}) })
.then(result => { .then(result => {
let { code, data, message } = result let { code, data, message } = result
...@@ -1533,7 +1644,7 @@ Page({ ...@@ -1533,7 +1644,7 @@ Page({
}) })
wx.hideLoading() wx.hideLoading()
}, },
async getOrderBaseGoodsList(merchantId) { async getOrderBaseGoodsList(merchantId, sceneType = this.data.orderObj.sceneType) {
let { let {
first, first,
orderObj, orderObj,
...@@ -1556,6 +1667,7 @@ Page({ ...@@ -1556,6 +1667,7 @@ Page({
api api
.getOrderBaseGoodsList({ .getOrderBaseGoodsList({
merchantId, merchantId,
sceneType,
upradeFlag: selectPayType ? 'N' : 'Y' upradeFlag: selectPayType ? 'N' : 'Y'
}) })
.then(res => { .then(res => {
......
...@@ -31,6 +31,24 @@ ...@@ -31,6 +31,24 @@
</block> </block>
</gl-cell> </gl-cell>
</view> </view>
<view class="baseSceneCode" >
<gl-cell
border
valueAlign="right"
label="场景名称"
requiredAfter
labelWidth="var(--fontSize140)"
required
haveArrow
bindclick="showPopup"
data-show-name="showSceneSelect"
placeholder="点击选择"
>
<block wx:if="{{ orderObj.baseSceneName }}">
<view class="between">{{orderObj.baseSceneName}}</view>
</block>
</gl-cell>
</view>
<view class="deliveryUserId" wx:if="{{ pointsMultiRole=='Y' }}"> <view class="deliveryUserId" wx:if="{{ pointsMultiRole=='Y' }}">
<gl-cell <gl-cell
border border
...@@ -107,7 +125,7 @@ placeholder="100字以内" ...@@ -107,7 +125,7 @@ placeholder="100字以内"
value="{{ orderObj.remark }}" value="{{ orderObj.remark }}"
/>--> />-->
</view> </view>
<view class="box"> <view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">
<view class="customerName"> <view class="customerName">
<gl-cell <gl-cell
border border
...@@ -253,7 +271,7 @@ value="{{ orderObj.remark }}" ...@@ -253,7 +271,7 @@ value="{{ orderObj.remark }}"
</view> </view>
</gl-cell> </gl-cell>
</view> </view>
<view class="box"> <view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">
<block wx:if="{{ orderObj.merchantId }}"> <block wx:if="{{ orderObj.merchantId }}">
<!-- <gl-cell border label="客户类型"valueAlign="right"labelWidth="var(--fontSize140)"><view class="gender-box"><view class="block text-center {{orderObj.selectPayType !=0?'':'right'}}"/><view class="male text-center {{orderObj.selectPayType !=0 ?'active':''}}"bindtap="changeSelectPayType"data-experience="2">升级 </view><view class="woman text-center {{orderObj.selectPayType ==0?'active':''}}"bindtap="changeSelectPayType"data-experience="0">战败 </view></view></gl-cell>--> <!-- <gl-cell border label="客户类型"valueAlign="right"labelWidth="var(--fontSize140)"><view class="gender-box"><view class="block text-center {{orderObj.selectPayType !=0?'':'right'}}"/><view class="male text-center {{orderObj.selectPayType !=0 ?'active':''}}"bindtap="changeSelectPayType"data-experience="2">升级 </view><view class="woman text-center {{orderObj.selectPayType ==0?'active':''}}"bindtap="changeSelectPayType"data-experience="0">战败 </view></view></gl-cell>-->
<gl-cell <gl-cell
...@@ -729,7 +747,7 @@ value="{{ orderObj.remark }}" ...@@ -729,7 +747,7 @@ value="{{ orderObj.remark }}"
</block> </block>
<view class="paytype-tips" wx:if="{{ orderObj.selectPayType == 7 }}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view> <view class="paytype-tips" wx:if="{{ orderObj.selectPayType == 7 }}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view>
</view> </view>
<view class="box"> <view class="box" wx:if="{{ orderObj.userId && orderObj.baseSceneCode }}">
<!-- <gl-cell wx:if="{{orderObj.selectPayType==2}}"value="{{successDateTime}}"bind:click="toSelectDate"haveArrow placeholder="请选择时间"required requiredAfter border class="pay-type"label="门店收款时间"valueAlign="right"labelWidth="var(--fontSize200)"></gl-cell>--> <!-- <gl-cell wx:if="{{orderObj.selectPayType==2}}"value="{{successDateTime}}"bind:click="toSelectDate"haveArrow placeholder="请选择时间"required requiredAfter border class="pay-type"label="门店收款时间"valueAlign="right"labelWidth="var(--fontSize200)"></gl-cell>-->
<view class="remark_box"> <view class="remark_box">
<view class="label"> <view class="label">
...@@ -867,6 +885,16 @@ value="{{ orderObj.remark }}" ...@@ -867,6 +885,16 @@ value="{{ orderObj.remark }}"
bind:confirm="onChangeSource" bind:confirm="onChangeSource"
/> />
</van-popup> </van-popup>
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
<van-picker
show-toolbar
title="场景名称"
bind:cancel="onCloseSceneSelect"
columns="{{ sceneColumns }}"
value-key="name"
bind:confirm="onConfirmSceneSelect"
/>
</van-popup>
<van-popup show="{{ orderTypeBox }}" position="bottom" bind:close="onCloseOrderType"> <van-popup show="{{ orderTypeBox }}" position="bottom" bind:close="onCloseOrderType">
<van-picker <van-picker
show-toolbar show-toolbar
......
...@@ -20,7 +20,8 @@ export const ORDER_TYPE = { ...@@ -20,7 +20,8 @@ export const ORDER_TYPE = {
DISCOUNT: 2, DISCOUNT: 2,
GIFT: 3, GIFT: 3,
IMPULSE: 4, IMPULSE: 4,
COMBINATION: 5 COMBINATION: 5,
INTERNAL_SETTLEMENT: 6
} }
export const DISCOUNT_TYPE = { export const DISCOUNT_TYPE = {
......
...@@ -273,6 +273,7 @@ SubmitContext.prototype.prepareSubmitData = function (save) { ...@@ -273,6 +273,7 @@ SubmitContext.prototype.prepareSubmitData = function (save) {
'packageGoodsList', 'packageGoodsList',
'expenseCategoryList', 'expenseCategoryList',
'merchantDistributionList', 'merchantDistributionList',
'baseSceneName',
'orderTime', 'orderTime',
'createdBy', 'createdBy',
'createdDate', 'createdDate',
...@@ -297,6 +298,11 @@ SubmitContext.prototype.prepareSubmitData = function (save) { ...@@ -297,6 +298,11 @@ SubmitContext.prototype.prepareSubmitData = function (save) {
} }
} }
// 场景参数:来自“当前选中的场景”存入的 orderObj.sceneType
if (!submitObj.baseSceneCode) {
delete submitObj.sceneType
}
if (isErrorOrder) submitObj.oldOrderCode = submitObj.associateOrderCode if (isErrorOrder) submitObj.oldOrderCode = submitObj.associateOrderCode
if (save) { if (save) {
......
...@@ -8,6 +8,7 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/ ...@@ -8,6 +8,7 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/
const app = getApp() const app = getApp()
let toastList = { let toastList = {
employeeName: '销售顾问不能为空', employeeName: '销售顾问不能为空',
baseSceneCode: '场景名称不能为空',
subShopMerchantId: '二级流量方不能为空', subShopMerchantId: '二级流量方不能为空',
sellerUserId: '转化人员不能为空', sellerUserId: '转化人员不能为空',
refusalReason: '拒升理由不能为空' refusalReason: '拒升理由不能为空'
...@@ -66,6 +67,8 @@ Page({ ...@@ -66,6 +67,8 @@ Page({
refusalReason: false, refusalReason: false,
isShowSubShopMerchant: false, isShowSubShopMerchant: false,
requiredList: [], requiredList: [],
showSceneSelect: false,
sceneColumns: [],
tipsProps: { tipsProps: {
tipsText: '本表单用于快速生成战败客户订单', tipsText: '本表单用于快速生成战败客户订单',
showTips: false, showTips: false,
...@@ -372,12 +375,19 @@ Page({ ...@@ -372,12 +375,19 @@ Page({
}, },
showPopup(e) { showPopup(e) {
let { copyGoodsData, baseConfigData } = this.data let { copyGoodsData, baseConfigData } = this.data
let payload = {
...(e.currentTarget?.dataset || {}),
...(e.detail || {})
}
let { let {
showName, showName,
index, index,
type, type,
positionnnum: positionNum positionnnum: positionNum
} = e.currentTarget.dataset } = payload
if (showName === 'showSceneSelect') {
this.getUserSceneList()
}
let arr = [] let arr = []
if (showName == 'goodsBox') { if (showName == 'goodsBox') {
// type 产品类型 1前挡 2侧后挡 3天窗 根据类型过滤显示商品弹窗数据 // type 产品类型 1前挡 2侧后挡 3天窗 根据类型过滤显示商品弹窗数据
...@@ -493,8 +503,83 @@ Page({ ...@@ -493,8 +503,83 @@ Page({
[prop]: gender [prop]: gender
}) })
}, },
async getUserSceneList() {
const MOCK_SCENE_LIST = [
{ uuid: '100101', name: '精品升级', baseSceneCode: '100101', sceneType: 1, businessType: null },
{ uuid: '100102', name: '交新车干配', baseSceneCode: '100102', sceneType: 2, businessType: null },
{ uuid: '100103', name: '售后众筹', baseSceneCode: '100103', sceneType: 3, businessType: null },
{ uuid: '110101', name: '售前会员权益升级', baseSceneCode: '110101', sceneType: 0, businessType: 1 },
{ uuid: '110102', name: '售后会员权益升级', baseSceneCode: '110102', sceneType: 0, businessType: 1 },
{ uuid: '110201', name: '售前延保', baseSceneCode: '110201', sceneType: 0, businessType: 2 },
{ uuid: '110202', name: '售后延保', baseSceneCode: '110202', sceneType: 0, businessType: 2 },
{ uuid: '120101', name: '二手车收车', baseSceneCode: '120101', sceneType: 7, businessType: null }
]
const freshUserInfo = wx.$util.getUserInfo() || {}
const userInfo =
(this.data.userInfo && Object.keys(this.data.userInfo).length
? this.data.userInfo
: freshUserInfo) || {}
try {
const res = await api.getUserScene({
sceneType: String(userInfo.sceneType || ''),
phone: userInfo.phone
})
const list =
res?.code == 0 && res?.data?.length ? res.data : MOCK_SCENE_LIST
const sceneColumns = list.map(item => ({
...item,
name: item.name || item.staffName
}))
const { orderObj } = this.data
const currentScene =
orderObj.baseSceneCode &&
sceneColumns.find(item => item.baseSceneCode == orderObj.baseSceneCode)
this.setData({
userInfo,
sceneColumns,
...(currentScene
? {
'orderObj.baseSceneName': currentScene.name || '',
'orderObj.sceneType': currentScene.sceneType
}
: {})
})
} catch (e) {
this.setData({
userInfo,
sceneColumns: MOCK_SCENE_LIST
})
}
},
onCloseSceneSelect() {
this.setData({
showSceneSelect: false
})
},
onConfirmSceneSelect(e) {
const scene = e.detail.value || {}
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {}
this.setData({
showSceneSelect: false,
'orderObj.baseSceneCode': scene.baseSceneCode || '',
'orderObj.baseSceneName': scene.name || scene.staffName || '',
'orderObj.sceneType': scene.sceneType
})
scene.baseSceneCode &&
api
.saveUserScene({
baseSceneCode: scene.baseSceneCode,
sceneType: scene.sceneType,
phone: userInfo.phone
})
.catch(() => {})
const { orderObj } = this.data
if (orderObj?.userId && orderObj?.merchantId && scene.baseSceneCode) {
this.getOrderBaseGoodsList(orderObj.merchantId, scene.sceneType)
}
},
// 获取商品 // 获取商品
async getOrderBaseGoodsList(merchantId) { async getOrderBaseGoodsList(merchantId, sceneType = this.data.orderObj.sceneType) {
const positionTypeList = (await getPositionList()) || [] const positionTypeList = (await getPositionList()) || []
// 获取配置服务数据 // 获取配置服务数据
let baseConfigData = await setConfigInfo(app.globalData) let baseConfigData = await setConfigInfo(app.globalData)
...@@ -513,6 +598,7 @@ Page({ ...@@ -513,6 +598,7 @@ Page({
api api
.getOrderBaseGoodsList({ .getOrderBaseGoodsList({
merchantId, merchantId,
sceneType,
upradeFlag: 'N' upradeFlag: 'N'
}) })
.then(res => { .then(res => {
...@@ -809,7 +895,7 @@ Page({ ...@@ -809,7 +895,7 @@ Page({
checkRequired(obj) { checkRequired(obj) {
// 导入动态校验字段 // 导入动态校验字段
let { requiredList } = this.data let { requiredList } = this.data
let target = [...requiredList, 'employeeName'] let target = [...requiredList, 'employeeName', 'baseSceneCode']
try { try {
target.map(key => { target.map(key => {
...@@ -1112,7 +1198,12 @@ Page({ ...@@ -1112,7 +1198,12 @@ Page({
*/ */
onLoad: function (res) { onLoad: function (res) {
this.setTimeList() this.setTimeList()
const userInfo = wx.$util.getUserInfo() || {}
this.setData({
userInfo
})
res && this.initOPtions(res) res && this.initOPtions(res)
this.getUserSceneList()
if (res.scene) { if (res.scene) {
this.setData(res) this.setData(res)
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
"goods": "../GoodsPackage/Goods", "goods": "../GoodsPackage/Goods",
"customerInfo": "/components/CustomerInfo/CustomerInfo", "customerInfo": "/components/CustomerInfo/CustomerInfo",
"sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant", "sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal" "study-permission-modal": "/components/studyPermissionModal/studyPermissionModal",
"van-popup": "/miniprogram_npm/@vant/weapp/popup/index",
"van-picker": "/miniprogram_npm/@vant/weapp/picker/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -55,6 +55,24 @@ ...@@ -55,6 +55,24 @@
</block> </block>
</gl-cell> </gl-cell>
</view> </view>
<view class="baseSceneCode">
<gl-cell
border
valueAlign="right"
label="场景名称"
requiredAfter
labelWidth="var(--fontSize140)"
required
haveArrow
bindclick="showPopup"
data-show-name="showSceneSelect"
placeholder="点击选择"
>
<block wx:if="{{ orderObj.baseSceneName }}">
<view class="between">{{orderObj.baseSceneName}}</view>
</block>
</gl-cell>
</view>
<view class="subShopMerchantId" wx:if="{{ isShowSubShopMerchant }}"> <view class="subShopMerchantId" wx:if="{{ isShowSubShopMerchant }}">
<gl-cell <gl-cell
border border
...@@ -727,3 +745,13 @@ ...@@ -727,3 +745,13 @@
selectedSubShopMerchantId="{{ orderObj.subShopMerchantId || '' }}" selectedSubShopMerchantId="{{ orderObj.subShopMerchantId || '' }}"
/> />
<study-permission-modal id="customModal" /> <study-permission-modal id="customModal" />
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
<van-picker
show-toolbar
title="场景名称"
bind:cancel="onCloseSceneSelect"
columns="{{ sceneColumns }}"
value-key="name"
bind:confirm="onConfirmSceneSelect"
/>
</van-popup>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!