zhanghui 2 лет назад
Родитель
Сommit
4f646f72ed
4 измененных файлов с 163 добавлено и 47 удалено
  1. 8 0
      common/js/api.js
  2. 2 2
      common/js/env.js
  3. 19 10
      myPages/serviceObjectAllInfo/index.vue
  4. 134 35
      storePages/rights/index.vue

+ 8 - 0
common/js/api.js

@@ -3,6 +3,14 @@ import request from '../js/request.js';
 
 export default {
 
+	//post请求  一键付款余额支付
+	equityCardList(){
+		return request({
+			url: '/business/wechat/equity-card/list',
+			method: 'GET'
+
+		})
+	},
 
 
 	//post请求  一键付款余额支付

+ 2 - 2
common/js/env.js

@@ -1,8 +1,8 @@
 "use strict";
 
-let baseUrl = `https://jje.admin.xinyuekj.com.cn`
+// let baseUrl = `https://jje.admin.xinyuekj.com.cn`
 // let baseUrl = `http://127.0.0.1:9000`
-// let baseUrl = `http://192.168.1.150:8080`
+let baseUrl = `http://192.168.1.150:8080`
 
 // 变量可自行添加修改
 export default { //存放变量的容器

+ 19 - 10
myPages/serviceObjectAllInfo/index.vue

@@ -8,8 +8,8 @@
                             <view class="">宝贝头像</view>
                         </view>
                     </view>
-                    <view @click="uploadImg1(1)" class="arrow-right">
-                        <view class="head-img">
+                    <view  class="arrow-right">
+                        <view class="head-img" @click="uploadImg1(1)">
                             <image v-if="userInfo.facePhotoUrl" :src="userInfo.facePhotoUrl" mode=""></image>
                             <image v-else src="../../static/me/u1796.png" mode=""></image>
                         </view>
@@ -24,10 +24,10 @@
                         <view class="nav-name">
                             <view class="">宝贝昵称</view>
                         </view>
-                        <input class="custom-input" v-model="userInfo.nickName" type="text" placeholder="">
+
                     </view>
                     <view class="arrow-right">
-                        <!-- <u-icon name="arrow-right" color="#666" size="16"></u-icon> -->
+                        <input class="custom-input" v-model="userInfo.nickName" type="text" placeholder="请输入昵称">
                     </view>
                 </view>
             </view>
@@ -139,9 +139,10 @@
                         <view class="nav-name">
                             <view class="">关系</view>
                         </view>
-                        <input class="custom-input" v-model="userInfo.blood" type="text" placeholder="">
+
                     </view>
                     <view class="arrow-right">
+                        <input class="custom-input" v-model="userInfo.blood" type="text" placeholder="请输入关系">
                     </view>
                 </view>
             </view>
@@ -173,9 +174,10 @@
                         <view class="nav-name">
                             <view class="">备注</view>
                         </view>
-                        <input class="custom-input" v-model="userInfo.remark" type="text" placeholder="">
+
                     </view>
                     <view class="arrow-right">
+                        <input class="custom-input" v-model="userInfo.remark" type="text" placeholder="请输入备注">
                     </view>
                 </view>
             </view>
@@ -416,9 +418,8 @@
 
                     .arrow-right{
                         width:64%;
-                        text-align: right;
+                        /*text-align: right;*/
                         margin: 0 auto;
-                        cursor: pointer;
                         padding-top: 3px;
                         display: flex;
                         justify-content: flex-end;
@@ -427,12 +428,20 @@
                             width: 18px;
                             height: 18px;
                         }
+                        .custom-input{
+                            font-size: 12px;
+                            width: 200rpx;
+                            /*border: 1px solid red;*/
+                        }
                         .head-img {
+                            width: 50px;
+                            height: 50px;
+                            border-radius: 25px;
                             text-align: center;
                             padding-right: 20px;
                             image{
-                                width: 24px;
-                                height: 24px;
+                                width: 50px;
+                                height: 50px;
                             }
                         }
                         .change-store{

+ 134 - 35
storePages/rights/index.vue

@@ -1,44 +1,37 @@
 <template>
-	<view class="page">
+	<view class="page" :style="{'height':windowHeight}">
 
-		<view  class="row-list flex-row justify-start" v-for="(item,index) in 10" :key="index">
-			<view class="h-text flex-col justify-center ">
-				<view class="money">
-					<text>¥100</text>
-				</view>
-				<view class="desc">
-					<text>权益券</text>
+		<scroll-view scroll-y :style="{'height':windowHeight}">
+			<view  class="row-list flex-row justify-start" v-for="(item,index) in equityList" :key="index">
+				<view class="h-text flex-col justify-center ">
+					<view class="money">
+						<text>¥{{item.salePrice}}</text>
+					</view>
+					<!--				<view class="desc">-->
+					<!--					<text>{{item.title}}</text>-->
+					<!--				</view>-->
 				</view>
-			</view>
 
-			<view class="h-center-content flex-col ">
-				<view class="h-value">
-					<text>门店通用</text>
-				</view>
-				<view class="title">
-					使用平台:<text>全平台</text>
-				</view>
-				<view class="title">
-					使用次数:3
-				</view>
-				<view class="title">
-					到期时间:2023-12-12
+				<view class="h-center-content flex-col justify-around">
+					<view class="h-value">
+						<text>{{item.title}}</text>
+					</view>
+					<view class="title">
+						使用项目:{{item.serviceProjectName || ''}}
+					</view>
+					<view class="title">
+						有效天数:{{item.effectiveDays}}
+					</view>
 				</view>
-			</view>
 
-			<view class="h-right-content flex-col justify-center ">
-				<picker  @change="bindPickerChange" mode='selector'  range-key="nickName" :value="serviceObjectIndex" :range="serviceObjectList">
+				<view class="h-right-content flex-col justify-center ">
 					<view class="btn" @click="payRights(item)">
 						<text>购买</text>
 					</view>
-				</picker>
+				</view>
 
 			</view>
-
-		</view>
-
-
-
+		</scroll-view>
 
 		<uni-popup ref="popup" :catchtouchmove="true" :animation="false" type="bottom">
 
@@ -96,36 +89,141 @@
 
 		</uni-popup>
 
-
+		<u-picker :show="show"  title="选择服务对象" :closeOnClickOverlay="true" @close="show = false" :columns="serviceObjectList" keyName="nickName" @cancel="show = false" @confirm="confirm"></u-picker>
 	</view>
 </template>
 <script>
 	export default {
 		data() {
 			return {
+				windowHeight:'',
+				show:false,
 				curServiceTab:1,
 				orderRights:{},
 				userInfo:{},
 				serviceObjectList:[],
-				serviceObjectIndex:0
-
+				serviceObjectIndex:0,
+				equityList:[],
+				serviceObject:{},
+				orderNo:''
 			};
 		},
 		onLoad(option) {
+			let sysInfo = uni.getSystemInfoSync()
+			this.windowHeight =sysInfo.windowHeight - 44 +'px'//除标题栏栏外的屏幕可用高度
 			this.userInfo = uni.getStorageSync('userInfo')
 			this.listServiceObject()
+			this.equityCardList()
 		},
 
 		methods: {
 
-			bindPickerChange(e){
+			commonGeneralOrder(){
+				this.$refs.popup.close()
+				this.$api.commonGeneralOrder({
+					orderType: 5,
+					serviceObjectId: this.serviceObject.id,
+					equityCardId:this.orderRights.id
+				}).then(res=>{
+					this.orderNo=res.data.data.orderNo
+
+					if (this.curServiceTab === 1){
+						//开启余额支付
+						this.balancePay()
+					}
+					if (this.curServiceTab === 2){
+						//调微信支付
+						this.wechatPay()
+					}
+
+
+				})
+			},
+
+			//余额支付
+			balancePay(){
+				let that = this;
+				this.$api.balancePay({
+					orderNo: this.orderNo,
+					password: ''
+				}).then((res)=>{
+					uni.showToast({
+						title: '支付成功!'
+					});
+					this.getUserInfo()
+				}).catch((res) =>{
+					console.log(res)
+					that.$refs.popup.close()
+					let msg = res.data.msg || '操作失败';
+					uni.showToast({
+						title: msg,
+						icon:'error'
+					})
+				});
+			},
+
+			wechatPay(){
+				let that = this;
+				// 发起微信支付
+				this.$api.wechatPay({
+					orderNo:this.orderNo
+				}).then((res)=>{
+					var param = res.data.data;
+					uni.requestPayment({
+						appId: param.appid,
+						timeStamp: param.timestamp+"",
+						nonceStr: param.noncestr,
+						package: "prepay_id="+param.prepayid,
+						signType: "RSA",
+						paySign: param.sign,
+						success: res => {
+							uni.showToast({
+								title: '支付成功!'
+							});
+						},
+						fail: res => {
+							console.log(res)
+							uni.showModal({
+								content: '支付失败',
+								showCancel: false
+							});
+						}
+					});
+				}).catch(() =>{
+					uni.showToast({
+						title: "操作失败"
+					})
+				});
+			},
+
+			getUserInfo(){
+				this.$api.getUserInfo().then(res=>{
+					console.log('++++++++++++获取用户信息++++++++++++++++++',res)
+					uni.setStorageSync('userInfo',res.data.data)
+					this.userInfo = res.data.data
+				})
+
+			},
+
+			confirm(e){
 				console.log(e)
+				this.serviceObject = e.value[0]
+				this.show = false
+				this.$refs.popup.open()
 			},
 
+			equityCardList(){
+				this.$api.equityCardList().then(res=>{
+					console.log(res)
+					this.equityList = res.data.data
+				})
+			},
+
+
 			// 查询服务对像信息列表
 			listServiceObject(){
 				this.$api.listServiceObject(this.reqParm).then((res)=>{
-					this.serviceObjectList = res.data.data
+					this.serviceObjectList[0] =res.data.data
 				})
 			},
 
@@ -141,6 +239,7 @@
 			},
 
 			payRights(item){
+				this.show =true
 				this.orderRights = item
 			}