diff --git a/api/saas.js b/api/saas.js index e3571a9..23d9abe 100644 --- a/api/saas.js +++ b/api/saas.js @@ -18,6 +18,7 @@ const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail` const getBankList = () => mGet(`/ztb-factory/get/bank-list`, null, sconfig) const getStatisticsInfo = (params) => mGet(`/ztb-factory/get/my-workbench-statistics-info`, params, sconfig) const bindingFactory = (params) => mPost(`/recycle-user-center/bind/factory-admin`, params, sconfig) +const getFactoryLicence = () => mGet(`/recycle-user-center/get/latest-factory-licence`, null, sconfig) const getOrderList = (params) => mGet(`/ztb-factory/factory-customer/get/order-list`, params, sconfig) const getReceiptList = (params) => mGet(`/ztb-factory/factory/get/order-receipt-proof-audit-list`, params, sconfig) const getPeymentList = (params) => mGet(`/ztb-factory/get/order-pay-list`, params, sconfig) @@ -89,7 +90,7 @@ const getReceiptReport = (params) => mGet(`/ztb-factory/get/receipt-daily-report const getSalesReport = (params) => mGet(`/ztb-factory/get/sales-daily-report`, params, sconfig) const getGrossReport = (params) => mGet(`/ztb-factory/get/gross-profit-daily-report`, params, sconfig) const getAgentReport = (params) => mGet(`/ztb-factory/get/agency-sales-daily-report`, params, sconfig) -const getMemberList = () => mGet(`/ztb-factory/get/agency-sales-daily-report`, null, sconfig) +const getMemberList = () => mGet(`/ztb-factory/get/expense-config-list`, null, sconfig) const buyMemberInfo = (params) => mPost(`/ztb-factory/buy/member`, params, sconfig) export { @@ -172,5 +173,6 @@ export { savePlateNumber, deleteEmploye, getMemberList, - buyMemberInfo + buyMemberInfo, + getFactoryLicence } \ No newline at end of file diff --git a/pages/home/customer-list/index.js b/pages/home/customer-list/index.js index a2daf7e..1cfa704 100644 --- a/pages/home/customer-list/index.js +++ b/pages/home/customer-list/index.js @@ -41,11 +41,7 @@ Scene({ this.data.type = Number(options.type) } var height = app.globalData.fragmentHeight - 100 - if(height > 1024){ - this.data.indexHeight = 1024 - } else { - this.data.indexHeight = height - } + this.data.indexHeight = height - 48 var titleHeight = this.px2rpx(app.globalData.CustomBar) + 116 var itemHeight = parseInt(this.data.indexHeight / 25) this.setData({ height, itemHeight, indexHeight: this.data.indexHeight, titleHeight }) diff --git a/pages/home/customer-list/index.wxml b/pages/home/customer-list/index.wxml index f5947dc..1b6dbfb 100644 --- a/pages/home/customer-list/index.wxml +++ b/pages/home/customer-list/index.wxml @@ -40,12 +40,12 @@ 取消 - + - {{loading? '正在加载' : '暂无数据'}} + {{loading? '正在加载' : '暂无数据,点击重新刷新'}} diff --git a/pages/home/index/index.js b/pages/home/index/index.js index 0ff912d..6dbcafb 100644 --- a/pages/home/index/index.js +++ b/pages/home/index/index.js @@ -1,6 +1,7 @@ // pages/stock/index.js import Dialog from '../../../components/dialog/dialog' import { finalizeToken } from "../../../api/user" +import { getFactoryLicence } from "../../../api/saas" const util = require('../../../utils/util') const event = require('../../../utils/event') const storage = require('../../../utils/storage') @@ -58,6 +59,14 @@ Component({ } else if(!util.isEmpty(app.userInfo.realName)){ nickname = app.userInfo.realName.substring(0, 14) } + getFactoryLicence().then(result => { + app.userInfo.expirationTime = result.data.expirationTime.substring(0, 10) + app.userInfo.isExpiration = result.data.isExpiration + this.setData({ + ['userInfo.expirationTime']: app.userInfo.expirationTime, + ['userInfo.isExpiration']: result.data.isExpiration + }) + }) this.setData({ avatarUrl: util.isEmpty(app.userInfo.avatarUrl) ? '/assets/image/ygImg.png' : app.userInfo.avatarUrl, userInfo: app.userInfo, diff --git a/pages/home/index/index.wxml b/pages/home/index/index.wxml index 36c465f..5871c00 100644 --- a/pages/home/index/index.wxml +++ b/pages/home/index/index.wxml @@ -11,7 +11,7 @@ {{factoryName || ''}} - 授权已逾期 + 授权已逾期 {{userName || ''}}({{ isAdmin ? '管理员' : '员工' }}) @@ -25,7 +25,7 @@ - 授权截止日期:2021-07-31 + 授权截止日期:{{userInfo.expirationTime}} 去续费 diff --git a/pages/ztbvip/member/index.js b/pages/ztbvip/member/index.js index 0efdbe7..c2355ca 100644 --- a/pages/ztbvip/member/index.js +++ b/pages/ztbvip/member/index.js @@ -1,7 +1,8 @@ // xtends//vip/index.js import Scene from '../../index/scene' -import { getMemberList, buyMemberInfo } from "../../../api/saas" +import { getFactoryLicence, getMemberList, buyMemberInfo } from "../../../api/saas" import util from '../../../utils/util' +const event = require('../../../utils/event.js') const app = getApp() Scene({ @@ -10,7 +11,9 @@ Scene({ */ data: { factoryName: '', - memberList: [{"id":"49606500024333519","days":30,"bidPrice":1.00,"realPrice":1.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"yitianhuiyuanqntest","iosBidPrice":1.00,"iosRealPrice":1.00},{"id":"481107395657994240","days":5,"bidPrice":1.00,"realPrice":0.01,"icon":null,"title":"天","sellStrategy":"twoForOneAtFirstTime","iosId":null,"iosBidPrice":0.00,"iosRealPrice":0.00},{"id":"483353095548571648","days":30,"bidPrice":2000.00,"realPrice":1000.00,"icon":null,"title":"天","sellStrategy":"twoForOneAtFirstTime","iosId":"ztb_vip_30_01","iosBidPrice":1998.00,"iosRealPrice":998.00},{"id":"483353355918381056","days":90,"bidPrice":4000.00,"realPrice":2000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_90","iosBidPrice":3998.00,"iosRealPrice":1998.00},{"id":"483353702984454144","days":180,"bidPrice":6000.00,"realPrice":3000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_180","iosBidPrice":5898.00,"iosRealPrice":2998.00},{"id":"483354024398163968","days":365,"bidPrice":10000.00,"realPrice":5000.00,"icon":null,"title":"天","sellStrategy":"common","iosId":"ztb_vip_365","iosBidPrice":9998.00,"iosRealPrice":4998.00},{"id":"496065000243335168","days":30,"bidPrice":1000.00,"realPrice":500.00,"icon":null,"title":"天(限时)","sellStrategy":"common","iosId":"ztb_vip_30_02","iosBidPrice":998.00,"iosRealPrice":488.00}], + expirationTime: null, + isExpiration: null, + memberList: [], divIndexId: '49606500024333519', }, /** @@ -18,15 +21,37 @@ Scene({ */ onLoad: function (options) { wx.showLoading({ title: '加载中', mask: true }) + if(util.isEmpty(app.userInfo.expirationTime)){ + getFactoryLicence().then(result => { + app.userInfo.expirationTime = result.expirationTime.substring(0, 10) + app.userInfo.isExpiration = result.isExpiration + this.setData({ expirationTime:app.userInfo.expirationTime, isExpiration: result.isExpiration }) + }) + } getMemberList().then(res => { + var memberList = res.data.records wx.hideLoading() - this.setData({ factoryName: app.userInfo.factoryName, memberList: res.data, divIndexId:res.data[0].id }) + this.setData({ factoryName: app.userInfo.factoryName, + memberList, divIndexId: memberList[0].id, + expirationTime: app.userInfo.expirationTime, + isExpiration: app.userInfo.isExpiration + }) }).catch(err => { wx.hideLoading() this.setData({factoryName: app.userInfo.factoryName}) util.showToast(err) - }) + }) + event.on('EventMessage', this, this.onEvent) }, + onEvent: function(message){ + if (message.what == 300) { + getFactoryLicence().then(result => { + app.userInfo.expirationTime = result.data.expirationTime.substring(0, 10) + app.userInfo.isExpiration = result.data.isExpiration + this.setData({ expirationTime: app.userInfo.expirationTime, isExpiration: result.data.isExpiration }) + }) + } + }, onGridTap:function(e){ var index = e.currentTarget.dataset.index this.setData({ divIndexId: this.data.memberList[index].id }) @@ -35,10 +60,13 @@ Scene({ wx.showLoading({ title: '处理中', mask: true }) buyMemberInfo({ memberExpenseId: this.data.divIndexId }).then(res => { wx.hideLoading() - wx.navigateTo({ url: '/pages/ztbvip/payment/index?type=2&orderId=' + res.data.orderId }) + wx.navigateTo({ url: '/pages/ztbvip/payment/index?type=2&orderId=' + res.data.tradeOrderId }) }).catch(err => { wx.hideLoading() util.showToast(err) }) - } + }, + onUnload: function(){ + event.remove('EventMessage', this) + } }) \ No newline at end of file diff --git a/pages/ztbvip/member/index.wxml b/pages/ztbvip/member/index.wxml index 26ddef4..553a5d0 100644 --- a/pages/ztbvip/member/index.wxml +++ b/pages/ztbvip/member/index.wxml @@ -10,11 +10,11 @@ {{factoryName || ''}} - 已逾期 + 已逾期 - 到期时间:2021年7月30日 + 到期时间:{{expirationTime}} 立即续费 @@ -49,9 +49,9 @@ 首月买一赠一 - {{item.days}}{{item.title}} - {{item.realPrice}} - 原价:¥{{item.bidPrice}} + {{item.durationTime}}天 + {{item.discountPrice}} + 原价:¥{{item.standardPrice}} diff --git a/pages/ztbvip/payment/index.js b/pages/ztbvip/payment/index.js index b4eeb96..d8bbfca 100644 --- a/pages/ztbvip/payment/index.js +++ b/pages/ztbvip/payment/index.js @@ -1,6 +1,6 @@ // pages/ztbvip/payment/index.js import Scene from '../../index/scene' -import { getTradeOrder, paymentFor } from "../../../api/saas" +import { getTradeOrder, paymentFor } from "../../../api/payment" const util = require('../../../utils/util.js') const event = require('../../../utils/event.js') const app = getApp() @@ -60,7 +60,7 @@ Scene({ var that = this data.success = function (res) { util.showBackToast('支付成功') - event.emit('EventMessage', { what: 200, desc: 'Vip' }) + event.emit('EventMessage', { what: 300, desc: 'Vip' }) } data.fail = function (res) { util.showToast('支付失败') diff --git a/pages/ztbvip/payment/index.wxml b/pages/ztbvip/payment/index.wxml index 736d81a..e814d1c 100644 --- a/pages/ztbvip/payment/index.wxml +++ b/pages/ztbvip/payment/index.wxml @@ -4,12 +4,12 @@ - + {{payment}} {{payText}} - 立即支付 + 立即支付