Commit 2bb19d05 by chenwq

门店多选

1 parent e1796328
...@@ -91,6 +91,9 @@ Component({ ...@@ -91,6 +91,9 @@ Component({
// const idx = formData.shopMerchantIds.findIndex(item => item == merchantId) // const idx = formData.shopMerchantIds.findIndex(item => item == merchantId)
// idx == -1 ? formData.shopMerchantIds.push(merchantId) : formData.shopMerchantIds.splice(idx, 1) // idx == -1 ? formData.shopMerchantIds.push(merchantId) : formData.shopMerchantIds.splice(idx, 1)
formData.shopMerchantIds = merchantList.map(item => item.merchantId) formData.shopMerchantIds = merchantList.map(item => item.merchantId)
if (formData.shopMerchantIds.every(item => !item)) {
formData.shopMerchantIds = ''
}
formData.shopMerchantNames = merchantList[0].merchantName formData.shopMerchantNames = merchantList[0].merchantName
this.setData({ this.setData({
formData formData
......
...@@ -12,8 +12,8 @@ Component({ ...@@ -12,8 +12,8 @@ Component({
properties: { properties: {
tabBarStyle: { tabBarStyle: {
type: Number, type: Number,
observer: function(n) { observer: function (n) {
if (n) this.setData({emptyDataStyle: `height: calc(100vh - ${n}px - 88rpx - 24rpx)`}) if (n) this.setData({ emptyDataStyle: `height: calc(100vh - ${n}px - 88rpx - 24rpx)` })
} }
} }
}, },
...@@ -71,14 +71,14 @@ Component({ ...@@ -71,14 +71,14 @@ Component({
this.getListData(true, isInit) this.getListData(true, isInit)
}, },
actionOperationResult(val1, val2, rate = false){ actionOperationResult(val1, val2, rate = false) {
if (!val2) return flag ? 0 : '0.00' if (!val2) return flag ? 0 : '0.00'
const p = this.actionOperation(val1, val2) const p = this.actionOperation(val1, val2)
let flag = Number.isInteger(((val1 * p) / (val2 * p)) * 100) // 是否是整数 let flag = Number.isInteger(((val1 * p) / (val2 * p)) * 100) // 是否是整数
return rate ? (flag ? ((val1 * p) / (val2 * p)) * 100 : (((val1 * p) / (val2 * p)) * 100).toFixed(2)) : ((val1 * p) / (val2 * p)).toFixed(2) return rate ? (flag ? ((val1 * p) / (val2 * p)) * 100 : (((val1 * p) / (val2 * p)) * 100).toFixed(2)) : ((val1 * p) / (val2 * p)).toFixed(2)
}, },
actionOperation(val1, val2){ actionOperation(val1, val2) {
const len1 = val1.toString().length - val1.toString().indexOf(".") - 1 const len1 = val1.toString().length - val1.toString().indexOf(".") - 1
const len2 = val2.toString().length - val2.toString().indexOf(".") - 1 const len2 = val2.toString().length - val2.toString().indexOf(".") - 1
const p = Math.max(len1, len2) const p = Math.max(len1, len2)
...@@ -114,6 +114,9 @@ Component({ ...@@ -114,6 +114,9 @@ Component({
})) }))
delete params.shopMerchantNames delete params.shopMerchantNames
delete params.sceneType // 删除场景参数 delete params.sceneType // 删除场景参数
if (!params.shopMerchantIds) {
delete params.shopMerchantIds
}
let month = new Date().getMonth() + 1 let month = new Date().getMonth() + 1
let year = new Date().getFullYear() let year = new Date().getFullYear()
let day = this.getLastDay(year, month) let day = this.getLastDay(year, month)
......
...@@ -23,7 +23,7 @@ Component({ ...@@ -23,7 +23,7 @@ Component({
this.setData({ this.setData({
searchKeyword: '', searchKeyword: '',
merchantRange, merchantRange,
selectedMerchantIds: selectInfo?.shopMerchantIds.map(item => item.merchantId) || '' selectedMerchantIds: Array.isArray(selectInfo?.shopMerchantIds) ? selectInfo?.shopMerchantIds.map(item => item.merchantId) : ''
}) })
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!