浏览代码

fix: weixin pay params

wangyuan 2 年之前
父节点
当前提交
a4ab5c79f4
共有 2 个文件被更改,包括 15 次插入3 次删除
  1. 14 2
      pages/buy/buy.js
  2. 1 1
      pages/buy/buy.wxml

+ 14 - 2
pages/buy/buy.js

@@ -1,7 +1,7 @@
 // pages/buy/buy.js
 import { goodsList } from '../../api/index'
 import { submitOrder } from '../../api/pay'
-import itt from '../../utils/util'
+import { getAccountNmber } from '../../api/appointment'
 const app = getApp()
 
 Page({
@@ -10,6 +10,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    count: 0,
     activeIndex: -1,
     goodsList: [],
     goodsId: '',
@@ -24,12 +25,23 @@ Page({
    */
   onShow() {
     this.getGoodsList()
+    this.getAccountNmberFn()
     this.setData({
       appusername: app.globalData.userInfo.userName.length > 4 ? app.globalData.userInfo.userName.substring(0,4) : app.globalData.userInfo.userName,
       appuserheadimg: app.globalData.userInfo.headImg
     })
   },
 
+  // 获取套餐次数
+  getAccountNmberFn () {
+    var that = this
+    getAccountNmber({}).then(res => {
+      that.setData({
+        count: res.data
+      })
+    })
+  },
+
   //获取套餐列表
   getGoodsList () {
     wx.showLoading({
@@ -90,7 +102,7 @@ Page({
     var data = {
       goodsId: this.data.goodsId,
       orderAmount: this.data.orderAmount,
-      num: this.data.num
+      num: 1
     }
     wx.showLoading({
       title: '加载中...',

+ 1 - 1
pages/buy/buy.wxml

@@ -8,7 +8,7 @@
       <text class="name">{{appusername}}</text>
     </view>
     <view class="span">
-      <text class="count">0</text>
+      <text class="count">{{count}}</text>
       <text class="unit">次</text>
     </view>
   </view>