Commit 8e13fe0c by chenwq

联调,接口封装改造

1 parent 7a9eea6b
...@@ -80,9 +80,10 @@ class outputApi { ...@@ -80,9 +80,10 @@ class outputApi {
/** 查询门店权益订单数据统计-车险升级活动产值 */ /** 查询门店权益订单数据统计-车险升级活动产值 */
getEquityRevenue(data) { getEquityRevenue(data) {
return api.post({ return api.post({
method: 'scrm.api.busassistant.merchant.equity.statistics', // method: 'scrm.api.busassistant.merchant.equity.statistics',
method: 'dj.api.smartcarlife.vd.quotation.merchant.statistics',
...data ...data
}) }, false, 'dj')
} }
/** 店面汇总-下载海报 */ /** 店面汇总-下载海报 */
......
...@@ -30,26 +30,27 @@ const formList = [{ ...@@ -30,26 +30,27 @@ const formList = [{
const formObj = { const formObj = {
SC001: [{ SC001: [{
label: '总单量', label: '营业额',
name: 'totalCount' name: 'turnover',
}, {
label: '总产值',
name: 'totalAmount',
prefix: '¥' prefix: '¥'
}, { }, {
label: '当月单量', label: '推荐客户量',
name: 'monthCount' name: 'customerNum'
}, { }, {
label: '当月产值', label: '成交客户量',
name: 'monthAmount', name: 'successNum'
prefix: '¥'
}, { }, {
label: '转化率', label: '融合客单价',
name: 'conversionRate' name: 'fuseCustomerPrice',
prefix: '¥'
}, { }, {
label: '单价', label: '权益客单价',
name: 'price', name: 'equityCustomerPrice',
prefix: '¥' prefix: '¥'
}, {
label: '转化率',
name: 'conversionRate',
suffix: '%'
}], }],
SC002: formList, SC002: formList,
SC003: formList SC003: formList
......
...@@ -287,23 +287,30 @@ Page({ ...@@ -287,23 +287,30 @@ Page({
* 查询SC001场景值 * 查询SC001场景值
*/ */
getEquityRevenue(isFirst = false) { getEquityRevenue(isFirst = false) {
outputApi.getEquityRevenue({ merchantId: this.data.merchantInfo.merchantId }).then(res => { // outputApi.getEquityRevenue({ merchantId: this.data.merchantInfo.merchantId }).then(res => {
// outputApi.getEquityRevenue({ merchantIds: [this.data.merchantInfo.merchantId] }).then(res => {
outputApi.getEquityRevenue({ merchantIds: ['44211227'] }).then(res => {
if (res.length) { if (res.length) {
var actList = this.data.sceneActivityObj['scene' + this.findSceneIdx('SC001')] var actList = this.data.sceneActivityObj['scene' + this.findSceneIdx('SC001')]
var actCodeList = actList.map(item => item.productCode) var actCodeList = actList.map(item => item.productCode)
var total = 0 var total = 0
res.forEach(item => { res.forEach((item, idx) => {
var idx = actCodeList.findIndex(i => i == item.productCode) // var idx = actCodeList.findIndex(i => i == item.productCode)
var orderTotal = item.orderTotal // var orderTotal = item.orderTotal
if (item.orderTotal) { // if (item.orderTotal) {
total = (total + Number(item.orderTotal?.totalAmount)).toFixed(2) // total = (total + Number(item.orderTotal?.totalAmount)).toFixed(2)
item.orderTotal.totalAmount = utils.moneyThreeForTwoThousands(Number(orderTotal.totalAmount).toFixed(2)) // item.orderTotal.totalAmount = utils.moneyThreeForTwoThousands(Number(orderTotal.totalAmount).toFixed(2))
item.orderTotal.monthAmount = Number(orderTotal.monthAmount).toFixed(2) // item.orderTotal.monthAmount = Number(orderTotal.monthAmount).toFixed(2)
item.orderTotal.price = Number(orderTotal.price).toFixed(2) // item.orderTotal.price = Number(orderTotal.price).toFixed(2)
} // }
item.conversionRate = (item.conversionRate * 100).toFixed(0)
item.turnover = (item.turnover / 100).toFixed(2)
item.fuseCustomerPrice = (item.fuseCustomerPrice / 100).toFixed(2)
item.equityCustomerPrice = (item.equityCustomerPrice / 100).toFixed(2)
total = item.turnover
actList[idx] = { actList[idx] = {
...actList[idx], ...actList[idx],
orderTotal: item.orderTotal orderTotal: res[idx]
} }
}) })
if (!isFirst) { if (!isFirst) {
......
...@@ -47,13 +47,13 @@ Component({ ...@@ -47,13 +47,13 @@ Component({
isNum: true isNum: true
}, { }, {
label: '到店贴膜量', label: '到店贴膜量',
name: '' name: 'toShopCount'
}, { }, {
label: '升级订单', label: '升级订单',
name: '' name: 'upgradeCount'
}, { }, {
label: '战败订单', label: '战败订单',
name: '' name: 'noUpgradeCount'
}, { }, {
label: '转化率', label: '转化率',
name: 'conversionRate' name: 'conversionRate'
......
...@@ -16,8 +16,8 @@ Component({ ...@@ -16,8 +16,8 @@ Component({
*/ */
data: { data: {
busiOptSceneCode, busiOptSceneCode,
// tabActive: 'store', tabActive: 'store',
tabActive: 'business', // tabActive: 'business',
formData: { formData: {
// 0:全部-1;1:精品升级SC002;2:售后众筹SC004;3:会员权益/升级SC001 // 0:全部-1;1:精品升级SC002;2:售后众筹SC004;3:会员权益/升级SC001
busiIdx: 0, busiIdx: 0,
......
...@@ -27,7 +27,7 @@ Component({ ...@@ -27,7 +27,7 @@ Component({
}, },
totalPages: -1, totalPages: -1,
list: [], list: [],
tabActive: 'business', tabActive: 'store',
// 业务经营汇总 // 业务经营汇总
merchantList: [], merchantList: [],
formData: { formData: {
...@@ -110,7 +110,6 @@ Component({ ...@@ -110,7 +110,6 @@ Component({
totalAmount: data.totalAmount, totalAmount: data.totalAmount,
activityList: [] activityList: []
} }
console.log(data, 'data----')
data?.merchantList.forEach(item => { data?.merchantList.forEach(item => {
let _list = item?.merchantActivityRevenueDTO?.statistics || [] let _list = item?.merchantActivityRevenueDTO?.statistics || []
_list.forEach(n => { _list.forEach(n => {
...@@ -162,16 +161,27 @@ Component({ ...@@ -162,16 +161,27 @@ Component({
let params = { let params = {
...busiSearchData, ...busiSearchData,
...sortSearchData, ...sortSearchData,
// merchantIds: merchantList.map(item => item.merchantId) merchantIds: merchantList.map(item => item.merchantId)
merchantIds: ['44211227', '44211547', '10011000', '44184606', '44209535'] // merchantIds: ['44211227', '44211547', '10011000', '44184606', '44209535']
} }
console.log(params, 'params--') console.log(params, 'params--')
outputApi.getBusiStatistics(params).then(res => { outputApi.getBusiStatistics(params).then(res => {
this.resetBusiData() this.resetBusiData()
// console.log(res, '汇总----') // console.log(res, '汇总----')
if(isReset) {
this.setData({
busiScrollTop: 0,
triggered: false
})
}
if (formData.sceneCode == 'SC004') { if (formData.sceneCode == 'SC004') {
this.dealCrowdObj(res) this.dealCrowdObj(res)
} else { } else {
if(formData.sceneCode == 'SC002') {
res.merchantList.forEach(item => {
item.calUpPrice = Math.round(item.totalSubOrderOrderMoney / item.upgradeCount).toFixed(2)
})
}
this.setData({ this.setData({
busiObj: res, busiObj: res,
busiTotalList: res.merchantList || [] busiTotalList: res.merchantList || []
...@@ -227,8 +237,12 @@ Component({ ...@@ -227,8 +237,12 @@ Component({
var list = this.data.list var list = this.data.list
list = list.concat(res.list) list = list.concat(res.list)
list.forEach((item, index) => { list.forEach((item, index) => {
item.scenePriceList = []
item.sceneList.forEach((k, idx) => { item.sceneList.forEach((k, idx) => {
item['scene' + (idx + 1)] = item.sceneList[idx].flag item['scene' + (idx + 1)] = item.sceneList[idx].flag
item.scenePriceList.push({
total: item.sceneList[idx].totalMoney || 0
})
}) })
item.isOpenScene = item.sceneList.map(item => item.flag).some(item => item == true) item.isOpenScene = item.sceneList.map(item => item.flag).some(item => item == true)
}) })
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</view> </view>
<!-- 场景内容 --> <!-- 场景内容 -->
<view class="box-content"> <view class="box-content">
<scene-box sceneInfo="{{item}}" hasLockIcon="{{false}}" /> <scene-box sceneInfo="{{item}}" hasLockIcon="{{false}}" scenePriceList="{{item.scenePriceList}}" />
<!-- 通知 --> <!-- 通知 -->
<view class="box-bottom"> <view class="box-bottom">
<view wx:if="{{item.msgList.length}}" class="flex"> <view wx:if="{{item.msgList.length}}" class="flex">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<scroll-view wx:if="{{tabActive == 'business'}}" class="client" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="onBindRefresh" lower-threshold='50' scroll-top="{{busiScrollTop}}"> <scroll-view wx:if="{{tabActive == 'business'}}" class="client" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="handleSort" lower-threshold='50' scroll-top="{{busiScrollTop}}">
<view class="client-box"> <view class="client-box">
<!-- 总收益 --> <!-- 总收益 -->
<view wx:if="{{formData.sceneCode != 'SC004'}}"> <view wx:if="{{formData.sceneCode != 'SC004'}}">
...@@ -66,12 +66,18 @@ ...@@ -66,12 +66,18 @@
<!-- 售后众筹 --> <!-- 售后众筹 -->
<view wx:if="{{formData.sceneCode == 'SC004'}}"> <view wx:if="{{formData.sceneCode == 'SC004'}}">
<output-crowdfund wx:if="{{formData.sceneCode == 'SC004'}}" orderObj="{{crowdOrderObj}}"></output-crowdfund> <output-crowdfund wx:if="{{formData.sceneCode == 'SC004'}}" orderObj="{{crowdOrderObj}}"></output-crowdfund>
<view class="end-txt">
{{ crowdOrderObj.activityList.length ? '到底啦!' : '暂无数据' }}
</view>
</view> </view>
<!-- 0:全部;1:精品升级;3:会员权益/升级 --> <!-- 0:全部;1:精品升级;3:会员权益/升级 -->
<view wx:else> <view wx:else>
<view wx:for="{{busiTotalList}}" wx:key="index"> <view wx:for="{{busiTotalList}}" wx:key="index">
<busi-card info="{{item}}" sceneCode="{{formData.sceneCode}}"></busi-card> <busi-card info="{{item}}" sceneCode="{{formData.sceneCode}}"></busi-card>
</view> </view>
<view class="end-txt">
{{busiTotalList.length ? '到底啦!' : '暂无数据'}}
</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
......
...@@ -79,35 +79,35 @@ Component({ ...@@ -79,35 +79,35 @@ Component({
prefix: '¥', prefix: '¥',
isNumber: true isNumber: true
} }
],
tableHeadList: [
{
label: 'rankIdx',
width: '40rpx'
},
{
label: '业务员',
name: 'shareName'
},
{
label: '转发',
name: 'shareCount'
},
{
label: '浏览',
name: 'browseCount'
},
{
label: '成交',
name: 'dealCount',
width: '92rpx'
},
{
label: '产值',
name: 'totalAmount',
prefix: '¥'
}
] ]
// tableHeadList: [
// {
// label: 'rankIdx',
// width: '40rpx'
// },
// {
// label: '业务员',
// name: 'shareName'
// },
// {
// label: '转发',
// name: 'shareCount'
// },
// {
// label: '浏览',
// name: 'browseCount'
// },
// {
// label: '成交',
// name: 'dealCount',
// width: '92rpx'
// },
// {
// label: '产值',
// name: 'totalAmount',
// prefix: '¥'
// }
// ]
}, },
/** /**
......
import { secretKey, pathEnum, domain, sign } from './http.js' import { secretKey, djSecretKey, pathEnum, domain, sign } from './http.js'
import { getSessionId } from '~/utils/cache/storageApi' import { getSessionId } from '~/utils/cache/storageApi'
import network from '~/utils/network' import network from '~/utils/network'
/**接口 */ /**接口 */
class Request { class Request {
get(params, returnAll = false) { get(params, returnAll = false, requestPath) {
return this.request('GET', params, returnAll) return this.request('GET', params, returnAll, requestPath)
} }
post(params, returnAll = false) { post(params, returnAll = false, requestPath) {
return this.request('POST', params, returnAll) return this.request('POST', params, returnAll, requestPath)
} }
async request(RequestMethods, params, returnAll) { async request(RequestMethods, params, returnAll, requestPath = 'scrm') {
const type = await network.getNetworkType() const type = await network.getNetworkType()
if (type == 'none') return if (type == 'none') return
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -17,16 +17,16 @@ class Request { ...@@ -17,16 +17,16 @@ class Request {
let header = let header =
RequestMethods === 'POST' RequestMethods === 'POST'
? { ? {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
} }
: {} : {}
let projectName = params.apiProjectName || this.getRopProject(params.method) let projectName = params.apiProjectName || this.getRopProject(params.method)
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
let path = pathEnum[projectName] let path = pathEnum[projectName]
if (!path) path = `/rop-scrm-${projectName}/` if (!path) path = requestPath == 'scrm' ? `/rop-scrm-${projectName}/` : `/rop-dj-${projectName}/`
params = this.getData(params) params = this.getData(params, requestPath)
wx.request({ wx.request({
url: `${domain}${path}router?method=${params.method}`, url: `${domain[requestPath]}${path}router?method=${params.method}`,
data: params, data: params,
method: RequestMethods, method: RequestMethods,
header, header,
...@@ -82,16 +82,20 @@ class Request { ...@@ -82,16 +82,20 @@ class Request {
}) })
}) })
} }
getData(params) { getData(params, requestPath) {
let projectName = params.projectName let projectName = params.projectName
if (!projectName) projectName = this.getRopProject(params.method) if (!projectName) projectName = this.getRopProject(params.method)
else delete params.projectName else delete params.projectName
let appKey = '48e5e13229b82c1b4e6e8c96151f0637' let appKey = '48e5e13229b82c1b4e6e8c96151f0637'
let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b' let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
if (secretKey[projectName]) { if (requestPath == 'scrm' && secretKey[projectName]) {
appKey = secretKey[projectName].appKey appKey = secretKey[projectName].appKey
secret = secretKey[projectName].secret secret = secretKey[projectName].secret
} }
if(requestPath == 'dj') {
appKey = djSecretKey.appKey
secret = djSecretKey.secret
}
const sessionId = getSessionId() const sessionId = getSessionId()
let noSignAttr = [] let noSignAttr = []
if (!params.sessionId && sessionId) params.sessionId = sessionId if (!params.sessionId && sessionId) params.sessionId = sessionId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!