Commit a8ee4fbf by 张立顺

bug修复

1 parent 59d27628
......@@ -207,6 +207,8 @@ Component({
this.getServiceMerchantList(merchantId)
},
init() {
let { userInfo } = this.data
// 判断是不是超管,不是只显示当时一个园区店
this.setData({
['form.orderType.data']: JSON.parse(JSON.stringify(this.data.orderType))
})
......@@ -216,8 +218,9 @@ Component({
let { code, data, message } = res
if (code == 0) {
if (data.length > 0) {
console.log(userInfo,'userInfo');
this.setData({
['form.merchantRange.data']: [
['form.merchantRange.data']:[
{
merchantId: '',
merchantName: '全部'
......@@ -265,6 +268,11 @@ Component({
}
api.getSceneMerchantRefStoreList(params).then(res => {
let { code, data, message } = res
let {userInfo} = this.data
// 不是超管,过滤4s店只能看自己
if (!userInfo.isSuper) {
data = data.filter(item=> item.merchantId == userInfo.shopMerchantId) || []
}
let arr = []
if (code == 0) {
arr = [
......@@ -594,7 +602,8 @@ Component({
this.setData({
x: windowWidth,
windowWidth,
isFullSucreen: wx.$util.isFullSucreen(true)
isFullSucreen: wx.$util.isFullSucreen(true),
userInfo: wx.$util.getUserInfo()
})
})
this.init()
......
......@@ -24,7 +24,8 @@ Component({
},
merchantId: {
type: Number,
observer: function (n, o) {
observer: function (n) {
console.log(n, 'n, o');
if (n) {
this.getCouponList(n)
}
......@@ -32,12 +33,12 @@ Component({
},
yqMerchantId: {
type: Number,
// observer: function (n, o) {
// console.log(n,'yqMerchantId');
// if (n) {
// this.getCouponList(n)
// }
// }
observer: function (n) {
console.log(n, 'n, o');
if (n) {
this.getCouponList(this.data.merchantId)
}
}
},
customerPhone: {
type: Number,
......@@ -45,6 +46,7 @@ Component({
const phoneRex = /^[1]([3-9])[0-9]{9}$/
if (phoneRex.test(n)) {
this.getCustomerCouponList(n)
console.log(this.data.merchantId, 'this.data.merchantId');
this.getCouponList(this.data.merchantId)
}
}
......@@ -55,17 +57,7 @@ Component({
}
},
lifetimes: {
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()
// }
}
attached() {}
},
/**
* 组件的初始数据
......@@ -87,15 +79,21 @@ Component({
usedFlag: 'N'
}
api.getCustomerCouponList(params).then(res => {
let { code, data, message } = res
let {
code,
data,
message
} = res
console.log(res)
if (code == 0) {
let thisPage = wx.$router.getPageInstance()
console.log('thisPage.data', thisPage.data)
let { orderObj } = thisPage.data
let {
orderObj
} = thisPage.data
// console.log(orderObj)
console.log(data,'getCustomerCouponList')
console.log(data, 'getCustomerCouponList')
let filterList = data.filter(item => {
return item.status != 1 || (item.status == 1 && item.id == orderObj.customerCouponId)
})
......@@ -109,15 +107,23 @@ Component({
})
},
getCouponList(merchantId, refresh) {
let { yqMerchantId } = this.data
api
let {
yqMerchantId
} = this.data
// console.log(merchantId, yqMerchantId, 'yqMerchantId');
// 解决 yqMerchantId 为0 请求空数据的问题
merchantId && yqMerchantId && api
.getCouponList({
merchantId,
yqMerchantId,
orderByType:9, // 按时间排序
orderByType: 9, // 按时间排序
})
.then(res => {
let { code, data, message } = res
let {
code,
data,
message
} = res
if (code == 0) {
let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)]))
// console.log(couponTypeList)
......@@ -146,10 +152,19 @@ Component({
})
},
checkCoupon() {
let { customerCouponList, couponList, chooseItem, merchantId, returnFun, pageName } = this.data
let {
customerCouponList,
couponList,
chooseItem,
merchantId,
returnFun,
pageName
} = this.data
// console.log(customerCouponList)
let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data
let {
orderObj
} = thisPage.data
// console.log(orderObj)
// debugger
if (customerCouponList.length > 0) {
......@@ -206,7 +221,7 @@ Component({
})
// 追加一个逻辑 订单补录并且不是回显的话 或则订单是战败
// 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) {
// couponList.find((item)=>{
// return item.list.length &&
......@@ -221,7 +236,7 @@ Component({
}
})
})
console.log(defaultItem,'defaultItem');
console.log(defaultItem, 'defaultItem');
if (defaultItem) {
this.setData({
couponList,
......@@ -239,8 +254,13 @@ Component({
},
checkActiveCoupon() {
let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data
let { couponList, customerCouponList } = this.data
let {
orderObj
} = thisPage.data
let {
couponList,
customerCouponList
} = this.data
if (orderObj.customerCouponId || orderObj.merchantCouponId) {
let couponName = ''
let key = 'merchantCouponId'
......@@ -283,14 +303,20 @@ Component({
choose(e) {
let {
item,
item: { active, disabled },
item: {
active,
disabled
},
index,
ind,
key
} = e.currentTarget.dataset
console.log(item)
if (disabled) return
let { couponList, customerCouponList } = this.data
let {
couponList,
customerCouponList
} = this.data
customerCouponList.map(i => (i.active = false))
couponList.map(i => {
i.list.map(k => (k.active = false))
......@@ -311,8 +337,13 @@ Component({
})
},
searchCoupon(e) {
let { couponList, merchantId } = this.data
let { value } = e.detail
let {
couponList,
merchantId
} = this.data
let {
value
} = e.detail
if (!value) {
this.getCouponList(merchantId)
return
......@@ -335,7 +366,9 @@ Component({
})
},
confirm() {
let { chooseItem } = this.data
let {
chooseItem
} = this.data
// customerCouponList
if (!chooseItem?.merchantCouponId && !chooseItem?.customerCouponId) {
return wx.$util.showToast({
......@@ -349,7 +382,9 @@ Component({
})
let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data
let {
orderObj
} = thisPage.data
delete orderObj.customerCouponId
delete orderObj.merchantCouponId
console.log(chooseItem)
......@@ -357,10 +392,10 @@ Component({
...orderObj,
...chooseItem
}
console.log(chooseItem,orderObj,'chooseItem');
console.log(chooseItem, orderObj, 'chooseItem');
thisPage.setData({
orderObj
})
}
}
})
})
\ No newline at end of file
......@@ -129,7 +129,7 @@ Component({
} else {
isSellerInfo = orderObj.merchantName && orderObj.employeeName
// let orderSellerInfo = util.getSellerInfo()
// 获取上一个订单的销售顾问信息
// 获取上一个订单的销售顾问信息 并且不是再次下单
let result = await api.getLastUserOrderInfo({ sellerUserId: userInfo.subLoginUser.uuid })
// let {data} = result
......@@ -159,6 +159,7 @@ Component({
let targetName = type == 1 ? 'orderObj.merchantName' : 'orderObj.sellerMerchantName'
let targetId = type == 1 ? 'orderObj.merchantId' : 'orderObj.sellerMerchantId'
// let isShowSelesBox = type == 3 ? true : false
console.log(merchantId,merchantName,targetName,targetId,'merchant-seles');
this.setData(
{
[targetId]: merchantId,
......
......@@ -371,7 +371,10 @@ Component({
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
// ['orderInfo.quotedPriceUpdate']: '',
['orderInfo.payType']: paytype
['orderInfo.payType']: paytype,
})
this.setData({
['textNameObj.confirmName']: paytype == 1?'下一步·去支付(1/2)':'下一步·上传凭证'
})
},
handleInput(e) {
......
......@@ -29,7 +29,7 @@
<view class="price-box">
¥
<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 class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view>
......
// packageCrowdFunding/pages/homePage/index/index.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
// import api from '~/packageCrowdFunding/api'
import NP from 'number-precision'
import {
getQuotationStatistics,
outputValueStatistics,
......@@ -161,6 +162,9 @@ Component({
}).then(res => {
let { code, data, message } = res
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({
staticData: data || {}
})
......
......@@ -39,7 +39,7 @@
</view>
<view class="item">
<view class="label">转化率</view>
<veiw class="number">{{staticData.conversionRate*100 ||0}}%</veiw>
<veiw class="number">{{staticData.conversionRate ||0}}%</veiw>
</view>
</view>
<view class="static_box">
......
......@@ -118,7 +118,7 @@
box-shadow: 0 4rpx 20rpx 0 #0000001a;
}
.items .left{
width: 65%;
/* width: 65%; */
display: flex;
align-items: center;
}
......
......@@ -348,11 +348,21 @@ Page({
},
search() {
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({
list: [],
pageNum: 1,
flag: false,
nothing: false
nothing: false,
// ['searchObj.merchantId']: merchantId
})
this.getInviteList()
this.getiIviteRecord()
......
......@@ -302,11 +302,23 @@ Page({
init(userInfo) {},
search() {
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({
list: [],
pageNum: 1,
flag: false,
nothing: false
nothing: false,
})
this.getWorkList()
this.getStatByStatus()
......
......@@ -626,6 +626,7 @@ Page({
if (options.yqMerchantId && options.isAppointment) {
orderObj.sellerMerchantId = options.yqMerchantId
}
console.log(orderObj,'orderObj');
this.setData({
orderObj,
first: true,
......@@ -804,8 +805,7 @@ Page({
// })
}
}
console.log(subOrderList, 'subOrderList')
// debugger
// console.log(subOrderList, 'subOrderList')
this.setData({
goodsData,
goodsList: subOrderList,
......@@ -979,6 +979,8 @@ Page({
this.setData({
returnFun: true
})
console.log(res,'res');
// debugger
this.setOrderObj(res)
} else {
wx.$util.showLoading('加载中...')
......
......@@ -274,7 +274,7 @@
<view class="price_count">
<view class="price">
<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 class="count" catchtap="showPopup" data-show-name="goodsBox">
x{{item.count}}
......
......@@ -158,8 +158,31 @@ const multipliedByHundred = str => {
}
// 规则校验并不小于0
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('.')
if (decimal != undefined) {
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!