Commit 049fc3ee by chenwq

我的门店

1 parent 6ebf37b5
// pages/tab/outputValue/components/merchant/merchant.js
import { IMG_URL } from '~/utils/constantData'
import outputApi from '~/api/outputApi/index'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
bgUrl: `${IMG_URL}/personal/empty_tran.png`,
formData: {},
serviceName: '四川精手指鑫都汽车服务有限公司',
totalObj: {
scene1Total: '72536',
scene0Total: '76400',
scene3Total: '15486',
total: '164422'
},
// 1精品升级(太阳膜),3众筹,0会员权益)
// 服务商-多4s店
merchantList: [{
yearMonth: '2023年8月',
curMonthTotalData: {
scene1Total: '5986',
scene0Total: '76400',
scene3Total: '11000',
total: '19567'
},
merchantDataList: [{
merchantName: '四川申蓉汇亚汽车贸易有限公司',
curMonthTotalData: {
scene1Total: '5986',
scene0Total: '76400',
scene3Total: '11000',
total: '19567'
},
lastMonthTotalData: {
scene1Total: '51122',
scene0Total: '2355',
scene3Total: '65400',
total: '0'
}
}, {
merchantName: '四川港宏新通汽车销售服务有限公司',
curMonthTotalData: {
scene1Total: '960',
scene0Total: '0',
scene3Total: '0',
total: '960'
},
lastMonthTotalData: {
scene1Total: '123223',
scene0Total: '0',
scene3Total: '0',
total: '0'
}
}]
}]
},
lifetimes: {
attached() {
this.getMerchant()
}
},
/**
* 组件的方法列表
*/
methods: {
getMerchant(isReset = false) {
let { userInfo } = wx.$storage.get()
let params = {
partnerMerchantId: userInfo.subLoginUser.merchantId
}
outputApi.getStaffList(params).then(res => {
if (isReset) {
this.setData({
busiScrollTop: 0
})
}
this.setData({
triggered: false
})
// let _list = []
// _list = res || []
// this.setData({
// merchantList: _list
// })
})
},
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* pages/tab/outputValue/components/merchant/merchant.wxss */
.merchantCon {
box-sizing: border-box;
background-color: #fff;
height: 100%;
padding: 24rpx 16rpx;
}
.merchant {
box-sizing: border-box;
color: #323436;
// padding-top: 16rpx;
// background-color: #F2F3F7;
background-color: #FFFFFF;
}
.merchant-content {
margin: 0 16rpx;
}
.all-container {
height: 388rpx;
background-image: url("https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/bg-merchant.png");
background-size: 100% 100%;
.name {
display: flex;
align-items: center;
height: 80rpx;
font-weight: 600;
font-size: 28rpx;
color: #323436;
padding: 0 24rpx;
.tips {
width: 84rpx;
height: 28rpx;
font-size: 20rpx;
text-align: center;
color: #3666FE;
background: #3666fe1a;
border-radius: 5rpx;
margin-left: 8rpx;
}
}
}
.end-txt {
font-size: 24rpx;
text-align: center;
color: #CCCED1;
padding-bottom: 60rpx;
}
\ No newline at end of file \ No newline at end of file
<!--pages/tab/outputValue/components/merchant/merchant.wxml-->
<wxs src="/pages/tab/outputValue/index.wxs" module="filter" />
<view class="merchantCon">
<scroll-view class="merchant" id="scroller" scroll-y="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="handleSearch" lower-threshold='50' scroll-top="{{busiScrollTop}}">
<view wx:for="{{merchantList}}" wx:key="index" class="merchant-content">
<!-- 全部 -->
<view class="all-container">
<view class="name">
{{serviceName}}
<view class="tips">服务商</view>
</view>
<view>
<view>总产值</view>
<view>¥{{filter.money_three_for_two_thousands(totalObj.total)}}</view>
</view>
<view>
</view>
</view>
</view>
<view wx:if="{{!merchantList.length}}" class="end-txt">
<nothing-tips tips="暂无数据~" bgColor="{{'#FFFFFF'}}" bg="{{bgUrl}}" />
</view>
<view wx:else class="end-txt">
<view>到底啦~</view>
</view>
</scroll-view>
</view>
\ No newline at end of file \ No newline at end of file
/**设置千分位 */
var setPrice = function (n = 0.0) {
if ((typeof n == 'string' || typeof n == 'number') && !isNaN(n)) {
n = parseFloat(n).toFixed(2)
var r = getRegExp('(d{1,3})(?=(d{3})+(?:.))', 'g')
var p = n.replace(r, ',')
return p
// var r = getRegExp('/./', 'g')
// var p = n.replace(r, 'test')
// return n
} else {
console.log(n, '不是一个数字', !isNaN(n))
}
}
var threeNumForTwo = {
money_three_for_two_thousands: function (num) {
//num = parseInt(num);
// return num
var num = num + ''
var d = ''
if (num.slice(0, 1) == '-') {
d = num.slice(0, 1)
num = num.slice(1)
}
var len = num.length
var index = num.indexOf('.')
if (index == -1) {
num = num + '.00'
} else if (index + 2 == len) {
num = num + '0'
}
var index = num.indexOf('.') // 字符出现的位置
var num2 = num.slice(-3)
num = num.slice(0, index)
var result = ''
while (num.length > 3) {
result = ',' + num.slice(-3) + result
num = num.slice(0, num.length - 3)
}
if (num) {
result = num + result
}
// return result
return d + (result + num2)
}
}
/*
* 导出
*/
module.exports = {
setPrice: setPrice,
money_three_for_two_thousands: threeNumForTwo.money_three_for_two_thousands //暴露接口调用
}
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"usingComponents": { "usingComponents": {
"navigation-bar": "../../../components/NavigationBar/NavigationBar", "navigation-bar": "../../../components/NavigationBar/NavigationBar",
"tab": "./components/Tab/Tab", "tab": "./components/Tab/Tab",
"screen-box": "./components/ScreenBox/ScreenBox" "screen-box": "./components/ScreenBox/ScreenBox",
"merchant": "./components/merchant/merchant"
}, },
"navigationStyle": "custom" "navigationStyle": "custom"
} }
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
</block> </block>
</navigation-bar> </navigation-bar>
<view class="layout" style="padding-top:calc({{tabBarStyle}}px + 88rpx);"> <view class="layout" style="padding-top:calc({{tabBarStyle}}px + 88rpx);">
<!-- 我的客户 --> <!-- 我的门店 -->
<!-- <view class="comCom" hidden="{{tabIndx != 0}}"> <view class="comCom" hidden="{{tabIndx != 0}}">
<client id="client" /> <merchant id="merchant" />
</view> --> </view>
<!-- 我的员工 --> <!-- 我的员工 -->
<!-- <view class="comCom" hidden="{{tabIndx != 1}}"> <!-- <view class="comCom" hidden="{{tabIndx != 1}}">
<staff id="staff" /> <staff id="staff" />
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!