Commit 5a18cd76 by zhangxw

创建预录订单接口调试

1 parent 5b97fa80
......@@ -33,10 +33,8 @@ module.exports = {
return api.post('dj.api.smartcarlife.workWechat.selectAccountLogin', data)
},
/** 车品牌 */
getBrandList() {
return api.post('dj.api.get.car.brandList', {
needCarSeries: true
})
getBrandList(data) {
return api.post('dj.api.get.car.brandList', data)
},
/**获取当前登录账号能查看的园区店列表 */
getYQList() {
......
......@@ -45,6 +45,12 @@
"selectedIconPath": "images/tab-order-active.png"
},
{
"pagePath": "tabDate/pages/index/index",
"text": "预约",
"iconPath": "images/tab-date.png",
"selectedIconPath": "images/tab-date-active.png"
},
{
"pagePath": "tabMine/pages/index/index",
"text": "我的",
"iconPath": "images/tab-mine.png",
......@@ -70,7 +76,8 @@
"qr-box": "components/Qrbox/Qrbox",
"switch-popup": "components/switchPopup/switchPopup",
"order-switchPopup": "components/orderSwitchPopup/orderSwitchPopup",
"modal": "components/modal/modal"
"modal": "components/modal/modal",
"tips-bottom": "components/tipsBottom/index"
},
"sitemapLocation": "sitemap.json",
"permission": {
......
......@@ -18,6 +18,13 @@ Component({
// console.log('carSeriesId')
// if (n) this.init()
// }
},
merchantId: {
type: Number,
value: 0,
observer: function (n) {
if (n) this.init(n)
}
}
},
......@@ -39,7 +46,7 @@ Component({
if (storageData) {
this.getStorData(storageData)
} else {
this.init()
// this.init()
}
},
hide: function () {}
......@@ -61,15 +68,15 @@ Component({
setTimeout(() => {
// 解决数据过大导致在初始化是影响页面布局问题
this.setData({ storageData: carlist })
this.init()
// this.init()
}, 100)
},
init() {
init(num) {
// console.log('getBrandList')
let { storageData } = this.data
// console.log(storageData)
storageData && this.setCar(storageData)
api.getBrandList().then(car => {
api.getBrandList({merchantId: num, needCarSeries: true}).then(car => {
if (car.code == 0) {
// console.log(car.data)
// 如果前面用缓存渲染过就不需要再次用接口的渲染
......@@ -98,11 +105,13 @@ Component({
// 是最后一个特殊处理
let saveData = index + 1 == carDateLength ? carData.slice(start) : carData.slice(start, end)
wx.setStorageSync(stringName, saveData)
// 选择车型与流量来源做关联 不做缓存处理
// wx.setStorageSync(stringName, saveData)
// }
list.push(stringName)
}
wx.setStorageSync('dj_boutique_brand_list', JSON.stringify(list))
// 选择车型与流量来源做关联 不做缓存处理
// wx.setStorageSync('dj_boutique_brand_list', JSON.stringify(list))
// })
// console.log(size / 1000)
// let sizeNum = size / 1000 < 1000
......@@ -207,12 +216,13 @@ Component({
searchCar(e) {
let { value } = e.detail
let { carBrand } = this.data
let { carBrand, merchantId } = this.data
if (!value) {
this.setData({
letter: 'A'
})
this.init()
if (!merchantId) return
this.init(merchantId)
// console.log('searchCar')
return
}
......
......@@ -50,9 +50,12 @@
</view>
</block>
</block>
<block wx:else>
<block wx:if="{{merchantId && brandList.length <= 0}}">
<view class="nothing">暂无数据</view>
</block>
<block wx:if="{{!merchantId}}">
<view class="nothing">请先选择流量来源</view>
</block>
</scroll-view>
<view class="side-bar" id="side-bar">
<block wx:for="{{brandList}}" wx:key="index">
......
......@@ -386,7 +386,7 @@ Component({
date: { start, end }
} = e.detail
data.map(i => (i.active = false))
let index = type == 1 ? 3 : 5
let { index } = e.currentTarget.dataset
data[index] = {
name: `${start} 至 ${end}`,
active: true,
......
......@@ -55,7 +55,7 @@
<view class="list-box">
<block wx:for="{{form.timeList.data}}" wx:key="index">
<block wx:if="{{item.type}}">
<calendar allowSameDay shortcut bindselect='rangeSelect' rangeAll dateType='range' calenderColor='#3582EE'
<calendar allowSameDay shortcut bindselect='rangeSelect' data-index="{{index}}" rangeAll dateType='range' calenderColor='#3582EE'
vertical minDate="2020-10-01" maxDate="{{maxDate}}" isComponents>
<view class="item text-center {{item.active?'active':''}}">{{item.name}}</view>
</calendar>
......@@ -110,7 +110,7 @@
<block wx:for="{{form.timeList.data}}" wx:key="index">
<block wx:if="{{item.type}}">
<view class="calendar">
<calendar allowSameDay shortcut bindselect='rangeSelect' rangeAll dateType='range'
<calendar allowSameDay shortcut bindselect='rangeSelect' data-index="{{index}}" rangeAll dateType='range'
calenderColor='#3582EE' vertical minDate="{{minDate}}" maxDate="{{maxDate}}" isComponents>
<view class="item text-center {{item.active?'active':''}}">{{item.name}}</view>
</calendar>
......
......@@ -48,7 +48,7 @@ Component({
// console.log(thisPage.data)
// console.log(thisPage)
// 处理组件实例化比页面快用上一个页面数据的问题
if (thisPage?.data?.name != 'createdOrder') return
if (!thisPage?.data?.name) return
let { orderObj } = thisPage.data
let isSellerInfo
// debugger
......
......@@ -6,6 +6,18 @@ Page({
*/
data: {
detail: {},
orderObj: {
customer: {
customerName: '',
customerPhone: '',
standNo: '',
plateNumber: '',
customerSex: 1,
experienceFlag: 'Y'
},
remark: '',
selectPayType: 2,
},
customerObj: [
{
label: '客户姓名',
......@@ -233,6 +245,12 @@ Page({
})
}
},
// 去下单
orderSubmit() {
let { detail } = this.data
detail.isAppointment = true
wx.$router.redirectTo('tabWorkOrder.createOrder', detail)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
<!-- tabDate/pages/detail/detail.wxml -->
<block wx:if="{{flag}}">
<view class="main">
<view class="main {{isFullSucreen?'isFullSucreen':''}}">
<view class="box">
<view class="title">客户信息</view>
<view class="customer-list">
......@@ -107,6 +107,9 @@
<view class="nothing text-center">暂无记录</view>
</block>
</view>
<view class="btns {{isFullSucreen?'isFullSucreen-btn':''}}">
<view class="btn text-center" bindtap="orderSubmit">去下单</view>
</view>
</view>
<date-picker show="{{showDate}}" merchantId="{{detail.merchantCoupon.yqMerchantId}}" />
<remark-popup
......
......@@ -4,7 +4,11 @@ page {
}
.main {
padding: 20rpx 20rpx 60rpx;
padding: 20rpx 20rpx 120rpx;
}
.isFullSucreen {
padding-bottom: 102px !important;
}
.box {
......@@ -293,4 +297,29 @@ page {
left: 50%;
transform: translateX(-50%);
content: '';
}
.isFullSucreen-btn {
padding-bottom: 34px !important;
}
.btns {
position: fixed;
z-index: 998;
left: 0;
bottom: 0;
width: 100%;
box-sizing: border-box;
min-height: 100rpx;
background: #FFFFFF;
padding-bottom: 10rpx;
}
.btns .btn {
height: 80rpx;
background: #3582EE;
border-radius: 12rpx;
font-size: 28rpx;
color: #FFFFFF;
margin: 10rpx 32rpx;
}
\ No newline at end of file
......@@ -39,7 +39,7 @@ Page({
},
3: {
text: '取消预约',
color: '#999999'
color: '#FF7D12'
},
4: {
text: '已施工',
......@@ -47,7 +47,7 @@ Page({
},
5: {
text: '过期到店',
color: '#999999'
color: '#FF7D12'
}
},
searchObj: {},
......
<navigation-bar bindnavbarReady="navbarReady" showBack bindback="back">
<navigation-bar bindnavbarReady="navbarReady" showBack="{{show_confirm}}" bindback="back">
{{!show_confirm?'预约管理':'筛选'}}
</navigation-bar>
<block wx:if="{{navBarHeight > 0}}">
......@@ -26,10 +26,10 @@
<block wx:if="{{list.length > 0}}">
<block wx:for="{{list}}" wx:key="index">
<block wx:for="{{item}}" wx:for-item="li" wx:for-index="ind" wx:key="ind">
<view class="item" catchtap="jump" data-name="detail" data-item="{{li}}">
<view class="item list-item" catchtap="jump" data-name="detail" data-item="{{li}}">
<view class="status" style="color:{{status[li.inviteStatus].color}}">
<block>{{status[li.inviteStatus].text}}</block>
<block wx:if="{{li.inviteStatus ==1 || li.inviteStatus == 2}}">
<block wx:if="{{li.inviteStatus !==4}}">
<view class="line" style="background-color:{{status[li.inviteStatus].color}};"></view>
</block>
</view>
......
......@@ -3,16 +3,23 @@
.list .list-item{
margin: 20rpx;
box-shadow: 0 4rpx 20rpx 0 rgba(0, 0, 0, 0.10);
border-radius: 16rpx;
}
.list .item .status {
background: none;
top: 40rpx;
text-align: center;
}
.list .item .status .line {
position: absolute;
top: -40rpx;
left: 0;
width: 84rpx;
width: 100%;
height: 12rpx;
border-radius: 16rpx;
}
......
......@@ -45,10 +45,16 @@ Page({
},
isStaff: false,
showOrderpop: false,
waitInputCount: 0
waitInputCount: 0,
tipsProps: {
tipsText: "该门店产生异常订单,请点击补录!",
showTips: true,
type: 2,
typeText: "补录订单"
}
// tableWidth: 606 + 28
},
showOrderPop() {
tipsEvent() {
this.setData({
showOrderpop: true
})
......
......@@ -233,11 +233,14 @@
</view>
</view>
</block>
<view class="waitOrderCon" wx:if="{{waitInputCount}}">
<!-- <view class="waitOrderCon" wx:if="{{waitInputCount}}">
<image class="tipsIcon" src="../../../images/tips.png" />
<view class="label">该门店产生异常订单,请点击补录!</view>
<view class="btn" bindtap="showOrderPop">补录订单</view>
</view>
</view> -->
<view class="waitOrderCon" wx:if="{{waitInputCount}}">
<tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{tipsProps}}"></tips-bottom>
</view>
</view>
<remark-popup
wx:if="{{showRemark}}"
......
......@@ -48,7 +48,7 @@ page ::-webkit-scrollbar {
background-image: linear-gradient(166deg, #65b8f8 0%, #3582ee 100%);
display: grid;
align-items: center;
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(3, 1fr);
}
.menu .item {
......@@ -535,7 +535,7 @@ page ::-webkit-scrollbar {
font-size: 24rpx;
font-weight: 600;
color: #3582EE;
padding: 0 20rpx;
/* padding: 0 20rpx; */
height: 74rpx;
background: #EFF5FE;
z-index: 9;
......
......@@ -11,14 +11,10 @@ export default {
url: 'tabWorkOrder.createArchives'
},
// {
// name: '扫码核销',
// wxCallBack: 'scanCode'
// name: '预约管理',
// url: 'tabDate.index'
// },
{
name: '预约管理',
url: 'tabDate.index'
},
{
name: '经营数据',
url: 'tabOperating.index'
}
......
......@@ -93,5 +93,9 @@ module.exports = {
/** 战败订单批量补录 */
notUpgradeOrder(data) {
return api.post('dj.api.smartcarlife.order.notUpgrade.batchInsert', data)
},
/** 新建预录工单 */
createPrerecordedOrder(data) {
return api.post('dj.api.smartcarlife.order.preliminaryOrder', data)
}
}
......@@ -301,7 +301,7 @@
sub-title="选择销售顾问"
userInfo="{{userInfo}}"
type="1" />
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId || ''}}" />
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId || ''}}" merchantId="{{orderObj.merchantId || undefined}}" />
<remark-popup
wx:if="{{showRemark}}"
show="{{showRemark}}"
......
......@@ -57,7 +57,13 @@ Page({
userInfo: {},
requiredList: [],
isErrorOrder: false,
showTips: false
isAlreadyExistOrder: false,
showTips: false,
tipsProps: {
tipsText: "填写客户信息可保存为客户预录工单。",
showTips: true,
type: 1,
}
},
closeTips() {
this.setData({
......@@ -295,17 +301,17 @@ Page({
submit(i) {
let { save } = i.currentTarget.dataset
let { orderDisabled, goodsList, orderObj, scene, isErrorOrder } = this.data
let { orderDisabled, goodsList, orderObj, scene, isErrorOrder, isAlreadyExistOrder } = this.data
// 如果是错单补录 禁用掉保存功能
if (isErrorOrder && save) return
// 如果是错单补录 禁用掉保存功能 或待跟进订单/预约订单 禁用建档
if ((isErrorOrder && save) || (isAlreadyExistOrder && save)) return
// 判断商户配置财务规则
// if (!canOrder) {
// return this.showToast('未设置分润规则 请联系管理员')
// }
let key = this.checkRequired(orderObj)
let key = this.checkRequired(save, orderObj)
console.log(key)
// debugger
if (key) {
......@@ -330,27 +336,10 @@ Page({
// if (!save) {
let subOrderList = []
let priceDisabled = true
if (orderObj.selectPayType != 0) {
if (goodsList) {
goodsList.map(e => {
let obj = {
baseGoodsId: e.baseGoodsId,
upgradeGoodsId: e.id,
totalPrice: Number(e.price),
number: e.count
}
if (e.price < e.shopMinPrice) priceDisabled = false
subOrderList.push(obj)
})
orderObj.subOrderList = subOrderList
}
if (subOrderList.length == 0) {
this.showToast('商品不能为空')
return
}
} else {
// 不升级删除商品参数
delete orderObj.subOrderList
let goodsKey = this.checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj)
if (goodsKey) {
this.showToast(goodsKey)
return
}
// else {
// if (!orderObj.customerCouponCode) {
......@@ -358,10 +347,6 @@ Page({
// return
// }
// }
if (!priceDisabled) {
this.showToast('单价不可低于商品最低价')
return
}
// }
// console.log(orderObj.subOrderList)
......@@ -385,18 +370,23 @@ Page({
// console.log(orderObj)
// return
// return console.log(orderObj)
// return
let submitObj = JSON.parse(JSON.stringify(orderObj))
if (save) { // 建档删除卡券商品支付方式参数
delete submitObj.subOrderList
delete submitObj.customerCouponCode
delete submitObj.selectPayType
}
this.showLoading('提交中...')
// 判断是不是 修改订单 是走另外接口逻辑
// if (isErrorOrder) {
// return this.setCorrectionOrder(orderObj)
// }
let apiName = isErrorOrder ? 'correctionOrder' : 'createWithPay'
let apiName = save && !isErrorOrder ? 'createPrerecordedOrder' : isErrorOrder ? 'correctionOrder' : 'createWithPay'
// 是订单修正就把错误单号带上
if (isErrorOrder) orderObj.oldOrderCode = orderObj.associateOrderCode
api[apiName](orderObj).then(res => {
api[apiName](submitObj).then(res => {
wx.hideLoading()
// console.log(orderObj, res)
let { code, data, message } = res
......@@ -428,11 +418,41 @@ Page({
}
})
},
checkRequired(obj) {
checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) {
if (save) return false
if (orderObj.selectPayType != 0) {
if (goodsList) {
goodsList.map(e => {
let obj = {
baseGoodsId: e.baseGoodsId,
upgradeGoodsId: e.id,
totalPrice: Number(e.price),
number: e.count
}
if (e.price < e.shopMinPrice) priceDisabled = false
subOrderList.push(obj)
})
orderObj.subOrderList = subOrderList
}
if (subOrderList.length == 0) {
return '商品不能为空'
}
} else {
// 不升级删除商品参数
delete orderObj.subOrderList
}
if (!priceDisabled) {
return '单价不可低于商品最低价'
}
// if (orderObj.selectPayType == null) {
// return '请选择支付方式'
// }
},
checkRequired(save, obj) {
// 导入动态校验字段
let { requiredList } = this.data
// console.log(requiredList) ...requiredList,
let target = ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = save ? ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId'] : ['userId', 'merchantId', 'employeeName', 'customerName', 'customerPhone', ...requiredList, 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
obj = {
...obj,
...obj.customer
......@@ -499,7 +519,7 @@ Page({
}
if (!orderObj.customer.customerSex) orderObj.customer.customerSex = 1
if (!orderObj.customer.experienceFlag) orderObj.customer.experienceFlag = 'N'
if (orderObj.associateOrderCode) {
// if (orderObj.oldOrderCode) {
wx.setNavigationBarTitle({
......@@ -520,6 +540,10 @@ Page({
}
})
}
// 预约工单跳转下单(处理园区店id参数 保证可以拿到园区店的礼券yqMerchantId)
if (options.yqMerchantId && options.isAppointment) {
orderObj.sellerMerchantId = options.yqMerchantId
}
this.setData({
orderObj,
first: true,
......@@ -732,15 +756,36 @@ Page({
// setTimeout(() => {
// wx.$util.showLoading()
// }, 2000)
wx.disableAlertBeforeUnload && wx.disableAlertBeforeUnload() //关闭小程序页面返回询问对话框
},
onRoute(res) {
// debugger
// console.log(res)
console.log(res)
// console.log()
let { tipsProps, isAlreadyExistOrder } = this.data
if (Object.keys(res).length > 0 ) {
if (res.associateOrderCode) {
tipsProps.showTips = true
tipsProps.tipsText = '原订单录入信息有误,请重新提交正确的订单信息。'
} else if (res.orderCode) { // 以建档(预约列表)/待跟进工单不可建档
isAlreadyExistOrder = true
tipsProps.showTips = false
}
this.setData({
tipsProps,
isAlreadyExistOrder
})
}
if (res.scene) {
res.returnFun = true
this.setData(res)
// 扫描核销进入新建工单 不可建档
isAlreadyExistOrder = true
tipsProps.showTips = false
this.setData({
res,
tipsProps,
isAlreadyExistOrder
})
} else if (res.merchantId) {
this.setData({
returnFun: true
......
<wxs src="index.wxs" module="filter" />
<block wx:if="{{flag}}">
<view class="main {{isFullSucreen?'isFullSucreen':''}} {{showTips?'fullSucreen-tips':'' }}">
<view class="main {{isFullSucreen?'isFullSucreen':''}} {{tipsProps.showTips?'fullSucreen-tips':'' }}">
<view class="box">
<view class="userId">
<gl-cell
......@@ -206,7 +206,7 @@
labelWidth="140rpx"
haveArrow
requiredAfter
required
required
value="{{(orderObj.couponName || '') + (orderObj.customerCouponCode || '')}}"
placeholder="点击选择"
bindclick="showPopup"
......@@ -220,7 +220,7 @@
labelWidth="140rpx"
haveArrow
requiredAfter="{{ orderObj.selectPayType != 0 }}"
required="{{ orderObj.selectPayType != 0 }}"
required="{{ orderObj.selectPayType != 0 }}"
placeholder="点击选择"
bindclick="showPopup"
data-show-name="goodsBox" />
......@@ -312,21 +312,26 @@
</view>
<view class="btns {{isFullSucreen?'isFullSucreen-btn':''}}">
<!-- wx:if="{{isErrorOrder}}" -->
<view class="tips" wx:if="{{showTips}}">
<!-- <view class="tips" wx:if="{{showTips}}">
<image class=" tipsIcon" src="../../../images/tips.png" />
<view class="contentText">
原订单录入信息有误,请重新提交正确的订单信息。
原订单录入信息有误,请重新提交正确的订单信息。 -->
<!-- <view>支付订单号:{{outTradeNo}}</view>
<view>支付时间:{{accountDate}}</view> -->
</view>
<!-- </view>
<image class="closeIcon" bindtap="closeTips" src="../../images/closeIcon.png" />
</view>
<view class="btns-con">
</view> -->
<!-- <view class="btns-con">
<view class="save text-center {{isErrorOrder ?'disabled':''}}" bindtap="submit" data-save>
保存
</view>
<view class="confirm text-center" bindtap="submit">提交工单</view>
</view>
</view> -->
<tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{tipsProps}}"></tips-bottom>
<view class="btns-con">
<view class="save text-center {{isErrorOrder || isAlreadyExistOrder ?'disabled':''}}" bindtap="submit" data-save>建档</view>
<view class="confirm text-center" bindtap="submit">直接下单</view>
</view>
</view>
</block>
<merchant-seles
......@@ -335,7 +340,7 @@
sub-title="选择销售顾问"
userInfo="{{userInfo}}"
type="1" />
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId || ''}}" />
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId || ''}}" merchantId="{{orderObj.merchantId || undefined}}" />
<remark-popup
wx:if="{{showRemark}}"
show="{{showRemark}}"
......
......@@ -237,7 +237,7 @@ page {
min-height: 100rpx;
background: #FFFFFF;
box-sizing: border-box;
padding: 10rpx 32rpx;
padding: 10rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
......@@ -278,8 +278,17 @@ page {
box-sizing: border-box;
}
.btns .save,
.confirm {
border: 2rpx solid #0075F9;
border-radius: 12rpx;
height: 80rpx;
box-sizing: border-box;
}
.btns .save {
width: 186rpx;
margin-right: 20rpx;
color: #3582EE;
margin-right: 20rpx;
}
......
......@@ -89,7 +89,7 @@
wx:for-item="i"
wx:for-index="sindex">
<view class="goods" wx:if="{{sindex < 2}}">
<view class="goods-name text-hide">{{i.upgradeGoodsName}}</view>
<view class="goods-name text-hide">{{i.upgradeGoodsName || ''}}</view>
<view class="goods-price">
¥
<text>{{i.totalPrice || 0}}</text>
......
......@@ -276,7 +276,7 @@
sub-title="选择销售顾问"
userInfo="{{userInfo}}"
type="1" /> -->
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId}}" />
<car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.customer.carSeriesId}}" merchantId="{{orderObj.merchantId || undefined}}" />
<remark-popup
wx:if="{{showRemark}}"
show="{{showRemark}}"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!