Commit a3d83969 by zhangxw

二级流量方紧急需求开发

1 parent af6cdeeb
......@@ -48,6 +48,10 @@ module.exports = {
getServiceMerchantList(data) {
return api.post('dj.api.smartcarlife.serviceMerchant.list', data)
},
/** 根据4S店商户号获取二级流量方列表 */
getSubShopMerchantList(data) {
return api.post('dj.api.smartcarlife.diversionMerchant.getDiversionMerchantRef', data)
},
/**商品类型 */
getGoodsTypeList(data) {
return api.post('dj.api.goods.type.list', data)
......
import api from '../../api/api.js'
// components/subShopMerchant/subShopMerchant.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
title: String,
selectedSelesMerchantId: {
type: String,
observer: function (n) {
if (n) {
this.getSubShopMerchantList(n)
}
}
}
},
/**
* 组件的初始数据
*/
data: {
subShopMerchantList: [{
subMerchantId: 44186779,
subMerchantName: "深圳市鹏峰投资发展有限公司(1)"
}, {
subMerchantId: 44211469,
subMerchantName: "明明长岭4s店B"
}],
orderObj: {},
},
/**
* 组件的方法列表
*/
methods: {
getSubShopMerchantList(id) {
let thisPage = wx.$router.getPageInstance()
let { requiredList, orderObj } = thisPage.data
api.getSubShopMerchantList({merchantId: id}).then(res => {
let {code, data} = res
if (code == '0') {
// 有二级流量方数据 添加必填二级流量方字段
if (data?.length) {
requiredList.push('subShopMerchantId')
data.map(i => {
i.active = false
if (i.subMerchantId == orderObj.subShopMerchantId) {
i.active = true
}
return i
})
// 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择
let hasSubShopMerchantId = data.some(item=> item.subMerchantId == orderObj.subShopMerchantId)
if (!hasSubShopMerchantId) {
delete orderObj.subShopMerchantId
delete orderObj.subShopMerchantName
}
thisPage.setData({
requiredList,
isShowSubShopMerchant: true,
orderObj
})
this.setData({
subShopMerchantList: data,
})
} else {
requiredList.indexOf('subShopMerchantId') > -1 && requiredList.splice(requiredList.indexOf('subShopMerchantId'), 1)
thisPage.setData({
isShowSubShopMerchant: false,
requiredList
})
}
}
})
},
changeMerchant(e) {
let { index, item } = e.currentTarget.dataset
let { subShopMerchantList, orderObj } = this.data
let subShopMerchantId = item.subMerchantId
if (subShopMerchantId == orderObj.subShopMerchantId) return
let selectedSubShopMerchantObj = {
subShopMerchantId: item.subMerchantId,
subShopMerchantName: item.subMerchantName
}
orderObj = Object.assign(orderObj, selectedSubShopMerchantObj)
subShopMerchantList.map(i => (i.active = false))
subShopMerchantList[index].active = true
this.setData({
subShopMerchantList,
...orderObj
})
},
async confirm() {
let data = this.data.orderObj
let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data
orderObj = Object.assign(orderObj, data)
thisPage.setData({
orderObj
})
console.log(orderObj)
this.setData({
show: false
})
},
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--components/subShopMerchant/subShopMerchant.wxml-->
<popup show="{{show}}" bindconfirm="confirm">
<scroll-view class="sub-shop-merchant-box" scroll-y enhanced="{{true}}" show-scrollbar="{{false}}">
<view class="box">
<view class="sub-title text-center">{{title}}</view>
<view class="merchant-box">
<block wx:for="{{subShopMerchantList}}" wx:key="index">
<view class="merchantList {{item.active?'active':''}}" bindtap="changeMerchant" data-item="{{item}}"
data-index="{{index}}">
<view class="text-hide">{{item.subMerchantName}}</view>
</view>
</block>
</view>
</view>
</scroll-view>
</popup>
/* components/subShopMerchant/subShopMerchant.wxss */
.sub-shop-merchant-box{
height: 100%;
width: calc(100% + 64rpx);
transform: translateX(-32rpx);
}
.sub-title {
height: 100rpx;
font-size: 32rpx;
color: #333333;
position: sticky;
left: 0;
top: 0;
background-color: #fff;
z-index: 2;
}
.text-hide {
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.text-center{
display: flex;
align-items: center;
justify-content: center;
}
.box{
padding: 0 32rpx;
}
.merchant-box{
max-height: 300rpx;
overflow: hidden;
transition: all .25s;
}
.merchantList {
width: calc(100% - 50rpx);
height: 98rpx;
display: flex;
align-items: center;
border-bottom: 2rpx solid #EBEDF0;
font-size: 28rpx;
color: #999999;
padding: 0 25rpx;
transition: all .5s;
}
.merchantList.active {
color: #3582EE;
font-weight: 700;
position: relative;
}
.merchantList.active::after {
content: '';
position: absolute;
bottom: 0;
background: #3582EE;
border-radius: 3rpx;
width: 60rpx;
height: 6rpx;
left: 25rpx;
}
.merchantList.active {
color: #3582EE;
font-weight: 700;
position: relative;
}
.merchantList.active::after {
content: '';
position: absolute;
bottom: 0;
background: #3582EE;
border-radius: 3rpx;
width: 60rpx;
height: 6rpx;
left: 25rpx;
}
......@@ -3,6 +3,7 @@ import api from '../../api'
const app = getApp()
let toastList = {
userId: '销售顾问不能为空',
subShopMerchantId: '二级流量方不能为空',
customerName: '车主姓名不能为空',
customerPhone: '手机号不能为空',
sellerUserId: '转化人员不能为空',
......@@ -63,7 +64,8 @@ Page({
totalFee: '',
accountDate: '',
priceSpread: '',
showTips: true
showTips: true,
isShowSubShopMerchant: false
},
showCustomPop() {
this.setData({
......@@ -445,7 +447,7 @@ Page({
// 导入动态校验字段
let { requiredList } = this.data
// console.log(requiredList) ...requiredList,
let target = ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
obj = {
...obj,
...obj.customer
......@@ -528,7 +530,7 @@ Page({
}) || phoneShow.pop()
console.log(phoneConfig)
this.setData({
['orderObj.customer.customerPhone']: phoneConfig.phoneNumber
['orderObj.customer.customerPhone']: phoneConfig?.phoneNumber
})
}
},
......
......@@ -5,6 +5,7 @@
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"coupon": "/components/Coupon/Coupon",
"goods": "/components/Goods/Goods",
"customerInfo": "/components/CustomerInfo/CustomerInfo"
"customerInfo": "/components/CustomerInfo/CustomerInfo",
"sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant"
}
}
......@@ -28,6 +28,26 @@
</block>
</gl-cell>
</view>
<view class="subShopMerchantId" wx:if="{{isShowSubShopMerchant}}">
<gl-cell
border
valueAlign="right"
label="二级流量方"
requiredAfter
labelWidth="180rpx"
required
haveArrow
bindclick="showPopup"
data-show-name="subShopMerchantBox"
placeholder="点击选择"
disabled="{{orderObj.orderSource == 5}}">
<block wx:if="{{orderObj.subShopMerchantName}}">
<view class="between">
{{orderObj.subShopMerchantName}}
</view>
</block>
</gl-cell>
</view>
<view class="customerName">
<gl-cell
border
......@@ -304,6 +324,10 @@
userInfo="{{userInfo}}"
type="1"
oderType="recorder" />
<sub-shop-merchant
show="{{subShopMerchantBox}}"
title="选择二级流量方"
selectedSelesMerchantId="{{orderObj.merchantId}}"/>
<car-brands
show="{{carBrandBox}}"
bindconfirm="chooseCar"
......
......@@ -239,6 +239,17 @@ Page({
flag: true,
warrantyCardList
})
// 校验是否显示二级流量方
if (data.subShopMerchantName) {
let { customerObj } = this.data
customerObj[customerObj.length - 2] = {
label: '二级流量方:',
key: 'subShopMerchantName'
}
this.setData({
customerObj
})
}
} else {
wx.showModal({
title: '温馨提示',
......
......@@ -200,6 +200,17 @@ Page({
warrantyCardList.length && this.getBarCode()
this.getServiceBaseInfo(data.merchantId)
// if (data.status == 6) return
// 校验是否显示二级流量方
if (data.subShopMerchantName) {
let { customerObj } = this.data
customerObj[customerObj.length - 2] = {
label: '二级流量方:',
key: 'subShopMerchantName'
}
this.setData({
customerObj
})
}
} else {
wx.showModal({
title: '温馨提示',
......
......@@ -196,7 +196,8 @@ page {
}
.box .cell .label {
width: 146rpx;
flex-shrink: 0;
width: 180rpx;
}
.box .cell .value {
......
......@@ -4,6 +4,7 @@ import api from '../../api'
const app = getApp()
let toastList = {
employeeName: '销售顾问不能为空',
subShopMerchantId: '二级流量方不能为空',
customerName: '车主姓名不能为空',
customerPhone: '手机号不能为空',
sellerUserId: '转化人员不能为空',
......@@ -53,7 +54,9 @@ Page({
toView: '',
typeIndx: 0,
// isPlateNumber: false
isStandNo: false
isStandNo: false,
isShowSubShopMerchant: false,
requiredList: [],
},
routerBack() {
wx.$router.back()
......@@ -355,7 +358,8 @@ Page({
checkRequired(obj) {
// 导入动态校验字段
// console.log(requiredList) ...requiredList,
let target = ['employeeName']
let { requiredList } = this.data
let target = [...requiredList, 'employeeName']
try {
target.map(key => {
......@@ -379,7 +383,7 @@ Page({
}) || phoneShow.pop()
console.log(phoneConfig)
notUpgradeOrderList.forEach(item => {
item.customerPhone = item.customerPhone || phoneConfig.phoneNumber
item.customerPhone = item.customerPhone || phoneConfig?.phoneNumber
})
this.setData({
notUpgradeOrderList
......
......@@ -2,6 +2,7 @@
"navigationBarTitleText": "战败下单",
"usingComponents": {
"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"
}
}
......@@ -57,7 +57,28 @@
</view>
</block>
</gl-cell>
<view class="subShopMerchantId" wx:if="{{isShowSubShopMerchant}}">
<gl-cell
border
valueAlign="right"
label="二级流量方"
requiredAfter
labelWidth="180rpx"
required
haveArrow
bindclick="showPopup"
data-show-name="subShopMerchantBox"
placeholder="点击选择"
disabled="{{orderObj.orderSource == 5}}">
<block wx:if="{{orderObj.subShopMerchantName}}">
<view class="between">
{{orderObj.subShopMerchantName}}
</view>
</block>
</gl-cell>
</view>
</view>
<block
wx:for="{{notUpgradeOrderList}}"
wx:for-item="li"
......@@ -203,4 +224,8 @@
sub-title="选择销售顾问"
userInfo="{{userInfo}}"
type="1" />
<sub-shop-merchant
show="{{subShopMerchantBox}}"
title="选择二级流量方"
selectedSelesMerchantId="{{orderObj.merchantId}}"/>
......@@ -3,6 +3,7 @@ import api from '../../api'
const app = getApp()
let toastList = {
userId: '销售顾问不能为空',
subShopMerchantId: '二级流量方不能为空',
customerName: '车主姓名不能为空',
customerPhone: '手机号不能为空',
sellerUserId: '转化人员不能为空',
......@@ -66,7 +67,8 @@ Page({
tipsText: '填写客户信息可保存为客户预录工单。',
showTips: true,
type: 1
}
},
isShowSubShopMerchant: false
},
showCustomPop() {
this.setData({
......@@ -272,7 +274,7 @@ Page({
delete submitObj.selectPayType
}
this.showLoading('提交中...')
let apiName = save && !isErrorOrder ? 'createPrerecordedOrder' : isErrorOrder ? 'correctionOrder' : 'createWithPay'
// 是订单修正就把错误单号带上
if (isErrorOrder) orderObj.oldOrderCode = orderObj.associateOrderCode
......@@ -347,7 +349,7 @@ Page({
// 导入动态校验字段
let { requiredList } = this.data
// console.log(requiredList) ...requiredList,
let target = save ? ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId'] : ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = save ? ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId'] : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
obj = {
...obj,
...obj.customer
......@@ -373,12 +375,12 @@ Page({
}) || phoneShow.pop()
// console.log(phoneConfig)
this.setData({
['orderObj.customer.customerPhone']: phoneConfig.phoneNumber
['orderObj.customer.customerPhone']: phoneConfig?.phoneNumber
})
}
},
setOrderObj(options) {
let { scene, userInfo, isErrorOrder, showTips, isAlreadyExistOrder } = this.data
let { scene, userInfo, isErrorOrder, showTips, isAlreadyExistOrder, subShopMerchantList } = this.data
console.log('setOrderObj', options)
wx.$util.showLoading('加载中...')
let orderObj = {}
......
......@@ -5,6 +5,7 @@
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"coupon": "/components/Coupon/Coupon",
"goods": "/components/Goods/Goods",
"customerInfo": "/components/CustomerInfo/CustomerInfo"
"customerInfo": "/components/CustomerInfo/CustomerInfo",
"sub-shop-merchant" : "/components/subShopMerchant/subShopMerchant"
}
}
......@@ -26,6 +26,26 @@
</block>
</gl-cell>
</view>
<view class="subShopMerchantId" wx:if="{{isShowSubShopMerchant}}">
<gl-cell
border
valueAlign="right"
label="二级流量方"
requiredAfter
labelWidth="180rpx"
required
haveArrow
bindclick="showPopup"
data-show-name="subShopMerchantBox"
placeholder="点击选择"
disabled="{{orderObj.orderSource == 5}}">
<block wx:if="{{orderObj.subShopMerchantName}}">
<view class="between">
{{orderObj.subShopMerchantName}}
</view>
</block>
</gl-cell>
</view>
<view class="customerName">
<gl-cell
border
......@@ -346,6 +366,10 @@
sub-title="选择销售顾问"
userInfo="{{userInfo}}"
type="1" />
<sub-shop-merchant
show="{{subShopMerchantBox}}"
title="选择二级流量方"
selectedSelesMerchantId="{{orderObj.merchantId}}"/>
<car-brands
show="{{carBrandBox}}"
bindconfirm="chooseCar"
......
......@@ -192,6 +192,17 @@ Page({
// 条形码
warrantyCardList.length && this.getBarCode()
this.getServiceBaseInfo(data.merchantId)
// 校验是否显示二级流量方
if (data.subShopMerchantName) {
let { customerObj } = this.data
customerObj[customerObj.length - 2] = {
label: '二级流量方:',
key: 'subShopMerchantName'
}
this.setData({
customerObj
})
}
} else {
wx.showModal({
title: '温馨提示',
......
......@@ -101,7 +101,8 @@ page {
}
.box .cell .label {
width: 146rpx;
flex-shrink: 0;
width: 180rpx;
}
.box .cell .value {
......@@ -117,8 +118,8 @@ page {
}
.customer.box .cell .value {
width: calc(100% - 146rpx);
max-width: calc(100% - 146rpx);
width: calc(100% - 180rpx);
max-width: calc(100% - 180rpx);
}
.box .cell .value .value-item:first-of-type {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!