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