Commit c5fd6a26 by 前端

Merge branch 'develop' into 'master'

Develop

See merge request !11
2 parents 35002313 86186904
No preview for this file type
...@@ -11,10 +11,10 @@ const systemInfo = wx.getSystemInfoSync() ...@@ -11,10 +11,10 @@ const systemInfo = wx.getSystemInfoSync()
// console.log(systemInfo); // console.log(systemInfo);
// console.log(accountInfo.miniProgram.envVersion) // console.log(accountInfo.miniProgram.envVersion)
//手动控制体验版环境的请求 true就依据下面index false就默认为2 //手动控制体验版环境的请求 true就依据下面index false就默认为2
const manual = true const manual = false
const release = false const release = false
let index = 4 let index = 1
// 判断小程序环境 // 判断小程序环境
// develop:开发版(正常开发工具,测试时) // develop:开发版(正常开发工具,测试时)
......
...@@ -123,7 +123,7 @@ App({ ...@@ -123,7 +123,7 @@ App({
let userInfo = util.getUserInfo() let userInfo = util.getUserInfo()
let sessionId = util.getSessionId() let sessionId = util.getSessionId()
if (sessionId && userInfo) { if (sessionId && userInfo) {
util.setWebSocket() // util.setWebSocket()
return return
} }
router.reLaunch('pages.wxLogin') router.reLaunch('pages.wxLogin')
......
<wxs src="index.wxs" module="filter" />
<popup show="{{show}}" title="选择商品" bindconfirm="confirm"> <popup show="{{show}}" title="选择商品" bindconfirm="confirm">
<view class="coupon-box"> <view class="coupon-box">
<search-input bindsearch="searchGoods" /> <search-input bindsearch="searchGoods" />
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
data-ind="{{ind}}" data-ind="{{ind}}"
data-item="{{i}}"> data-item="{{i}}">
<view class="name text-hide {{i.active?'textWidth':''}}"> <view class="name text-hide {{i.active?'textWidth':''}}">
{{i.upgradeGoodsName || i.goodsInfo.goodsName}} {{filter.replaceItemText(i.upgradeGoodsName) || filter.replaceItemText(i.goodsInfo.goodsName)}}
</view> </view>
<view class="last" wx:if="{{!i.active}}"> <view class="last" wx:if="{{!i.active}}">
<!-- | --> <!-- | -->
......
var replaceItemText = function (item) {
// console.log(item)
return item.replace(';~;', ' ')
}
/*
* 导出
*/
module.exports = {
replaceItemText: replaceItemText
}
...@@ -43,32 +43,44 @@ Component({ ...@@ -43,32 +43,44 @@ Component({
}) })
}, },
getMerchantList(refresh) { getMerchantList(refresh) {
let { userInfo, type } = this.data let {
userInfo,
type
} = this.data
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
// console.log(thisPage.data) // console.log(thisPage.data)
// console.log(thisPage) // console.log(thisPage)
// 处理组件实例化比页面快用上一个页面数据的问题 // 处理组件实例化比页面快用上一个页面数据的问题
if (!thisPage?.data?.name) return if (!thisPage?.data?.name) return
let { orderObj } = thisPage.data let {
orderObj
} = thisPage.data
let isSellerInfo let isSellerInfo
// debugger // debugger
// console.log('orderObj', orderObj) // console.log('orderObj', orderObj)
let callBackName = type == 1 ? 'getServiceMerchantList' : 'getYQList' let callBackName = type == 1 ? 'getServiceMerchantList' : 'getYQList'
api[callBackName]( api[callBackName](
type == 1 type == 1 ?
? { {
merchantId: userInfo.merchantId merchantId: userInfo.merchantId
} } :
: {} {}
).then(res => { ).then(res => {
let { code, data, message } = res let {
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
// console.log('data', data) // console.log('data', data)
// 解决为空报错问题 // 解决为空报错问题
if (data[0]) data[0].active = true if (data[0]) data[0].active = true
let { merchantId, merchantName } = data[0] || {} let {
merchantId,
merchantName
} = data[0] || {}
let compareId = type == 1 ? orderObj.merchantId : orderObj.sellerMerchantId let compareId = type == 1 ? orderObj.merchantId : orderObj.sellerMerchantId
// 增加默认勾选逻辑 // 增加默认勾选逻辑
...@@ -127,11 +139,14 @@ Component({ ...@@ -127,11 +139,14 @@ Component({
// userInfo, // userInfo,
type, type,
merchantList, merchantList,
isFirst isFirst,
orderObj: comOrderObj
} = this.data } = this.data
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data let {
orderObj
} = thisPage.data
api api
.getConversionEmployeeList({ .getConversionEmployeeList({
merchantId merchantId
...@@ -139,10 +154,17 @@ Component({ ...@@ -139,10 +154,17 @@ Component({
}) })
.then(res => { .then(res => {
wx.$util.hideLoading() wx.$util.hideLoading()
let { code, data, message } = res let {
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
if (data && data.length) { if (data && data.length) {
let { staffName, uuid } = data[0] let {
staffName,
uuid
} = data[0]
data[0].active = true data[0].active = true
// console.log(orderObj.sellerUserId) // console.log(orderObj.sellerUserId)
let compareId = type == 1 ? orderObj.userId : orderObj.sellerUserId let compareId = type == 1 ? orderObj.userId : orderObj.sellerUserId
...@@ -178,10 +200,21 @@ Component({ ...@@ -178,10 +200,21 @@ Component({
e.active = true e.active = true
staffName = e.staffName staffName = e.staffName
uuid = e.uuid uuid = e.uuid
// 没有就自动回显到页面
if (!orderObj.userId) {
thisPage.setData({
['orderObj.employeeName']: staffName,
['orderObj.userId']: uuid,
['orderObj.merchantId']: comOrderObj.merchantId,
['orderObj.merchantName']: comOrderObj.merchantName
})
setTimeout(() => {
this.confirm()
}, 10)
}
} }
}) })
} }
// merchantList // merchantList
} }
...@@ -213,8 +246,14 @@ Component({ ...@@ -213,8 +246,14 @@ Component({
}, },
defaultChecked() { defaultChecked() {
// console.log('defaultChecked') // console.log('defaultChecked')
let { selesList, orderObj } = this.data let {
selesList = selesList.length ? selesList : [{ uuid: -1, staffName: '系统' }] selesList,
orderObj
} = this.data
selesList = selesList.length ? selesList : [{
uuid: -1,
staffName: '系统'
}]
selesList.forEach((element, index) => { selesList.forEach((element, index) => {
if (index == 0) { if (index == 0) {
element.active = true element.active = true
...@@ -232,8 +271,15 @@ Component({ ...@@ -232,8 +271,15 @@ Component({
this.confirm() this.confirm()
}, },
changeMerchant(e) { changeMerchant(e) {
let { index, item } = e.currentTarget.dataset let {
let { merchantList, orderObj, type } = this.data index,
item
} = e.currentTarget.dataset
let {
merchantList,
orderObj,
type
} = this.data
let merchantId = type == 1 ? orderObj.merchantId : orderObj.sellerMerchantId let merchantId = type == 1 ? orderObj.merchantId : orderObj.sellerMerchantId
if (merchantId == item.merchantId) return if (merchantId == item.merchantId) return
merchantList.map(i => (i.active = false)) merchantList.map(i => (i.active = false))
...@@ -255,9 +301,15 @@ Component({ ...@@ -255,9 +301,15 @@ Component({
}, },
async confirm() { async confirm() {
let data = this.data.orderObj let data = this.data.orderObj
let { type } = this.data let {
type
} = this.data
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj, goodsList,accountDate } = thisPage.data let {
orderObj,
goodsList,
accountDate
} = thisPage.data
orderObj = { orderObj = {
...orderObj, ...orderObj,
...data ...data
...@@ -280,7 +332,7 @@ Component({ ...@@ -280,7 +332,7 @@ Component({
// debugger // debugger
// if (accountDate) { // if (accountDate) {
// // debugger // // debugger
// // // //
// result = await api.merchantSettleAccountRuleGetByEffectDate({ merchantId: data.merchantId,effectDate:accountDate }) // result = await api.merchantSettleAccountRuleGetByEffectDate({ merchantId: data.merchantId,effectDate:accountDate })
// if (JSON.stringify(result.data) === '{}' || result.data == null) { // if (JSON.stringify(result.data) === '{}' || result.data == null) {
// return wx.$util.showToast({ // return wx.$util.showToast({
...@@ -288,22 +340,31 @@ Component({ ...@@ -288,22 +340,31 @@ Component({
// duration: 3000, // duration: 3000,
// icon:'none' // icon:'none'
// }) // })
// } // }
// console.log(result); // console.log(result);
// } else { // } else {
// } // }
result = await api.merchantSettleAccountRule({ merchantId: data.merchantId,sceneType:1 })
if (JSON.stringify(result.data) === '{}' || result.data == null) { // 解决查财务规则太慢的问题 如果是用保存的回显选 跳过检验
return wx.$util.showToast('未设置分润规则 请联系管理员') let orderSellerInfo = util.getSellerInfo()
if (orderSellerInfo?.merchantId == data.merchantId) {
thisPage.getOrderBaseGoodsList && thisPage.getOrderBaseGoodsList(orderObj.merchantId)
} else {
result = await api.merchantSettleAccountRule({
merchantId: data.merchantId,
sceneType: 1
})
if (JSON.stringify(result.data) === '{}' || result.data == null) {
return wx.$util.showToast('未设置分润规则 请联系管理员')
}
} }
console.log(result)
console.log(result)
let userInfo = util.getUserInfo()
// 保存销售勾选做回显 // 保存销售勾选做回显
util.setSellerInfo(this.data.orderObj) util.setSellerInfo({...this.data.orderObj,subLoginMechantId:userInfo.subLoginUser.merchantId})
thisPage.getOrderBaseGoodsList && thisPage.getOrderBaseGoodsList(orderObj.merchantId) thisPage.getOrderBaseGoodsList && thisPage.getOrderBaseGoodsList(orderObj.merchantId)
delete orderObj.couponName delete orderObj.couponName
...@@ -332,9 +393,15 @@ Component({ ...@@ -332,9 +393,15 @@ Component({
// console.log(e) // console.log(e)
let { let {
index, index,
item: { staffName, uuid } item: {
staffName,
uuid
}
} = e.currentTarget.dataset } = e.currentTarget.dataset
let { type, selesList } = this.data let {
type,
selesList
} = this.data
selesList.map(i => (i.active = false)) selesList.map(i => (i.active = false))
selesList[index].active = true selesList[index].active = true
let targetName = type == 1 ? 'orderObj.employeeName' : 'orderObj.sellerName' let targetName = type == 1 ? 'orderObj.employeeName' : 'orderObj.sellerName'
...@@ -347,6 +414,14 @@ Component({ ...@@ -347,6 +414,14 @@ Component({
} }
}, },
lifetimes: { lifetimes: {
attached() {} attached() {
// let userInfo = util.getUserInfo()
let userInfo = util.getUserInfo()
// 老的没有绑定就清空掉 或者切换过账号的
let sellerInfo = util.getSellerInfo()
if (!sellerInfo?.subLoginMechantId || sellerInfo?.subLoginMechantId!= userInfo.subLoginUser.merchantId) {
util.removeSellerInfo()
}
}
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -63,7 +63,7 @@ Page({ ...@@ -63,7 +63,7 @@ Page({
.then(res => { .then(res => {
let { data, message } = res let { data, message } = res
if (data) { if (data) {
wx.$util.setWebSocket() // wx.$util.setWebSocket()
wx.$util.setUserInfo(data.loginUserInfoList[0]) wx.$util.setUserInfo(data.loginUserInfoList[0])
// console.log(data.loginUserInfoList[0]) // console.log(data.loginUserInfoList[0])
......
...@@ -180,6 +180,7 @@ Page({ ...@@ -180,6 +180,7 @@ Page({
// } // }
if (time) clearInterval(time) if (time) clearInterval(time)
this.checkPhoneShow(app.globalData.YQorderSetting.yqPhoneConfig) this.checkPhoneShow(app.globalData.YQorderSetting.yqPhoneConfig)
wx.$util.setWebSocket()
}, },
onRoute(options) { onRoute(options) {
if (options.orderCode) { if (options.orderCode) {
......
...@@ -247,6 +247,7 @@ Page({ ...@@ -247,6 +247,7 @@ Page({
api.getServiceBaseInfo({merchantId}) .then((result) => { api.getServiceBaseInfo({merchantId}) .then((result) => {
console.log(result,'result'); console.log(result,'result');
let {data,code} =result let {data,code} =result
console.log(data);
if (data.cardCodeFlag&&data.cardCodeFlag==1) { if (data.cardCodeFlag&&data.cardCodeFlag==1) {
this.setData({ this.setData({
warrantyCardVisible:false warrantyCardVisible:false
......
...@@ -119,13 +119,13 @@ Page({ ...@@ -119,13 +119,13 @@ Page({
// 把锁定的优惠券也取消锁定 // 把锁定的优惠券也取消锁定
// 把优惠券的值清空 // 把优惠券的值清空
let child = this.selectComponent('.coupon') // let child = this.selectComponent('.coupon')
child.setData({ // child.setData({
chooseItem: { // chooseItem: {
// couponName:'', // // couponName:'',
// [key]: id // // [key]: id
} // }
}) // })
this.setData({ this.setData({
orderObj, orderObj,
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<view class="icon" bindtap="delGoodsList" data-index="{{index}}"> <view class="icon" bindtap="delGoodsList" data-index="{{index}}">
<image src="../../images/del.png" /> <image src="../../images/del.png" />
</view> </view>
<view class="name text-hide">{{item.goodsInfo.goodsName}}</view> <view class="name text-hide">{{filter.replaceItemText(item.upgradeGoodsName) || filter.replaceItemText(item.goodsInfo.goodsName)}}</view>
<view class="price-box"> <view class="price-box">
¥ ¥
<view class="price"> <view class="price">
......
...@@ -5,9 +5,15 @@ var isIncludesItem = function (list, item) { ...@@ -5,9 +5,15 @@ var isIncludesItem = function (list, item) {
return list.indexOf(item) != -1 return list.indexOf(item) != -1
} }
var replaceItemText = function (item) {
// console.log(item)
return item.replace(';~;', ' ')
}
/* /*
* 导出 * 导出
*/ */
module.exports = { module.exports = {
isIncludesItem: isIncludesItem isIncludesItem: isIncludesItem,
replaceItemText: replaceItemText
} }
...@@ -294,6 +294,7 @@ Page({ ...@@ -294,6 +294,7 @@ Page({
this.setData({ this.setData({
customerService: '' customerService: ''
}) })
// setTimeout(() => { // setTimeout(() => {
let { failCustomerService, defaultCustomerService } = this.data let { failCustomerService, defaultCustomerService } = this.data
let { orderCode, customerPhone: phoneNumber, selectPayType } = this.data.orderInfo let { orderCode, customerPhone: phoneNumber, selectPayType } = this.data.orderInfo
......
...@@ -231,6 +231,9 @@ const getSellerInfo = () => { ...@@ -231,6 +231,9 @@ const getSellerInfo = () => {
let sellerInfo = wx.getStorageSync('dj_boutique_seller_info') || null let sellerInfo = wx.getStorageSync('dj_boutique_seller_info') || null
return JSON.parse(sellerInfo) return JSON.parse(sellerInfo)
} }
const removeSellerInfo = ()=>{
wx.removeStorageSync('dj_boutique_seller_info')
}
const setUserInfo = userInfo => { const setUserInfo = userInfo => {
wx.setStorageSync('dj_boutique_user_info', JSON.stringify(userInfo)) wx.setStorageSync('dj_boutique_user_info', JSON.stringify(userInfo))
} }
...@@ -244,7 +247,7 @@ const setSessionId = sessionId => { ...@@ -244,7 +247,7 @@ const setSessionId = sessionId => {
const removeStorage = () => { const removeStorage = () => {
wx.removeStorageSync('dj_boutique_user_info') wx.removeStorageSync('dj_boutique_user_info')
wx.removeStorageSync('dj_boutique_sessionId') wx.removeStorageSync('dj_boutique_sessionId')
wx.removeStorageSync('dj_boutique_seller_info') // wx.removeStorageSync('dj_boutique_seller_info')
} }
const showNoAccess = () => { const showNoAccess = () => {
showToast('您的账号无法完成此操作') showToast('您的账号无法完成此操作')
...@@ -281,11 +284,11 @@ const setWebSocket = () => { ...@@ -281,11 +284,11 @@ const setWebSocket = () => {
} }
} }
}) })
wx.onSocketClose(_res_ => { // wx.onSocketClose(_res_ => {
setTimeout(() => { // setTimeout(() => {
setWebSocket() // setWebSocket()
}, 30 * 1000) // }, 30 * 1000)
}) // })
} }
}) })
} }
...@@ -459,6 +462,7 @@ const Util = { ...@@ -459,6 +462,7 @@ const Util = {
setSessionId, setSessionId,
setSellerInfo, setSellerInfo,
getSellerInfo, getSellerInfo,
removeSellerInfo,
removeStorage, removeStorage,
showNoAccess, showNoAccess,
setStorageSync, setStorageSync,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!