| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521 |
- <template>
- <view class="">
- <!-- 扫一扫错误回调 -->
- <u-modal title="扫描异常" confirm-color="#dc9b21" v-model="scanNotify.scan" :content="scanNotify.scanMessage"></u-modal>
-
-
- <u-navbar :is-back="false" title="联兑通商户版"></u-navbar>
- <view class="margin-30">
- <view class="flex justify-between">
- <view class="title ">
- <view class="icon">
- <image src="@/static/icon/dianpu.png" mode=""></image>
- </view>
- <view class="center margin-left-10">
- <view @click="shopShow=true">
- <text class="name" >{{shopLable}}</text>
- <u-icon v-if="shopShow" name="arrow-up-fill" style="margin-left: 10rpx;"></u-icon>
- <u-icon v-else name="arrow-down-fill" style="margin-left: 10rpx;"></u-icon>
- </view>
- </view>
- </view>
-
- <view class="btn">
- <view class="image">
- <image src="@/static/icon/logout.png" mode=""></image>
- </view>
- <view @click="logout" class="center padding-left-10" >
- <text>退出</text>
- <text class="cuIcon-right"></text>
- </view>
- </view>
- </view>
-
- <view class="cu-list grid col-3 no-border top-menu">
- <view class="cu-item" @click="operate(index)" v-for="(item,index) in menuList" :key="index">
- <view class="grid-icon margin-top-20">
- <image style="width: 66rpx;height: 66rpx;" :src="item.icon" />
- </view>
- <text style="color: #fff;font-size: 26rpx;">{{item.name}}</text>
- </view>
- </view>
- <view class="menu-list">
- <view @click="$jump('/pages/bill/bill')" class="menu menu1">
- <view class="menu-top">
- <image src="@/static/icon/bill.png"></image>
- <view class="center padding-left-20">
- <text class="text-lg">我的账单</text>
- </view>
- </view>
- <view class="menu-bottom">
- <view class="">
- <text>今日营收</text>
- <text>{{statistic.todayIncome}}</text>
- </view>
- <view class="">
- <text>总资产</text>
- <text>{{statistic.totalAccount}}</text>
- </view>
- </view>
- </view>
- <view class="menu menu2" @click="$jump('/pages/member/member')">
- <view class="menu-top">
- <image src="@/static/icon/center.png"></image>
- <view class="center padding-left-20">
- <text class="text-lg">会员中心</text>
- </view>
- </view>
- <view class="menu-bottom" style="color: #FFFFFF;">
- <view class="">
- <text>新增会员</text>
- <text>{{statistic.todayMemberIn}}</text>
- </view>
- <view class="">
- <text>会员总数</text>
- <text>{{statistic.memberCount}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="market">
- <text class="title">营销管理</text>
- <view class="cu-list grid col-2 no-border margin-top-30">
- <view class="cu-item" @click="$jump(item.path)" v-for="(item,index) in marketList" :key="index">
- <view class="grid-icon">
- <image mode="widthFix" style="width: 120rpx;" :src="item.icon" />
- </view>
- <text style="color: #222222;font-size: 26rpx;margin-top: 20rpx;">{{item.name}}</text>
- <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
- </view>
- </view>
- </view>
- <view class="system">
- <text class="title">数字化系统</text>
- <view class="cu-list grid col-4 no-border margin-top-30" style="border-radius:20rpx ;">
- <view class="cu-item" @click="$jump(item.path)" v-for="(item,index) in systemList" :key="index">
- <view class="grid-icon">
- <image mode="heightFix" style="height: 56rpx;" :src="item.icon" />
- </view>
- <text style="color: #222222;font-size: 26rpx;">{{item.name}}</text>
- <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
- </view>
- </view>
- </view>
- </view>
-
-
- <!-- 支付键盘 -->
- <u-keyboard
- default=""
- ref="uKeyboard"
- mode="number"
- :mask="true"
- :mask-close-able="false"
- :dot-enabled="true"
- v-model="show"
- :confirm-btn="true"
- :safe-area-inset-bottom="true"
- :tooltip="false"
- @change="onChange"
- @backspace="onBackspace">
- <view>
- <view class="u-text-center u-padding-20 money">
- <view v-if="money=='0'" class="" style="position: absolute;left: 80rpx;bottom: 20rpx;">
- <text style="color: #909399;font-size: 24rpx;">请输入付款金额</text>
- </view>
- <text>{{money}}</text>
- <text class="u-font-20 u-padding-left-10">元</text>
- <view class="u-padding-10 close" data-flag="false" @tap="close">
- <u-icon name="close" color="#333333" size="28"></u-icon>
- </view>
- </view>
-
- <u-button @click="inputConfirm" plain :ripple="true" ripple-bg-color="rgba(25, 190, 107,.4)">确认</u-button>
- </view>
- </u-keyboard>
-
- <u-select @confirm="shopConfirm" v-model="shopShow" value-name="id" label-name="name" :list="shopList"></u-select>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- show:false,
- money:"0",
- scanNotify:{scan: false,scanMessage:'扫描错误,请稍后重试!' },
-
- //下拉选择商铺
- shopShow:false,
- //我的商铺列表
- shopList:[],
- //选中的商铺id
- shopId:'',
- //选中的商铺labe
- shopLable:'',
- labelIds:'',
- labelNames:'',
- //选中的商铺所属的商场
- mallId:'',
-
- //统计数据
- statistic:{},
-
- menuList: [{
- icon: '/static/icon/scan.png',
- name: '扫一扫',
- },
- {
- icon: '/static/icon/pay.png',
- name: '收款码',
- },
- {
- icon: '/static/icon/card.png',
- name: '卡包',
- }
- ],
- marketList: [{
- icon: '/static/icon/faqi.png',
- name: '发起活动',
- background: "background-image:linear-gradient(#FF9549,#FCB07B)",
- path: '/pages/publish/publish',
- count: 0
- },
- {
- icon: '/static/icon/qingdan.png',
- name: '活动清单',
- background: "background-image:linear-gradient(#5892F7,#67BBF9)",
- path: '/pages/activity/activity',
- count: 0
- },
- ],
- systemList: [{
- icon: '/static/icon/system1.png',
- name: '外卖平台',
- path: '/pages/mine/card/card'
- },
- {
- icon: '/static/icon/system2.png',
- name: '预约系统',
- path: '/pages/mine/card/card'
- },
- {
- icon: '/static/icon/system3.png',
- name: 'ERP系统',
- path: '/pages/mine/card/card'
- },
- {
- icon: '/static/icon/system4.png',
- name: '线上商城',
- path: '/pages/mine/card/card'
- },
- {
- icon: '/static/icon/system5.png',
- name: '门店管理',
- path: '/pages/mine/card/card'
- },
- {
- icon: '/static/icon/add.png',
- name: '添加服务',
- path: '/pages/mine/card/card'
- },
- ]
- }
- },
- onLoad() {
- this.init()
- },
- onShow() {
- if (this.canReset) {
- this.getStatistic()
- }
- this.canReset=true
- },
- methods: {
- logout(){
- this.$dialog.showModal('确定要退出吗?').then(res=>{
- uni.clearStorage()
- uni.reLaunch({
- url:"../login/account-login"
- })
- })
- },
- async init(){
- let phone=this.$cache.get('phone')
- let params={
- personTel:phone,
- auditStatus:1 //审核通过
- }
- let res=await this.$api.shop.list(params)
- this.shopList=res.data.records
- let item=this.shopList[0]
- this.shopId = item.id
- this.shopLable = item.name
- this.labelIds = item.labelIds
- this.labelNames = item.labelNames
- this.mallId=item.mallId
- this.cacheSelectedShop(item)
- //获取统计数据
- this.getStatistic()
- },
- getStatistic(){
- this.$api.shop.statistic(this.shopId).then(res=>{
- this.statistic=res.data
- })
- },
- cacheSelectedShop(item){
- let selectedShop={
- id:this.shopId,
- label:this.shopLable,
- labelIds:this.labelIds,
- labelNames:this.labelNames
- }
- this.$cache.put("selectedShop",Object.assign(item,selectedShop))
- this.$u.vuex('vuex_shopId',this.shopId)
- this.$u.vuex('vuex_mallId',this.mallId)
- },
- shopConfirm(e){
- this.shopId=e[0].value
- this.shopLable=e[0].label
- let item = this.shopList.filter((item)=>{
- if(this.shopId==item.id){
- return true
- }
- })
- this.labelIds = item.labelIds
- this.labelNames = item.labelNames
- this.cacheSelectedShop(item)
- //获取统计数据
- this.getStatistic()
- },
- operate(index){
- if (index==0) {
- this.show=true
- }else if (index==1) {
- this.$jump('/pages/checkstand/pay-qrcode')
- }else if (index==2) {
- this.$jump('/pages/card/card')
- }
- },
- //扫描二维码
- onChange(val){
- if (this.money=='0' && val!='.') {
- this.money=val
- return
- }
- console.log(typeof this.money);
- console.log(typeof val);
- this.money += val.toString()
- },
- onBackspace(e){
- if(this.money.length>0 &&this.money!='0'){
- this.money = this.money.substring(0,this.money.length-1);
- }else{
- this.money='0'
- }
- },
- inputConfirm(){
- if (this.$isEmpty(this.money)) {
- this.$u.toast('请输入收款金额')
- return
- }
- if (!this.$verify.isMoney(this.money)) {
- this.$u.toast('请输入正确的收款金额')
- return
- }
- this.show=false
- this.scanCode()
- },
- close(){
- this.money='0'
- this.show=false
- },
- scanCode(){
- const _this = this;
- uni.scanCode({
- success: function (res) {
- _this.payBefore(res.result)
- },
- fail: (res) => {
- if(res.errMsg!='scanCode:fail cancel'){
- _this.scanNotify = {scan: true,scanMessage: res.errMsg};
- }
- }
- });
- },
- async payBefore(secret){
- let expireTime=this.$dateTime.getExpireTime(5)
- let params={
- shopId:this.vuex_shopId,
- money:this.money,
- billsTitle:'用户支付',
- expireTime,
- appId:this.$global.wxParams.clientAppId,
- secret,
- type:2
- }
- let resp=await this.$api.shop.payBefore(params)
- console.log(resp);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .cu-list.grid>.cu-item .cu-tag {
- right: auto;
- left: 54%;
- margin-left: 20rpx;
- }
- .title {
- display: flex;
- .icon {
- background-color: #FFFFFF;
- border-radius: 50%;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 50rpx;
- height: 50rpx;
- image {
- width: 36rpx;
- height: 36rpx;
- }
- }
- text {
- font-weight: 800;
- font-size: 32rpx;
- color: #303030;
- }
- }
- .top-menu {
- border-radius: 20rpx;
- margin-top: 20rpx;
- background-image: linear-gradient(to right, #FBA33D, #FF8D32);
- }
- .menu-list {
- display: flex;
- justify-content: space-between;
- padding-top: 20rpx;
- .menu {
- width: 48.8%;
- color: #FFFFFF;
- display: flex;
- flex-direction: column;
- align-items: center;
- border-radius: 14rpx;
- padding: 30rpx 20rpx;
- .menu-top {
- display: flex;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- .menu-bottom {
- padding-top: 20rpx;
- font-size: 30rpx;
- display: flex;
- justify-content: space-around;
- width: 100%;
- view {
- display: flex;
- flex-direction: column;
- text-align: center;
- text:first-child {
- margin-bottom: 10rpx;
- font-size: 26rpx;
- color: #E0E2F6;
- }
- }
- }
- }
- .menu1 {
- background-color: #5C6186;
- }
- .menu2 {
- background-color: #E19D5B;
- }
- }
- .market {
- margin-top: 20rpx;
- border-radius: 20rpx;
- background-color: #FFFFFF;
- padding: 30rpx 50rpx 20rpx;
- .title {
- font-weight: 800;
- }
- }
- .system {
- margin-top: 20rpx;
- border-radius: 20rpx;
- background-color: #FFFFFF;
- padding: 30rpx 50rpx 20rpx;
- .title {
- font-weight: 800;
- }
- }
-
-
- .btn{
- margin-right: -30rpx;
- display: flex;
-
- .image{
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 50%;
- background-color: #FFFFFF;
- padding: 8rpx;
- image{
- width: 20rpx;
- height: 20rpx;
- }
- }
-
- color: #FFFFFF;
- border-radius: 50rpx 0 0 50rpx;
- padding:8rpx 10rpx 8rpx 35rpx;
- background-image: linear-gradient(to right,#FFD67B,#F99200);
- }
-
- .money{
- font-size: 80rpx;
- color: $u-type-warning;
- position: relative;
-
- .close{
- position: absolute;
- top: 20rpx;
- right: 20rpx;
- line-height: 28rpx;
- font-size: 28rpx;
- }
- }
- </style>
|