Commit a8ee4fbf by 张立顺

bug修复

1 parent 59d27628
...@@ -207,6 +207,8 @@ Component({ ...@@ -207,6 +207,8 @@ Component({
this.getServiceMerchantList(merchantId) this.getServiceMerchantList(merchantId)
}, },
init() { init() {
let { userInfo } = this.data
// 判断是不是超管,不是只显示当时一个园区店
this.setData({ this.setData({
['form.orderType.data']: JSON.parse(JSON.stringify(this.data.orderType)) ['form.orderType.data']: JSON.parse(JSON.stringify(this.data.orderType))
}) })
...@@ -216,8 +218,9 @@ Component({ ...@@ -216,8 +218,9 @@ Component({
let { code, data, message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
if (data.length > 0) { if (data.length > 0) {
console.log(userInfo,'userInfo');
this.setData({ this.setData({
['form.merchantRange.data']: [ ['form.merchantRange.data']:[
{ {
merchantId: '', merchantId: '',
merchantName: '全部' merchantName: '全部'
...@@ -265,6 +268,11 @@ Component({ ...@@ -265,6 +268,11 @@ Component({
} }
api.getSceneMerchantRefStoreList(params).then(res => { api.getSceneMerchantRefStoreList(params).then(res => {
let { code, data, message } = res let { code, data, message } = res
let {userInfo} = this.data
// 不是超管,过滤4s店只能看自己
if (!userInfo.isSuper) {
data = data.filter(item=> item.merchantId == userInfo.shopMerchantId) || []
}
let arr = [] let arr = []
if (code == 0) { if (code == 0) {
arr = [ arr = [
...@@ -594,7 +602,8 @@ Component({ ...@@ -594,7 +602,8 @@ Component({
this.setData({ this.setData({
x: windowWidth, x: windowWidth,
windowWidth, windowWidth,
isFullSucreen: wx.$util.isFullSucreen(true) isFullSucreen: wx.$util.isFullSucreen(true),
userInfo: wx.$util.getUserInfo()
}) })
}) })
this.init() this.init()
......
...@@ -24,7 +24,8 @@ Component({ ...@@ -24,7 +24,8 @@ Component({
}, },
merchantId: { merchantId: {
type: Number, type: Number,
observer: function (n, o) { observer: function (n) {
console.log(n, 'n, o');
if (n) { if (n) {
this.getCouponList(n) this.getCouponList(n)
} }
...@@ -32,12 +33,12 @@ Component({ ...@@ -32,12 +33,12 @@ Component({
}, },
yqMerchantId: { yqMerchantId: {
type: Number, type: Number,
// observer: function (n, o) { observer: function (n) {
// console.log(n,'yqMerchantId'); console.log(n, 'n, o');
// if (n) { if (n) {
// this.getCouponList(n) this.getCouponList(this.data.merchantId)
// } }
// } }
}, },
customerPhone: { customerPhone: {
type: Number, type: Number,
...@@ -45,6 +46,7 @@ Component({ ...@@ -45,6 +46,7 @@ Component({
const phoneRex = /^[1]([3-9])[0-9]{9}$/ const phoneRex = /^[1]([3-9])[0-9]{9}$/
if (phoneRex.test(n)) { if (phoneRex.test(n)) {
this.getCustomerCouponList(n) this.getCustomerCouponList(n)
console.log(this.data.merchantId, 'this.data.merchantId');
this.getCouponList(this.data.merchantId) this.getCouponList(this.data.merchantId)
} }
} }
...@@ -55,17 +57,7 @@ Component({ ...@@ -55,17 +57,7 @@ Component({
} }
}, },
lifetimes: { lifetimes: {
attached() { attached() {}
// let { merchantId } = this.data
// console.log(merchantId,'merchantId');
// merchantId && this.getCouponList(merchantId)
// let userInfo = util.getUserInfo()
// // 老的没有绑定就清空掉 或者切换过账号的
// let sellerInfo = util.getSellerInfo()
// if (!sellerInfo?.subLoginMechantId || sellerInfo?.subLoginMechantId != userInfo.subLoginUser.merchantId) {
// util.removeSellerInfo()
// }
}
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
...@@ -87,15 +79,21 @@ Component({ ...@@ -87,15 +79,21 @@ Component({
usedFlag: 'N' usedFlag: 'N'
} }
api.getCustomerCouponList(params).then(res => { api.getCustomerCouponList(params).then(res => {
let { code, data, message } = res let {
code,
data,
message
} = res
console.log(res) console.log(res)
if (code == 0) { if (code == 0) {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
console.log('thisPage.data', thisPage.data) console.log('thisPage.data', thisPage.data)
let { orderObj } = thisPage.data let {
orderObj
} = thisPage.data
// console.log(orderObj) // console.log(orderObj)
console.log(data,'getCustomerCouponList') console.log(data, 'getCustomerCouponList')
let filterList = data.filter(item => { let filterList = data.filter(item => {
return item.status != 1 || (item.status == 1 && item.id == orderObj.customerCouponId) return item.status != 1 || (item.status == 1 && item.id == orderObj.customerCouponId)
}) })
...@@ -109,15 +107,23 @@ Component({ ...@@ -109,15 +107,23 @@ Component({
}) })
}, },
getCouponList(merchantId, refresh) { getCouponList(merchantId, refresh) {
let { yqMerchantId } = this.data let {
api yqMerchantId
} = this.data
// console.log(merchantId, yqMerchantId, 'yqMerchantId');
// 解决 yqMerchantId 为0 请求空数据的问题
merchantId && yqMerchantId && api
.getCouponList({ .getCouponList({
merchantId, merchantId,
yqMerchantId, yqMerchantId,
orderByType:9, // 按时间排序 orderByType: 9, // 按时间排序
}) })
.then(res => { .then(res => {
let { code, data, message } = res let {
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)])) let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)]))
// console.log(couponTypeList) // console.log(couponTypeList)
...@@ -146,10 +152,19 @@ Component({ ...@@ -146,10 +152,19 @@ Component({
}) })
}, },
checkCoupon() { checkCoupon() {
let { customerCouponList, couponList, chooseItem, merchantId, returnFun, pageName } = this.data let {
customerCouponList,
couponList,
chooseItem,
merchantId,
returnFun,
pageName
} = this.data
// console.log(customerCouponList) // console.log(customerCouponList)
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data let {
orderObj
} = thisPage.data
// console.log(orderObj) // console.log(orderObj)
// debugger // debugger
if (customerCouponList.length > 0) { if (customerCouponList.length > 0) {
...@@ -206,7 +221,7 @@ Component({ ...@@ -206,7 +221,7 @@ Component({
}) })
// 追加一个逻辑 订单补录并且不是回显的话 或则订单是战败 // 追加一个逻辑 订单补录并且不是回显的话 或则订单是战败
// pageName == 'additionRecordOrder' && // pageName == 'additionRecordOrder' &&
if ( (pageName == 'additionRecordOrder' || this.data.selectPayType == 0 )&&!orderObj.couponName && !orderObj.customerCouponCode) { if ((pageName == 'additionRecordOrder' || this.data.selectPayType == 0) && !orderObj.couponName && !orderObj.customerCouponCode) {
if (couponList.length) { if (couponList.length) {
// couponList.find((item)=>{ // couponList.find((item)=>{
// return item.list.length && // return item.list.length &&
...@@ -221,7 +236,7 @@ Component({ ...@@ -221,7 +236,7 @@ Component({
} }
}) })
}) })
console.log(defaultItem,'defaultItem'); console.log(defaultItem, 'defaultItem');
if (defaultItem) { if (defaultItem) {
this.setData({ this.setData({
couponList, couponList,
...@@ -239,8 +254,13 @@ Component({ ...@@ -239,8 +254,13 @@ Component({
}, },
checkActiveCoupon() { checkActiveCoupon() {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data let {
let { couponList, customerCouponList } = this.data orderObj
} = thisPage.data
let {
couponList,
customerCouponList
} = this.data
if (orderObj.customerCouponId || orderObj.merchantCouponId) { if (orderObj.customerCouponId || orderObj.merchantCouponId) {
let couponName = '' let couponName = ''
let key = 'merchantCouponId' let key = 'merchantCouponId'
...@@ -283,14 +303,20 @@ Component({ ...@@ -283,14 +303,20 @@ Component({
choose(e) { choose(e) {
let { let {
item, item,
item: { active, disabled }, item: {
active,
disabled
},
index, index,
ind, ind,
key key
} = e.currentTarget.dataset } = e.currentTarget.dataset
console.log(item) console.log(item)
if (disabled) return if (disabled) return
let { couponList, customerCouponList } = this.data let {
couponList,
customerCouponList
} = this.data
customerCouponList.map(i => (i.active = false)) customerCouponList.map(i => (i.active = false))
couponList.map(i => { couponList.map(i => {
i.list.map(k => (k.active = false)) i.list.map(k => (k.active = false))
...@@ -311,8 +337,13 @@ Component({ ...@@ -311,8 +337,13 @@ Component({
}) })
}, },
searchCoupon(e) { searchCoupon(e) {
let { couponList, merchantId } = this.data let {
let { value } = e.detail couponList,
merchantId
} = this.data
let {
value
} = e.detail
if (!value) { if (!value) {
this.getCouponList(merchantId) this.getCouponList(merchantId)
return return
...@@ -335,7 +366,9 @@ Component({ ...@@ -335,7 +366,9 @@ Component({
}) })
}, },
confirm() { confirm() {
let { chooseItem } = this.data let {
chooseItem
} = this.data
// customerCouponList // customerCouponList
if (!chooseItem?.merchantCouponId && !chooseItem?.customerCouponId) { if (!chooseItem?.merchantCouponId && !chooseItem?.customerCouponId) {
return wx.$util.showToast({ return wx.$util.showToast({
...@@ -349,7 +382,9 @@ Component({ ...@@ -349,7 +382,9 @@ Component({
}) })
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data let {
orderObj
} = thisPage.data
delete orderObj.customerCouponId delete orderObj.customerCouponId
delete orderObj.merchantCouponId delete orderObj.merchantCouponId
console.log(chooseItem) console.log(chooseItem)
...@@ -357,10 +392,10 @@ Component({ ...@@ -357,10 +392,10 @@ Component({
...orderObj, ...orderObj,
...chooseItem ...chooseItem
} }
console.log(chooseItem,orderObj,'chooseItem'); console.log(chooseItem, orderObj, 'chooseItem');
thisPage.setData({ thisPage.setData({
orderObj orderObj
}) })
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -129,7 +129,7 @@ Component({ ...@@ -129,7 +129,7 @@ Component({
} else { } else {
isSellerInfo = orderObj.merchantName && orderObj.employeeName isSellerInfo = orderObj.merchantName && orderObj.employeeName
// let orderSellerInfo = util.getSellerInfo() // let orderSellerInfo = util.getSellerInfo()
// 获取上一个订单的销售顾问信息 // 获取上一个订单的销售顾问信息 并且不是再次下单
let result = await api.getLastUserOrderInfo({ sellerUserId: userInfo.subLoginUser.uuid }) let result = await api.getLastUserOrderInfo({ sellerUserId: userInfo.subLoginUser.uuid })
// let {data} = result // let {data} = result
...@@ -159,6 +159,7 @@ Component({ ...@@ -159,6 +159,7 @@ Component({
let targetName = type == 1 ? 'orderObj.merchantName' : 'orderObj.sellerMerchantName' let targetName = type == 1 ? 'orderObj.merchantName' : 'orderObj.sellerMerchantName'
let targetId = type == 1 ? 'orderObj.merchantId' : 'orderObj.sellerMerchantId' let targetId = type == 1 ? 'orderObj.merchantId' : 'orderObj.sellerMerchantId'
// let isShowSelesBox = type == 3 ? true : false // let isShowSelesBox = type == 3 ? true : false
console.log(merchantId,merchantName,targetName,targetId,'merchant-seles');
this.setData( this.setData(
{ {
[targetId]: merchantId, [targetId]: merchantId,
......
...@@ -371,7 +371,10 @@ Component({ ...@@ -371,7 +371,10 @@ Component({
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
thisPage.setData({ thisPage.setData({
// ['orderInfo.quotedPriceUpdate']: '', // ['orderInfo.quotedPriceUpdate']: '',
['orderInfo.payType']: paytype ['orderInfo.payType']: paytype,
})
this.setData({
['textNameObj.confirmName']: paytype == 1?'下一步·去支付(1/2)':'下一步·上传凭证'
}) })
}, },
handleInput(e) { handleInput(e) {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<view class="price-box"> <view class="price-box">
¥ ¥
<view class="price"> <view class="price">
<input type="digit" value="{{ item.price }}" bindinput="changePrice" disabled="{{ orderObj.selectPayType ==0 }}" data-item="{{ item }}" bindblur="priceBlur" data-index="{{ index }}" class="{{ item.price < item.shopMinPrice && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}" always-embed /> <input type="digit" value="{{ item.price }}" bindinput="changePrice" disabled="{{ orderObj.selectPayType ==0 }}" data-item="{{ item }}" bindblur="priceBlur" data-index="{{ index }}" class="{{ item.price < 0 ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}" always-embed />
</view> </view>
</view> </view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view> <view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view>
......
// packageCrowdFunding/pages/homePage/index/index.js // packageCrowdFunding/pages/homePage/index/index.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/' const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// import api from '~/packageCrowdFunding/api' // import api from '~/packageCrowdFunding/api'
import NP from 'number-precision'
import { import {
getQuotationStatistics, getQuotationStatistics,
outputValueStatistics, outputValueStatistics,
...@@ -161,6 +162,9 @@ Component({ ...@@ -161,6 +162,9 @@ Component({
}).then(res => { }).then(res => {
let { code, data, message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
data.conversionRate = NP.times(data.conversionRate,100)
data.avgPrice = NP.divide(data.avgPrice,100)
data.avgPrice = NP.round(data.avgPrice, 0 )
this.setData({ this.setData({
staticData: data || {} staticData: data || {}
}) })
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</view> </view>
<view class="item"> <view class="item">
<view class="label">转化率</view> <view class="label">转化率</view>
<veiw class="number">{{staticData.conversionRate*100 ||0}}%</veiw> <veiw class="number">{{staticData.conversionRate ||0}}%</veiw>
</view> </view>
</view> </view>
<view class="static_box"> <view class="static_box">
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
box-shadow: 0 4rpx 20rpx 0 #0000001a; box-shadow: 0 4rpx 20rpx 0 #0000001a;
} }
.items .left{ .items .left{
width: 65%; /* width: 65%; */
display: flex; display: flex;
align-items: center; align-items: center;
} }
......
...@@ -348,11 +348,21 @@ Page({ ...@@ -348,11 +348,21 @@ Page({
}, },
search() { search() {
wx.$refresh = false wx.$refresh = false
let { searchObj, userInfo } = this.data
let merchantId
// 判断是不是超管,不是只能筛选当前4s店的
if (!searchObj.merchantId&&!userInfo.isSuper) {
merchantId = userInfo?.shopMerchantId
this.setData({
['searchObj.merchantId']: merchantId
})
}
this.setData({ this.setData({
list: [], list: [],
pageNum: 1, pageNum: 1,
flag: false, flag: false,
nothing: false nothing: false,
// ['searchObj.merchantId']: merchantId
}) })
this.getInviteList() this.getInviteList()
this.getiIviteRecord() this.getiIviteRecord()
......
...@@ -302,11 +302,23 @@ Page({ ...@@ -302,11 +302,23 @@ Page({
init(userInfo) {}, init(userInfo) {},
search() { search() {
wx.$refresh = false wx.$refresh = false
let { searchObj, userInfo } = this.data
let merchantId
// 判断是不是超管,不是只能筛选当前4s店的
if (!searchObj.merchantId && !userInfo.isSuper) {
merchantId = userInfo?.shopMerchantId
this.setData({
['searchObj.merchantId']: merchantId
})
}
console.log(userInfo);
console.log('search',merchantId);
this.setData({ this.setData({
list: [], list: [],
pageNum: 1, pageNum: 1,
flag: false, flag: false,
nothing: false nothing: false,
}) })
this.getWorkList() this.getWorkList()
this.getStatByStatus() this.getStatByStatus()
......
...@@ -626,6 +626,7 @@ Page({ ...@@ -626,6 +626,7 @@ Page({
if (options.yqMerchantId && options.isAppointment) { if (options.yqMerchantId && options.isAppointment) {
orderObj.sellerMerchantId = options.yqMerchantId orderObj.sellerMerchantId = options.yqMerchantId
} }
console.log(orderObj,'orderObj');
this.setData({ this.setData({
orderObj, orderObj,
first: true, first: true,
...@@ -804,8 +805,7 @@ Page({ ...@@ -804,8 +805,7 @@ Page({
// }) // })
} }
} }
console.log(subOrderList, 'subOrderList') // console.log(subOrderList, 'subOrderList')
// debugger
this.setData({ this.setData({
goodsData, goodsData,
goodsList: subOrderList, goodsList: subOrderList,
...@@ -979,6 +979,8 @@ Page({ ...@@ -979,6 +979,8 @@ Page({
this.setData({ this.setData({
returnFun: true returnFun: true
}) })
console.log(res,'res');
// debugger
this.setOrderObj(res) this.setOrderObj(res)
} else { } else {
wx.$util.showLoading('加载中...') wx.$util.showLoading('加载中...')
......
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
<view class="price_count"> <view class="price_count">
<view class="price"> <view class="price">
<text>¥</text> <text>¥</text>
<input type="digit" value="{{item.price}}" bindinput="changePrice" disabled="{{orderObj.selectPayType ==0}}" data-item="{{item}}" bindblur="priceBlur" data-index="{{index}}" class="{{item.price < item.shopMinPrice && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':''}}" always-embed /> <input type="digit" value="{{item.price}}" bindinput="changePrice" disabled="{{orderObj.selectPayType ==0}}" data-item="{{item}}" bindblur="priceBlur" data-index="{{index}}" class="{{item.price < 0 && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':''}}" always-embed />
</view> </view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox"> <view class="count" catchtap="showPopup" data-show-name="goodsBox">
x{{item.count}} x{{item.count}}
......
...@@ -158,8 +158,31 @@ const multipliedByHundred = str => { ...@@ -158,8 +158,31 @@ const multipliedByHundred = str => {
} }
// 规则校验并不小于0 // 规则校验并不小于0
const removeLeadingZerosAndEnsureNonNegative = inputStr => { const removeLeadingZerosAndEnsureNonNegative = inputStr => {
// 使用正则表达式去掉前导零 // 使用正则表达式过滤掉除数字和小数点以外的字符
let trimmedStr = inputStr.replace(/^0+/, ''); const filteredStr = inputStr.replace(/[^0-9.]/g, '');
// 使用正则表达式去掉前导零,但保留一个零作为整数部分
let trimmedStr = filteredStr.replace(/^0+(?=\d)|^0+(?=\.)/, '');
// 如果字符串以小数点结尾,不做任何修改
if (trimmedStr === '.') {
return '0.';
}
// 如果字符串以小数点开始,添加一个零作为整数部分
if (trimmedStr.startsWith('.')) {
trimmedStr = '0' + trimmedStr;
}
// // 如果小数点后没有数字,则在末尾添加一个零
// if (trimmedStr.indexOf('.') !== -1 && trimmedStr.endsWith('.')) {
// trimmedStr += '0';
// }
// // 如果字符串以小数点结尾,不做任何修改
// if (trimmedStr.endsWith('.')) {
// return trimmedStr;
// }
let [number, decimal] = trimmedStr.split('.') let [number, decimal] = trimmedStr.split('.')
if (decimal != undefined) { if (decimal != undefined) {
decimal = decimal.substring(0, 2) decimal = decimal.substring(0, 2)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!