Commit 8f362389 by 张立顺

合并代码请求

2 parents 9e12ee64 a963d05c
......@@ -104,6 +104,9 @@
"~/*": "/*"
},
"sitemapLocation": "sitemap.json",
"resolveAlias": {
"~/*": "/*"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
......
......@@ -141,7 +141,7 @@ Component({
setCar(data, isApiEvent) {
let { carSeriesId, letter } = this.data
// 处理可能车型没有数据的问题
let letterList = data ? Array.from(new Set([...data.map(e => e.letter)])) : []
let letterList = data && data.length ? Array.from(new Set([...data.map(e => e.letter)])) : []
// console.log(letterList)
let brandList = letterList.map(e => {
let list = []
......
......@@ -27,8 +27,8 @@ Component({
// 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择
let hasSubShopMerchantId = subShopMerchantList.some(item=> item.subMerchantId == orderObj.subShopMerchantId)
if (!hasSubShopMerchantId && subShopMerchantList.length) {
delete orderObj.subShopMerchantId
delete orderObj.subShopMerchantName
delete orderObj?.subShopMerchantId
delete orderObj?.subShopMerchantName
}
thisPage.setData({
orderObj
......@@ -79,7 +79,7 @@ Component({
if (code == '0') {
// 有二级流量方数据 添加必填二级流量方字段
if (data?.length) {
if (requiredList.indexOf('subShopMerchantId') < 0) requiredList.push('subShopMerchantId')
if (!requiredList.includes('subShopMerchantId')) requiredList.unshift('subShopMerchantId')
data.map(i => {
i.active = false
if (i.subMerchantId == orderObj.subShopMerchantId) {
......@@ -90,8 +90,8 @@ Component({
// 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择
let hasSubShopMerchantId = data.some(item=> item.subMerchantId == orderObj.subShopMerchantId)
if (!hasSubShopMerchantId) {
delete orderObj.subShopMerchantId
delete orderObj.subShopMerchantName
delete orderObj?.subShopMerchantId
delete orderObj?.subShopMerchantName
}
thisPage.setData({
requiredList,
......@@ -104,9 +104,9 @@ Component({
})
} else {
// 无二级流量方字段时 清空选择的二级流量方字段
delete orderObj.subShopMerchantId
delete orderObj.subShopMerchantName
requiredList.indexOf('subShopMerchantId') > -1 && requiredList.splice(requiredList.indexOf('subShopMerchantId'), 1)
delete orderObj?.subShopMerchantId
delete orderObj?.subShopMerchantName
if (requiredList.includes('subShopMerchantId')) requiredList.splice(requiredList.indexOf('subShopMerchantId'), 1)
thisPage.setData({
isShowSubShopMerchant: false,
requiredList,
......
......@@ -109,7 +109,7 @@ Page({
wx.$util.showLoading('加载中...')
api.getListSelectAccount().then(res => {
wx.hideLoading()
console.log(res)
// console.log(res)
let { code, data, message } = res
if (code == 0) {
let { loginUserInfoList, sessionId } = data
......@@ -166,7 +166,8 @@ Page({
// : { scene }
} = SCENE
let { target, name } = wx.$util.getSceneId(path)
console.log(query)
// console.log(query)
// console.log(target,name);
wx.$router.reLaunch(`${target}.${name}`, query)
wx.$SCENE = null
} else {
......
......@@ -49,6 +49,7 @@ class Router {
if (thisPage) {
const onRoute = thisPage.onRoute
thisPage.$query = this[_query]
// console.log(this[_query]);
typeof onRoute === 'function' && onRoute(this[_query])
thisPage.showToast = util.showToast
thisPage.showLoading = util.showLoading
......@@ -99,8 +100,10 @@ class Router {
}
checkRouter(route, events) {
// console.log(route)
// console.log(events);
// debugger
this[_query] = events || {}
// console.log(this[_query])
const [_parent, _name] = route.split('.')
let name = route
let parent = this.getPageInstance()?.__route__.split('/')[0]
......@@ -155,7 +158,10 @@ class Router {
}
/**关闭所有页面,打开到应用内的某个页面 */
reLaunch(route, events) {
// console.log(events)
// debugger
let { routerMapItem, query } = this.checkRouter(route, events)
// console.log(query, 'query')
wx.reLaunch({
url: `${routerMapItem.url}${query}`
})
......
......@@ -253,7 +253,11 @@ Page({
// 10s轮询一次待补录
getWaitOrder() {
let { isStaff } = this.data
isStaff &&
// console.log('isStaff', isStaff)
let thisPage = wx.$router.getPageInstance()
console.log(thisPage.route, ' thisPage.route')
thisPage.route == 'tabIndex/pages/index/index' &&
isStaff &&
api
.waitinputorder()
.then(result => {
......@@ -332,35 +336,29 @@ Page({
}
})
},
onRoute(options) {
if (options.supplement) {
this.setData({
showOrderpop: true
})
}
},
init(userInfo) {
getYQInfo(userInfo)
.then(result => {
console.log(result)
// console.log(app.globalData.isYqdSuper)
checkShowOrderPop(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
if (userInfo?.subLoginUser?.merchantId == options.merchantId) {
if (options.merchantId) {
this.setData({
...result
showOrderpop: true
})
})
.catch(err => {})
this.getPageData()
}
}
},
onRoute(options) {
// console.log($query);
// debugger
// console.log(options,'options');
options && this.checkShowOrderPop(options)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(app.globalData.isStaff)
if (options.supplement) {
this.setData({
showOrderpop: true
})
}
// console.log(options)
options && this.checkShowOrderPop(options)
let today = new Date()
let startDate = today.format('yyyy-MM-dd')
let endDate = today.format('yyyy-MM-dd')
......@@ -373,6 +371,7 @@ Page({
this.setData({
isStaff: app.globalData.isStaff
})
// this.getWaitOrder()
},
/**
* 生命周期函数--监听页面初次渲染完成
......@@ -433,13 +432,15 @@ Page({
onHide: function () {
// console.log('onHide')
// console.log(time)
clearTimeout(time)
time && clearTimeout(time)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
onUnload: function () {
time && clearTimeout(time)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
......@@ -7,7 +7,8 @@ export default {
url: 'tabWorkOrder.createOrder'
},
{
name: '战败下单',
name: '客户建档',
// name: '战败下单',
url: 'tabWorkOrder.createArchives'
},
{
......
......@@ -77,51 +77,6 @@ Page({
})
})
.catch(err => {})
// console.log(userInfo)
// debugger
// if (!userInfo.isSuper && userInfo.merchantType && userInfo.userType == 2) {
// this.setData({
// merchantRange: [
// {
// merchantName: userInfo.merchantName
// }
// ],
// subIndex: 0
// })
// return
// }
// let all = {
// merchantName: '全部'
// }
// api.getYQList().then(res => {
// console.log(res)
// wx.hideLoading()
// let { code, data } = res
// if (code == 0) {
// let subIndex = 0
// let arr = []
// if (data.length > 1) {
// if (userInfo.merchantId != userInfo.subLoginUser.merchantId) {
// data.map((e, index) => {
// if (e.merchantId == userInfo.subLoginUser.merchantId) subIndex = index + 1
// })
// }
// arr = [all, ...data]
// } else {
// arr = [
// {
// merchantName: userInfo.merchantName
// }
// ]
// }
// this.setData({
// merchantRange: arr,
// subIndex,
// canRemark: arr.length == 1
// })
// }
// })
// this.getPageData()
},
refresh(data) {
// console.log('refresh')
......@@ -150,8 +105,6 @@ Page({
// console.log('time')
let maxDate = new Date().format('yyyy-MM-dd')
let today = dateNum || new Date().format('yyyy-MM-dd')
// console.log(new Date(today).getTime())
// console.log(today)
/**
* 根据日期字符串获取星期几
* @param dateString 日期字符串(如:2020-05-02)
......@@ -300,6 +253,20 @@ Page({
console.log(err)
})
},
// 获取设备信息
getDeviceSize() {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
success: function (res) {
// console.log(res)
const { screenHeight, safeArea } = res
const { bottom } = safeArea
const bottomLift = screenHeight - bottom
resolve({ bottomLift })
}
})
})
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -307,11 +274,14 @@ Page({
// console.log('onload')
this.setTimeList()
// this.getOrderNum()
let { bottomLift } = app.globalData
if (bottomLift >= 0) {
<<<<<<< HEAD
wx.$util.getDeviceSize().then(res => {
console.log(res, 'res')
=======
this.getDeviceSize().then(res => {
>>>>>>> dev_v4.16.0
const { bottomLift } = res
this.setData({
bottomLift
......
......@@ -96,6 +96,10 @@ module.exports = {
notUpgradeOrder(data) {
return api.post('dj.api.smartcarlife.order.notUpgrade.batchInsert', data)
},
/** 批量新建预录工单 */
createPrerecordedOrderBatch(data) {
return api.post('dj.api.smartcarlife.order.preliminaryOrder.batch', data)
},
/** 新建预录工单 */
createPrerecordedOrder(data) {
return api.post('dj.api.smartcarlife.order.preliminaryOrder', data)
......@@ -107,5 +111,9 @@ module.exports = {
/** 获取商户基本信息 */
getServiceBaseInfo(data) {
return api.post('dj.api.smartcarlife.serviceMerchant.getServiceBaseInfo', data)
},
/** 根据id查询待补录订单 */
waitinputorderSelectById(data) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.selectById', data)
}
}
......@@ -728,6 +728,9 @@ Page({
// if (options.scene) {
// this.setData(options)
// }
// let { supplementId } = options
console.log(options)
options?.supplementId && this.checkShowOrderInfo(options)
},
/**
* 生命周期函数--监听页面初次渲染完成
......@@ -740,46 +743,51 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function (res) {
this.getSetting()
// console.log(111)
// this.saveImageClick()
// console.log(res)
// setTimeout(() => {
// wx.$util.showLoading()
// }, 2000)
},
onRoute(res) {
checkShowOrderInfo(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
console.log(options)
// debugger
let { outTradeNo, totalFee, accountDate } = res
// console.log(res)
// console.log(outTradeNo, totalFee)
this.setData({
outTradeNo,
totalFee: totalFee,
accountDate
})
// console.log(res)
// console.log()
// if (res.scene) {
// res.returnFun = true
// this.setData(res)
// } else if (res.merchantId) {
// this.setData({
// returnFun: true
// })
// this.setOrderObj(res)
// } else {
// wx.$util.showLoading('加载中...')
// this.setData(
// {
// flag: true
// },
// () => {
// wx.$util.hideLoading()
// }
// )
// }
// console.log(11)
this.getSetting()
if (userInfo?.subLoginUser?.merchantId != options.merchantId) {
// wx.$router.go('pages/index')
wx.$router.go('tabIndex.index')
} else {
// 查询补单信息
api
.waitinputorderSelectById({ id: options.supplementId })
.then(result => {
console.log(result)
let { outTradeNo, totalFee, accountDate } = result.data
accountDate && (accountDate = new Date(accountDate).format('yyyy-MM-dd'))
this.setData({
outTradeNo,
totalFee: totalFee*100,
accountDate
})
})
.catch(err => {})
}
},
onRoute(options) {
let { outTradeNo, totalFee, accountDate, supplementId } = options
console.log(options);
// 如果是扫码进来的
if (supplementId) {
return this.checkShowOrderInfo(options)
} else {
this.setData({
outTradeNo,
totalFee: totalFee,
accountDate
})
}
},
/**
* 生命周期函数--监听页面隐藏
......@@ -804,27 +812,27 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
onShareAppMessage: function () {}
// 获取园区店支付配置
getConfig() {
// console.log(this.data.orderObj)
let o = this.data.orderObj
let oParams = {}
oParams.yqMerchantId = o.sellerMerchantId
api.getYqStoreConfig(oParams).then(res => {
console.log(res)
let obj = res.data || {}
let m = obj.supportPayTypes || []
let n = this.data.payTypeList
let list = n.filter(k => {
let idx = m.find(j => j == k.value)
return idx >= 0
})
this.setData({
showPayList: list
})
// console.log(list)
})
}
// getConfig() {
// // console.log(this.data.orderObj)
// let o = this.data.orderObj
// let oParams = {}
// oParams.yqMerchantId = o.sellerMerchantId
// api.getYqStoreConfig(oParams).then(res => {
// console.log(res)
// let obj = res.data || {}
// let m = obj.supportPayTypes || []
// let n = this.data.payTypeList
// let list = n.filter(k => {
// let idx = m.find(j => j == k.value)
// return idx >= 0
// })
// this.setData({
// showPayList: list
// })
// // console.log(list)
// })
// }
})
......@@ -281,7 +281,9 @@ Page({
submit(i) {
this.checkPhoneUseConfig()
// let { save } = i.currentTarget.dataset
console.log(i);
let { type } = i.currentTarget.dataset
console.log(type);
let { orderObj, notUpgradeOrderList, dateObj, isStandNo } = this.data
let key = this.checkRequired(orderObj)
......@@ -309,16 +311,23 @@ Page({
return this.showToast(`请输入第${index + 1}位客户车架号`)
}
}
orderObj = {
...orderObj,
notUpgradeOrderList,
// notUpgradeOrderList,
createDate: dateObj.today
}
if (type=='success') {
orderObj.preliminaryOrders = notUpgradeOrderList
}else{
orderObj.notUpgradeOrderList = notUpgradeOrderList
}
this.showLoading('提交中...')
console.log('orderObj', orderObj)
// return
api.notUpgradeOrder(orderObj).then(res => {
const apiName = type=='success'? 'createPrerecordedOrderBatch':'notUpgradeOrder'
api[apiName](orderObj).then(res => {
wx.hideLoading()
// console.log(orderObj, res)
let { code, data, message } = res
......@@ -328,8 +337,9 @@ Page({
icon: 'success',
title: '提交成功'
})
wx.$router.back()
// wx.$router.back()
// wx.$router.go('tabindex.index')
wx.$router.go('tabIndex.index')
// if (save) {
// wx.showModal({
// title: '温馨提示',
......
{
"navigationBarTitleText": "战败下单",
"navigationBarTitleText": "创建客户档案",
"usingComponents": {
"car-brands": "/components/CarBrands/CarBrands",
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
......
......@@ -214,9 +214,17 @@
<!-- <car-brands show="{{carBrandBox}}" bindconfirm="chooseCar" carSeriesId="{{orderObj.carSeriesId || ''}}" /> -->
<view class="btns {{isFullSucreen?'isFullSucreen-btn':''}}">
<view class="tips">可批量生成当天的战败客户,缺漏信息建档后在工单详情补充</view>
<view class="confirm text-center" bindtap="submit">
{{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}}
<view class="btns-con">
<view class="confirm fail text-center" bindtap="submit">
战败下单
<!-- {{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}} -->
</view>
<view class="confirm save text-center" bindtap="submit" data-type="success">提交</view>
</view>
<!-- <view class="confirm text-center" bindtap="submit">
{{notUpgradeOrderList.length==1?'提交客户工单':'提交'+notUpgradeOrderList.length+'个客户工单'}}
</view> -->
</view>
<merchant-seles
show="{{selesBox}}"
......
......@@ -269,14 +269,35 @@ scroll-view ::-webkit-scrollbar {
height: 80rpx;
background-color: #3582EE;
border-radius: 12rpx;
margin: 0 32rpx;
/* margin: 0 32rpx; */
}
.btns-con {
box-sizing: border-box;
display: flex;
padding: 0 32rpx;
}
.btns-con .save {
width: 480rpx;
}
.btns-con .fail {
width: 186rpx;
margin-right: 20rpx;
background: #FFFFFF;
border: 2rpx solid #DCDEE0;
border-radius: 12rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #323233;
}
.touch-item {
/* margin: 0 20rpx; */
box-sizing: border-box;
position: relative;
box-sizing: border-box;position: relative;
display: flex;
justify-content: space-between;
/* width: calc(100% - 40rpx); */
......
......@@ -369,7 +369,7 @@ Page({
},
checkPhoneUseConfig() {
let { phoneShow, orderObj } = this.data
if (phoneShow && orderObj.merchantName && orderObj.employeeName && !orderObj.customer.customerPhone) {
if (phoneShow && phoneShow.length && orderObj.merchantName && orderObj.employeeName && !orderObj.customer.customerPhone) {
// let list = phoneShow.shopMerchantPhoneList
let phoneConfig =
phoneShow.find(item => {
......
const getUpdateManager = () => {
<<<<<<< HEAD
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
......@@ -20,5 +21,36 @@ const getUpdateManager = () => {
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
=======
let startParamObj = wx.getLaunchOptionsSync()
// 解决朋友圈分享是单页面报错问题
if (wx.canIUse('getUpdateManager') && startParamObj.scene != 1154) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
>>>>>>> dev_v4.16.0
}
export default getUpdateManager
......@@ -33,7 +33,7 @@ class Request {
data: { code, message },
data
} = response
// let thisPage = wx.$router.getPageInstance()
// // console.log(thisPage, 'thisPage')
// let { route, data: pageData } = thisPage
// if (pageData.shareQuery) {
......@@ -44,19 +44,23 @@ class Request {
// }
if (code == 20 || code == 21) {
let thisPage = wx.$router.getPageInstance()
// console.log(thisPage);
wx.hideLoading()
wx.showModal({
title: '温馨提示',
content: '登录过期,请重新登录。',
showCancel: false,
confirmText: '去登录',
confirmColor: '#3582EE',
success(res) {
if (res.confirm) {
getApp().login(true)
if (thisPage.route != 'pages/wxLogin/wxLogin') {
wx.showModal({
title: '温馨提示',
content: '登录过期,请重新登录。',
showCancel: false,
confirmText: '去登录',
confirmColor: '#3582EE',
success(res) {
if (res.confirm) {
getApp().login(true)
}
}
}
})
})
}
} else if (code == -1) {
wx.showToast({
title: message || '网络请求失败',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!