Explorar o código

充值成功页

shish %!s(int64=5) %!d(string=hai) anos
pai
achega
2a959f0f92

+ 6 - 0
ghsApp/src/api/recharge/index.js

@@ -0,0 +1,6 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+//充值余额
+export const rechargeBalance = data => {
+	return https.get('/recharge/balance', data)
+}

+ 1 - 1
ghsApp/src/components/app-result.vue

@@ -16,7 +16,7 @@
 
 <script>
 export default {
-    name: "AppResult", // 开单结果
+    name: "AppResult",
     props:{
         title:{
             type:String,

+ 2 - 1
ghsApp/src/pages.json

@@ -163,7 +163,8 @@
 				{"path": "me/incomeExpenses","style": {"navigationBarTitleText": "收支记录"}},
 				{"path": "me/recharge","style": {"navigationBarTitleText": "充值"}},
 				{"path": "me/rechargeList","style": {"navigationBarTitleText": "充值记录"}},
-				{"path": "me/cashSet","style": {"navigationBarTitleText": "提现帐号设置"}}
+				{"path": "me/cashSet","style": {"navigationBarTitleText": "提现帐号设置"}},
+				{"path": "me/rechargeSuccess","style": {"navigationBarTitleText": "充值成功"}}
 			]
 		},
 		{

+ 23 - 25
ghsApp/src/pagesStore/me/cashSet.vue

@@ -28,12 +28,13 @@
               type="text"
             />
           </tui-list-cell>
-
         </div>
 
         <!-- 提交 -->
         <div class="confirm-btn">
-          <button class="admin-button-com big blue" formType="submit">提交</button>
+          <button class="admin-button-com big blue" formType="submit">
+            提交
+          </button>
         </div>
       </form>
     </div>
@@ -50,48 +51,46 @@ export default {
   name: "cashSet",
   components: {
     TuiListCell,
-    AppAvatarModule
+    AppAvatarModule,
   },
   data() {
     return {
       form: {
         cashAccount: "",
-		cashName:""
+        cashName: "",
       },
       roleList: [],
       roleSelData: {},
       showStaffArea: true,
-      miniCodeSrc:'',
-      memberData: {}
+      miniCodeSrc: "",
+      memberData: {},
     };
   },
   onLoad() {
     //this.init()
   },
   onShow() {
-      uni.setNavigationBarTitle({
-        title: `提现帐号设置`
-      });
+    uni.setNavigationBarTitle({
+      title: `提现帐号设置`,
+    });
   },
   methods: {
     async init() {
       try {
         const { data } = await currentShop();
 
-		this.form.cashAccount = data.cashAccount;
-		this.form.cashName = data.cashName;
-		this.$forceUpdate();
-
+        this.form.cashAccount = data.cashAccount;
+        this.form.cashName = data.cashName;
+        this.$forceUpdate();
       } finally {
-
       }
     },
     confirmFn() {
-		cashUpdate(this.form).then(res => {
-        this.$msg('操作成功')
-		setTimeout(() => {
-			uni.navigateBack();
-		}, 1300)
+      cashUpdate(this.form).then((res) => {
+        this.$msg("操作成功");
+        setTimeout(() => {
+          uni.navigateBack();
+        }, 1300)
       });
     },
     formSubmit(e) {
@@ -100,14 +99,13 @@ export default {
         {
           name: "cashName",
           rule: ["required"],
-          msg: ["请输入姓名"]
+          msg: ["请输入姓名"],
         },
         {
           name: "cashAccount",
           rule: ["required"],
-          msg: ["请输入帐号"]
-        }
-
+          msg: ["请输入帐号"],
+        },
       ];
       // 进行表单检查
       let formData = e.detail.value;
@@ -118,8 +116,8 @@ export default {
       } else {
         this.$msg(checkRes);
       }
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 184 - 47
ghsApp/src/pagesStore/me/recharge.vue

@@ -1,54 +1,191 @@
 <template>
-<view>
-<view>充值金额</view>
-<view>
-	<view>
-		<view>¥5000</view>
-		<view>¥1000</view>
-		<view>¥800</view>
-	</view>
-	<view>
-		<view>¥500</view>
-		<view>¥100</view>
-		<view>其它金额</view>
-	</view>
-</view>
-</view>
+  <view>
+    <view class="recharge_title">充值金额</view>
+    <view>
+      <view class="amount_area">
+        <view
+          class="amount string left"
+          :class="amount == 5000 ? 'selected' : ''"
+          @click="
+            amount = 5000;
+            other_amount = '';
+          "
+          >¥5000</view
+        >
+        <view
+          class="amount string middle"
+          :class="amount == 1000 ? 'selected' : ''"
+          @click="
+            amount = 1000;
+            other_amount = '';
+          "
+          >¥1000</view
+        >
+        <view
+          class="amount string"
+          :class="amount == 800 ? 'selected' : ''"
+          @click="
+            amount = 800;
+            other_amount = '';
+          "
+          >¥800</view
+        >
+      </view>
+      <view class="amount_area">
+        <view
+          class="amount string left"
+          :class="amount == 500 ? 'selected' : ''"
+          @click="
+            amount = 500;
+            other_amount = '';
+          "
+          >¥500</view
+        >
+        <view
+          class="amount string middle"
+          :class="amount == 100 ? 'selected' : ''"
+          @click="
+            amount = 100;
+            other_amount = '';
+          "
+          >¥100</view
+        >
+        <view class="amount">
+          <input
+            type="digit"
+            placeholder="其它金额"
+            class="other_amount"
+            @click="amount = ''"
+            v-model="other_amount"
+          />
+        </view>
+      </view>
+
+      <view class="confirm-btn">
+        <button
+          class="admin-button-com big blue"
+          @click="wexinPayFn"
+          formType="submit"
+        >
+          充值
+        </button>
+      </view>
+    </view>
+  </view>
 </template>
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
-import { withdrawCashList } from '@/api/store'
-import list from '@/mixins/list'
+import { withdrawCashList } from "@/api/store";
+import list from "@/mixins/list";
+import wexinPay from "@/utils/pay/wxPay";
+import { rechargeBalance } from "@/api/recharge";
 export default {
-	name: "recharge",
-	components: {
-		AppWrapperEmpty
-	},
-	mixins:[list],
-	data() {
-		return {
-	
-		};
-	},
-	methods: {
-		async init(){
-		}
-	},
-	async onPullDownRefresh() {
-		this.resetList();
-		await this.init()
-		uni.stopPullDownRefresh();
-	},
-	async onReachBottom() {
-		if (!this.list.finished) {
-			await this.init()
-			uni.stopPullDownRefresh();;
-		} else {
-			uni.stopPullDownRefresh();
-		}
-	},
-	
+  name: "recharge",
+  components: {
+    AppWrapperEmpty,
+  },
+  mixins: [list],
+  data() {
+    return {
+      amount: "",
+      other_amount: "",
+    };
+  },
+  methods: {
+    async init() {},
+    // 微信支付
+    wexinPayFn() {
+      this._pay();
+    },
+    _pay() {
+      if (this.other_amount > 0) {
+        this.amount = this.other_amount;
+      }
+      if (!this.amount) {
+        this.$msg("请选择充值金额");
+        return false;
+      }
+      let params = { amount: this.amount };
+      rechargeBalance(params).then((res) => {
+        this.payCallData = res.data;
+        if (res.code == 0) {
+          this.$msg(res.msg);
+          return false;
+        }
+        wexinPay(res.data, this.paySuccess, this.payFail);
+      });
+    },
+    paySuccess() {
+      this.$util.pageTo({
+        url: "/pagesStore/me/rechargeSuccess",
+        type: 2,
+        query: {},
+      });
+    },
+    payFail() {
+      this.$msg("没有充值成功哦");
+      return false;
+    },
+  },
+  async onPullDownRefresh() {
+    this.resetList();
+    await this.init();
+    uni.stopPullDownRefresh();
+  },
+  async onReachBottom() {
+    if (!this.list.finished) {
+      await this.init();
+      uni.stopPullDownRefresh();
+    } else {
+      uni.stopPullDownRefresh();
+    }
+  },
 };
 </script>
-
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.recharge_title {
+  font-weight: bold;
+  font-size: 30rpx;
+  margin: 30rpx 0 50rpx 0;
+  padding: 0 0 0 28rpx;
+}
+.amount_area {
+  display: block;
+  width: 100%;
+  height: 130rpx;
+  margin: 35rpx 0 0 0;
+  padding-left: 35rpx;
+  .amount {
+    border: 1rpx solid #f9f6ef;
+    width: 23%;
+    height: 120rpx;
+    float: left;
+    font-size: 25rpx;
+    background-color: #f2f2f2;
+    color: #666666;
+    .other_amount {
+      font-size: 25rpx;
+      margin-top: 40rpx;
+      text-align: center;
+    }
+  }
+  .string {
+    padding: 40rpx 0 0 45rpx;
+  }
+  .middle {
+    margin: 0 90rpx 0 90rpx;
+  }
+  .selected {
+    background-color: #0099ff;
+    color: white;
+  }
+}
+// 按钮
+.confirm-btn {
+  width: calc(100% - 60px);
+  margin: 60px 30px 20px;
+  .admin-button-com {
+    width: 100%;
+  }
+}
+</style>

+ 25 - 0
ghsApp/src/pagesStore/me/rechargeSuccess.vue

@@ -0,0 +1,25 @@
+<template>
+  <appResult :title="'充值成功'">
+    <button class="admin-button-com big" @click="closeLayer">关闭</button>
+  </appResult>
+</template>
+<script>
+import appResult from "@/components/app-result";
+export default {
+  name: "rechargeSuccess",
+  components: {
+    appResult,
+  },
+  methods: {
+    closeLayer() {
+      uni.navigateBack();
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.admin-button-com {
+  margin-bottom: 20px;
+  width: 100%;
+}
+</style>