소스 검색

代码提交

WangYiHan 11 달 전
부모
커밋
b88a3fb24e

+ 13 - 0
api/sleep/equ.js

@@ -5,11 +5,18 @@ export function getEquList(data) {
   return request.get("app-api/member/user-device-bind/bind-list", data, {
   });
 }
+// 之前版本得绑定接口
 export function bindEqu(data) {
   return request.post('app-api/member/user-device-bind/bind', data, {
     noAuth: true 
   });
 }
+// 绑定接口改新接口,增加入参身份证号和手机号cardNumber mobileNumber
+export function bindEqu_V1(data) {
+  return request.post('app-api/member/user-device-bind/bind_V1', data, {
+    noAuth: true 
+  });
+}
 // 获取关系列表接口
 export function getDetailList(data) {
   return request.get("app-api/member/user-relation/detail-list", data, {
@@ -27,4 +34,10 @@ export function bindDefaultEqu(data) {
   return request.post('app-api/member/user-device-bind/bind-default', data, {
     noAuth: true 
   });
+}
+// 会员删除绑定设备
+export function bindDelete(data) {
+  return request.delete('app-api/member/user-device-bind/bind-delete',data, {
+	  noAuth: true
+  });
 }

+ 3 - 2
config/app.js

@@ -1,5 +1,6 @@
 
-let domain = 'http://192.168.110.5:48080'
+// let domain = 'http://192.168.110.5:48080'
+let domain = 'https://5y413b7433.yicp.fun'
 // let domain = 'http://127.0.0.1:48080'
 
 module.exports = {
@@ -7,7 +8,7 @@ module.exports = {
 	// #ifdef MP
 		HTTP_REQUEST_URL: domain,
 	// #endif
-	// #ifdef H5
+	// #ifdef H5||APP-PLUS 
 		//H5接口是浏览器地址
 		// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
 		// http://api.java.crmeb.net:20001

+ 66 - 7
pages.json

@@ -143,6 +143,16 @@
 					,
 				"navigationBarTextStyle": "#fff"
 					// #endif
+					
+					// #ifdef APP-PLUS
+					,
+					"navigationBarTextStyle": "#fff",
+					"app-plus": {
+					    "titleNView": {
+					    "type": "default"
+					    }
+					}
+					// #endif
 			}
 		}, {
 			"path": "pages/index/components/a_seckill",
@@ -170,7 +180,14 @@
 				{
 					"path": "user_info/index",
 					"style": {
-						"navigationBarTitleText": "个人资料"
+						"navigationBarTitleText": "个人资料",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
@@ -182,7 +199,14 @@
 				{
 					"path": "user_goods_collection/index",
 					"style": {
-						"navigationBarTitleText": "收藏商品"
+						"navigationBarTitleText": "收藏商品",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
@@ -200,7 +224,14 @@
 				{
 					"path": "user_money/index",
 					"style": {
-						"navigationBarTitleText": "我的账户"
+						"navigationBarTitleText": "我的账户",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
@@ -212,13 +243,27 @@
 				{
 					"path": "user_integral/index",
 					"style": {
-						"navigationBarTitleText": "积分详情"
+						"navigationBarTitleText": "积分详情",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
 					"path": "user_coupon/index",
 					"style": {
-						"navigationBarTitleText": "我的优惠券"
+						"navigationBarTitleText": "我的优惠券",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
@@ -269,7 +314,14 @@
 				{
 					"path": "user_address_list/index",
 					"style": {
-						"navigationBarTitleText": "地址管理"
+						"navigationBarTitleText": "地址管理",
+						"app-plus": {
+						    // #ifdef APP-PLUS
+						    "titleNView": {
+						    "type": "default"
+						    }
+						    // #endif
+						}
 					}
 				},
 				{
@@ -315,7 +367,14 @@
 				{
 					"path": "goods_details_store/index",
 					"style": {
-						"navigationBarTitleText": "门店列表"
+						"navigationBarTitleText": "门店列表",
+						"app-plus": {
+							// #ifdef APP-PLUS
+							"titleNView": {
+							"type": "default"
+							}
+							// #endif
+						}
 					}
 				},
 				{

+ 20 - 20
pages/equ_list/bind.vue

@@ -1,7 +1,7 @@
 <template>
 
 	<view class="page">
-		<!-- #ifdef APP-PLUS || H5 || MP -->
+		<!-- #ifdef APP-PLUS || H5  -->
 		<!-- 状态栏占位 -->
 		<view class="status_bar"></view>
 		<view class="" style="margin-top: var(--status-bar-height);">
@@ -24,7 +24,7 @@
 					<u-form-item label="证件号"><u-input v-model="formData.cardNumber" placeholder="请输入证件号" @blur="cardNumberBlur"/></u-form-item>
 					<u-form-item label="性别" right-icon="arrow-right"><u-input v-model="formData.sexValue" placeholder="请选择性别" disabled/></u-form-item>
 					<u-form-item label="生日" right-icon="arrow-right"><u-input v-model="formData.birthday" placeholder="请选择生日" disabled/></u-form-item>
-					<u-form-item label="手机号"><u-input v-model="formData.tel" @blur="telBlur" placeholder="请输入手机号"/></u-form-item>
+					<u-form-item label="手机号"><u-input v-model="formData.mobileNumber" @blur="mobileNumberBlur" placeholder="请输入手机号"/></u-form-item>
 				</u-form>
 			</view>
 			<view class="form-box">
@@ -44,7 +44,7 @@
 			<van-field v-model="formData.deviceCode" readonly name="ID号" label="ID号" placeholder="ID号" />
 			<view class="content">
 				<van-form @submit="bindEqu" ref="formData" :model="formData" label-width="48" :colon="true">
-					<van-field class="btn" v-model="formData.photo" name="照片" label="照片" placeholder="照片" readonly
+					<van-field class="btn" v-model="formData.avatar" name="照片" label="照片" placeholder="照片" readonly
 						@click.native.stop.prevent="uploadpic" input-align="right">
 						<template #button>
 							<image src="/static/img/arrow.png" mode=""></image>
@@ -68,9 +68,9 @@
 							<image src="/static/image/calendar.png" mode=""></image>
 						</template>
 					</van-field>
-					<van-field v-model="formData.tel" name="手机号" label="手机号" placeholder="请输入手机号"
-						:rules="[{ required: true, message: '请填写手机号' }]" @blur="telBlur"
-						@change="formData.tel = $event.detail" />
+					<van-field v-model="formData.mobileNumber" name="手机号" label="手机号" placeholder="请输入手机号"
+						:rules="[{ required: true, message: '请填写手机号' }]" @blur="mobileNumberBlur"
+						@change="formData.mobileNumber = $event.detail" />
 
 				</van-form>
 
@@ -146,7 +146,7 @@
 
 
 				formData: {
-					photo: '',
+					avatar: '',
 					deviceCode: '',
 					nickName: '',
 					relationId: null,
@@ -156,7 +156,7 @@
 					sexValue: '',
 					birthday: '',
 					cardNumber: '',
-					tel: ''
+					mobileNumber: ''
 				},
 
 				username: '',
@@ -213,23 +213,23 @@
 				// }).catch(() => {
 				// 	this.$toast.fail('提交失败')
 				// })
+				this.formData.avatar=this.newAvatar
 				const {
-					photo,
+					avatar,
 					nickName,
 					cardNumber,
 					relationId,
 					passWord,
 					sex,
 					birthday,
-					tel
+					mobileNumber
 				} = this.formData
-				// if(photo == '') {
-				// 	this.$util.Tips({
-				// 		title: '请上传图片',
-				// 		icon: 'none'
-				// 	})
-				// }else 
-				if (nickName == '') {
+				if(avatar == '') {
+					this.$util.Tips({
+						title: '请上传图片',
+						icon: 'none'
+					})
+				}else if (nickName == '') {
 					this.$util.Tips({
 						title: '请填写姓名',
 						icon: 'none'
@@ -239,7 +239,7 @@
 						title: '请填写证件号',
 						icon: 'none'
 					})
-				} else if (tel == '') {
+				} else if (mobileNumber == '') {
 					this.$util.Tips({
 						title: '请填写手机号',
 						icon: 'none'
@@ -257,7 +257,7 @@
 						memberId: this.uid
 					}
 					console.log(params, 7778);
-					infoApi.bindEqu(params).then(res => {
+					infoApi.bindEqu_V1(params).then(res => {
 							this.$util.Tips({
 								title: '绑定成功',
 								icon: 'success'
@@ -323,7 +323,7 @@
 					}
 				});
 			},
-			telBlur(e) {
+			mobileNumberBlur(e) {
 				let val=''
 				// #ifdef APP-PLUS || H5
 					val = e

+ 45 - 7
pages/equ_list/index.vue

@@ -12,10 +12,10 @@
 				<radio-group class="radio-group" @change="radioChange" v-if="equipmentList.length">
 					<view class='item borRadius14' v-for="(item,index) in equipmentList" :key="index">
 						<view class="content_box_top">
-							<u-avatar class="avatar" :src="item.relationVo.avatar" mode="square" :show-sex="true"
-								:sex-icon="item.sex === 1 ? 'male':'female'"
-								:icon-color="gender === 'male' ? '#409EFF' : '#F56C6C'"></u-avatar>
-							<view class='address' @click='goIndex(item.id,item.deviceCode)'>
+							<u-avatar class="avatar" :src="item.avatar" mode="square" :show-sex="true"
+								:sex-icon="item.sex === 1 ? 'man':'woman'"
+								:sex-bg-color="item.sex === 1 ? 'man-primary' : 'woman-error'"></u-avatar>
+							<view class='address' @click='goIndex(item.id,item.deviceCode,item.nickName)'>
 								<view class="address-left">
 									<view class='consignee'>
 										<view>昵称:{{ item.nickName }}</view>
@@ -199,7 +199,14 @@
 					memberId: this.uid
 				}
 				infoApi.getEquList(params).then(res => {
-					this.$set(this, 'equipmentList', res.data);
+					console.log(res.data,'7777777777777777777777')
+					if(res.data.length>0){
+						this.$set(this, 'equipmentList', res.data);
+					}else{
+						this.$store.commit("DEVICE_CODE", '')
+						this.$store.commit("DEVICE_NAME", '')
+					}
+					
 					this.loadTitle = '我也是有底线的';
 					this.loading = false;
 				}).catch(err => {
@@ -272,6 +279,35 @@
 						title: '您删除的地址不存在!'
 					});
 				}
+				console.log('点击了')
+				// #ifdef APP-PLUS || H5
+				uni.showModal({
+				  title: '提示',
+				  content: '是否确认删除此设备?',
+				  success: res => {
+				    if (res.confirm) {
+				      let params = {
+				      	memberId: this.uid,
+				      	id: item.id
+				      }
+				      infoApi.bindDelete(params).then(res => {
+				      	this.$util.Tips({
+				      		title: '删除成功',
+				      		icon: 'success'
+				      	}, () => {
+				      		this.equipmentList.splice(index, 1);
+				      		this.getEquipmentList()
+				      	});
+				      }).catch(err => {
+				      	return this.$util.Tips({
+				      		title: err
+				      	});
+				      });
+				    }
+				  }
+				});
+				// #endif
+				// #ifdef MP
 				Dialog.confirm({
 						title: '',
 						message: '是否确认删除此设备?',
@@ -299,6 +335,7 @@
 					.catch(() => {
 						// on cancel
 					});
+					// #endif
 
 
 			},
@@ -415,7 +452,7 @@
 						});
 				});
 			},
-			goIndex(id,code) {
+			goIndex(id,code,name) {
 				infoApi.bindDefaultEqu({
 					memberId: this.uid,
 					id: id
@@ -423,6 +460,7 @@
 					// this.$store.commit("DEVICE_ID", res.data.AddressApi
 					// uni.setStorageSync('deviceCode',code)
 					this.$store.commit("DEVICE_CODE", code)
+					this.$store.commit("DEVICE_NAME", name)
 					uni.switchTab({
 						url: '/pages/index/index'
 					})
@@ -454,7 +492,7 @@
 	}
 	.address-management {
 		padding: 20rpx 0;
-		margin-top: var(--status-bar-height);
+		// margin-top: var(--status-bar-height);
 	}
 
 	.address-management.fff {

+ 7 - 3
pages/goods/cashier/index.vue

@@ -11,7 +11,6 @@
                    :datatime="invalidTime / 1000" :is-col="true" :bgColor="bgColor" />
 			</view>
 		</view>
-		{{channelCode}}111
 		<view class="payment" >
 			<view class="title">
 				支付方式
@@ -44,6 +43,7 @@
   import * as WalletApi from '@/api/pay/wallet.js';
   import {fen2yuan} from "../../../utils/util";
   import { mapGetters } from "vuex";
+  import { getDomain } from "@/utils/request.js";
   export default {
     computed: mapGetters([ 'openid' ]),
     components: {
@@ -301,7 +301,7 @@
         // #endif
 
         // 1.2 如果不是公众号环境,则移除微信公众号支付
-        // #ifdef H5
+        // #ifdef MP
         if (!this.$wechat.isWeixin()) {
           this.channels = this.channels.filter(item => item.code !== 'wx_pub')
         }
@@ -309,6 +309,7 @@
 
         // 2. 读取配置,移除被禁用的支付渠道
         PayChannelApi.getEnableChannelCodeList(appId).then(res => {
+			console.log(res,'我是新写的结果')
           this.channels = this.channels.filter(item => res.data.includes(item.code));
 			console.log(this.channels,'this.channels1111')
 
@@ -335,9 +336,12 @@
       getPayReturnUrl() {
         // #ifdef H5
         return location.href
+		
         // #endif
         // #ifdef APP-PLUS
-        return '/pages/goods/order_details/index?order_id=' + this.orderId + '&returnUrl=' + this.returnUrl;
+		const currentDomain = getDomain();
+		// https://5y413b7433.yicp.fun
+        return currentDomain + '/pages/goods/order_details/index?order_id=' + this.orderId + '&returnUrl=' + this.returnUrl;
         // #endif
         return '';
       },

+ 13 - 9
pages/goods_cate/goods_cate.vue

@@ -43,17 +43,15 @@
 									<view class='name line1'>{{item.name}}</view>
 									<view class='money font-color' :class='is_switch?"":"on"'> <text
 											class='num'>¥{{ fen2yuan(item.price) }}</text>
-
 										<view class="carnum num-dis row-left" v-if="item.selected_goods_num>0">
 											<view class="item reduce"
-												:class="attr.productSelect.cart_num <= 1 ? 'on' : ''"
+												:class="item.selected_goods_num <= 1 ? 'on' : ''"
 												@click.stop="CartNumDes(item.id)">
 												-
 											</view>
-											<view class='item num'>
-												<input type="number" v-model="item.selected_goods_num"
-													data-name="productSelect.cart_num"
-													@input="bindCode(attr.productSelect.cart_num)" />
+											<view class='item num' @click.stop="bindCode()">		
+												<input style="color: #000;background-color: #EAEAEA;" type="number" v-model="item.selected_goods_num"
+													@input="updateCart" />
 											</view>
 											<view v-if="iSplus" class="item plus"
 												:class="attr.productSelect.cart_num >= attr.productSelect.stock ? 'on'  : ''"
@@ -155,6 +153,9 @@
 			this.getAllCategory()
 		},
 		methods: {
+			updateCart: function(event) {
+				console.log(event,'我是购物车 ')
+			},
 			infoScroll: function() {
 				let len = this.productList.length;
 				let child = this.productList[len - 1] && this.productList[len - 1].child ? this.productList[len - 1]
@@ -289,7 +290,9 @@
 					console.log('我进拉了', index, this.goodsRightList, )
 					console.log(this.goodsRightList[index].selected_goods_num, 888)
 					// this.$set(this.goodsRightList[index],'selected_goods_num')
-					this.goodsRightList[index].selected_goods_num++
+					// this.goodsRightList[index].selected_goods_num++
+					this.$set(this.goodsRightList[index], 'selected_goods_num', this.goodsRightList[index].selected_goods_num + 1);
+					console.log(this.goodsRightList[index].selected_goods_num,'我是购物车的数量')
 					// // 关闭 attr 组件
 					// this.attr.cartAttr = false;
 					// 提示成功
@@ -310,7 +313,7 @@
 				const index = this.cartList.findIndex(item => item.spu.id === id);
 				this.$refs.orderAddcart.subCart(index)
 			},
-			CartNumAdd: function(id) {
+			CartNumAdd(id) {
 				console.log('我增加了',id,this.cartList)
 				const index = this.cartList.findIndex(item => item.spu.id === id);
 				this.$refs.orderAddcart.addCart(index)
@@ -584,8 +587,9 @@
 
 	.productSort .conter .listw .list .item .text .money .carnum {
 		// height: 54rpx;
-		margin-top: 24rpx;
+		// margin-top: 24rpx;
 		display: flex;
+		align-items: center;
 	}
 
 	.productSort .conter .listw .list .item .text .money .carnum view {

+ 80 - 7
pages/index/index.vue

@@ -111,8 +111,13 @@
 		</view>
 		<!-- #ifdef APP-PLUS||H5 -->
 		<view class="status_bar" v-if="deviceCode"></view>
-		<view class="aaa" v-if="deviceCode" style="margin-top: var(--status-bar-height);margin-bottom: var(--status-bar-height);">
-			<uni-nav-bar title="" height="var(--status-bar-height)" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="webviewback"></uni-nav-bar>
+		<view class="content-box" v-if="deviceCode" style="margin-top: var(--status-bar-height);margin-bottom: var(--status-bar-height);">
+			<uni-nav-bar title="" height="var(--status-bar-height)" left-icon="left"  backgroundColor="#F35546" color="#fff" @clickLeft="webviewback">
+				<view class="serch-wrapper flex" @click="goEquList">
+					<image class="logo" src='/static/img/addequ.png' mode="" />
+					<view class="name">{{deviceName}}</view>
+				</view>
+			</uni-nav-bar>
 		</view>
 		<!-- #endif -->
 		<view class="" v-if="deviceCode">
@@ -149,7 +154,7 @@
 	// const webview =web.webview
 	// #endif
 	export default {
-		computed: mapGetters(['deviceCode', 'isLogin']),
+		computed: mapGetters(['deviceCode','deviceName', 'isLogin']),
 		data() {
 			return {
 				statusBarHeight: statusBarHeight,
@@ -298,12 +303,19 @@
 			});
 		},
 		onShow() {
+			if (!this.isLogin) {
+				toLogin();
+				return;
+			}
 			// this.initAmap();
 			this.getLocationInfo()
 			// this.getHrdata()
-			console.log(this.deviceCode,this.h5url,'deviceCodedeviceCode')
+			console.log(this.deviceCode,this.deviceName,this.h5url,'deviceCodedeviceCode')
 			if(this.deviceCode){
 				this.geth5Url()
+				// #ifdef APP-PLUS
+				  this.setWebviewHeight()
+				// #endif
 			}
 		},
 		onPageUnload: function() {
@@ -328,9 +340,7 @@
 				        // this.errorMessage = '获取位置信息失败: ' + error.errMsg;
 				    }
 			});
-			// #ifdef APP-PLUS
-			  this.setWebviewHeight()
-			// #endif
+			
 
 		},
 		onHide: function() {
@@ -342,6 +352,9 @@
 		},
 		methods: {
 			webviewback(){
+				let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
+				let curRoute = routes[routes.length - 1].route //获取当前页面路由
+				console.log(curRoute,'我是当前路由')
 				uni.reLaunch({
 					url: '/pages/index/index'
 				})
@@ -832,6 +845,66 @@
 </script>
 
 <style lang="scss">
+	.content-box{
+		.serch-wrapper {
+			height: var(--status-bar-height);
+			align-items: center;
+			// padding: 19rpx;
+			box-sizing: border-box;
+			margin-left: -50rpx;
+			// border: 1rpx solid yellow;
+			z-index: 9999;
+			position: fixed;
+			top:var(--status-bar-height);
+			left: 110rpx;
+			color: #fff;
+		
+			image {
+				// width: 118rpx;
+				width: 50rpx;
+				height: 42rpx;
+			}
+		
+			.logo {
+				width: 32rpx;
+				height: 32rpx;
+				display: flex;
+			}
+		
+			.arrow {
+				width: 48rpx;
+				height: 48rpx;
+			}
+		
+			.name {
+				flex: 1;
+				text-align: center;
+				color: #fff;
+				font-size: 36rpx;
+				margin: 0 13rpx 0 18rpx;
+				white-space: nowrap;
+			}
+		
+			.input {
+				display: flex;
+				align-items: center;
+				/* #ifdef MP */
+				width: 305rpx;
+				/* #endif */
+				height: 50rpx;
+				padding: 0 0 0 30rpx;
+				background: rgba(247, 247, 247, 1);
+				border: 1px solid rgba(241, 241, 241, 1);
+				border-radius: 29rpx;
+				color: #BBBBBB;
+				font-size: 28rpx;
+		
+				.iconfont {
+					margin-right: 20rpx;
+				}
+			}
+		}
+	}
 	.map-box {
 		z-index: 888;
 		width: 100%;

+ 11 - 1
pages/user/index.vue

@@ -1,8 +1,9 @@
 <template>
 	<view class="new-users copy-data">
 		<!-- #ifdef APP-PLUS || H5 -->
+		<view class="status_bar1"></view>
 		<view class="" style="margin-top: var(--status-bar-height);">
-			<uni-nav-bar title="个人中心" backgroundColor="#E93323" color="#fff"></uni-nav-bar>
+			<uni-nav-bar title="个人中心" backgroundColor="#ea3322" color="#fff"></uni-nav-bar>
 		</view>
 		<!-- #endif -->
 		<view class="mid" style="flex:1;overflow: hidden;">
@@ -210,6 +211,7 @@
 			}
 		},
 		onLoad() {
+			console.log(this.userInfo,'userInfouserInfouserInfouserInfo')
 			// #ifdef H5
 			this.$set(this, 'pageHeight', app.globalData.windowHeight);
 			// #endif
@@ -381,6 +383,14 @@
 		display: flex;
 		flex-direction: column;
 		height: 100%;
+		.status_bar1{
+			background-color: #ea3322;
+			width: 100%;
+			height: var(--status-bar-height);
+			position: fixed;
+			top: 0;
+			z-index: 999;
+		}
 
 		.sys-head {
 			position: relative;

+ 13 - 1
pages/users/order_confirm/index.vue

@@ -1,5 +1,11 @@
 <template>
 	<view>
+		<!-- #ifdef APP-PLUS || H5 -->
+		<view class="status_bar"></view>
+		<view class="" style="margin-top: var(--status-bar-height);">
+			<uni-nav-bar title="" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="back"></uni-nav-bar>
+		</view>
+		<!-- #endif -->
 		<view class='order-submission'>
 			<view class="allAddress" :style="store_self_mention ? '':'padding-top:10rpx;'">
 				<view class="nav acea-row">
@@ -279,6 +285,9 @@
 			})
 		},
 		methods: {
+			back() {
+				uni.navigateBack()
+			},
       /**
        * 获得订单确认信息
        */
@@ -546,6 +555,9 @@
 </script>
 
 <style lang="scss" scoped>
+	::v-deep .uni-navbar--border {
+		border: none !important;
+	}
 	.line2{
 		width: 504rpx;
 	}
@@ -603,7 +615,7 @@
 
 	.order-submission .allAddress {
 		width: 100%;
-		background: linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
+		background: linear-gradient(to bottom, #F35546 0%, #f5f5f5 100%);
 		// background-image: linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
 		// background-image: -webkit-linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);
 		// background-image: -moz-linear-gradient(to bottom, #e93323 0%, #f5f5f5 100%);

+ 2 - 0
pages/users/user_info/index.vue

@@ -114,7 +114,9 @@
 			 * 上传文件
 			 */
 			uploadpic: function() {
+				console.log('我走到这')
         this.$util.uploadImageOne({}, res => {
+			console.log('我进来了')
           this.newAvatar = res.data;
         });
 			},

+ 1 - 1
pages/users/user_money/index.vue

@@ -9,7 +9,7 @@
 								<view>总资产(元)</view>
 								<view class='money'>{{ fen2yuan(wallet.balance || 0) }}</view>
 							</view>
-							<!-- #ifdef H5 -->
+							<!-- #ifdef H5||APP-PLUS -->
 							<navigator url="/pages/users/user_payment/index" hover-class="none" class='recharge font-color'>充值</navigator>
 							<!-- #endif -->
 							<!-- #ifdef MP -->

+ 4 - 3
pages/users/user_payment/index.vue

@@ -81,7 +81,7 @@
 				picList: [],
 				activePic: 0,
 				money: "",
-				rechar_id: 0, // 选择的套餐编号
+				rechar_id: null, // 选择的套餐编号
 				rechargeAttention: [
           '1、充值金额最少为 1 元',
           '2、充值后只能用于消费',
@@ -115,7 +115,7 @@
 			picCharge(idx, item) {
 				this.activePic = idx;
 				if (item === undefined) {
-					this.rechar_id = 0;
+					this.rechar_id = null;
 				} else {
 					this.money = "";
 					this.rechar_id = item.id;
@@ -200,7 +200,7 @@
 						title: '正在支付',
 					})
 					let money = parseFloat(this.money);
-					if (this.rechar_id === 0) {
+					if (this.rechar_id === null) {
 						if (Number.isNaN(money)) {
 							return that.$util.Tips({
 								title: '充值金额必须为数字'
@@ -220,6 +220,7 @@
           WalletApi.createWalletRecharge({
             payPrice: money ? money * 100 : undefined,
             packageId: this.rechar_id
+            // packageId: 1
 					}).then(res => {
             const returnUrl = encodeURIComponent('/pages/users/user_payment/index');
             uni.navigateTo({

+ 2 - 1
store/getters.js

@@ -10,5 +10,6 @@ export default {
 	systemPlatform: state => state.app.systemPlatform,
 	openid: state => state.app.openid,
 	productType: state => state.app.productType,
-	deviceCode: state => state.app.deviceCode
+	deviceCode: state => state.app.deviceCode,
+	deviceName: state => state.app.deviceName
 };

+ 7 - 1
store/modules/app.js

@@ -20,7 +20,8 @@ const state = {
 	chatUrl: Cache.get('chatUrl') || '',
 	systemPlatform: Cache.get(PLATFORM)?Cache.get(PLATFORM):'',
 	productType: Cache.get('productType') || '',
-	deviceCode: Cache.get('deviceCode') || ''
+	deviceCode: Cache.get('deviceCode') || '',
+	deviceName: Cache.get('deviceName') || ''
 };
 
 const mutations = {
@@ -81,6 +82,11 @@ const mutations = {
 		console.log(deviceCode,'我是vuex里的数据');
 		state.deviceCode = deviceCode;
 		Cache.set('deviceCode', deviceCode);
+	},
+	DEVICE_NAME(state, deviceName) {
+		console.log(deviceName,'我是vuex里的数据');
+		state.deviceName = deviceName;
+		Cache.set('deviceName', deviceName);
 	}
 };
 

+ 67 - 56
utils/request.js

@@ -9,36 +9,51 @@ import {
 	checkLogin
 } from '../libs/login';
 import store from '../store';
-import {getTerminal} from "./util";
+import { getTerminal } from "./util";
 
 // TODO 芋艿:临时解决 uniapp 在小程序,undefined 会被 tostring 的问题
 function deleteUndefinedProperties(obj) {
-  for (let key in obj) {
-    if (obj.hasOwnProperty(key)) {
-      if (typeof obj[key] === 'object' && obj[key] !== null) {
-        deleteUndefinedProperties(obj[key]); // 递归调用,处理嵌套的对象
-      } else if (obj[key] === undefined) {
-        delete obj[key];
-      }
-    }
-  }
+	for (let key in obj) {
+		if (obj.hasOwnProperty(key)) {
+			if (typeof obj[key] === 'object' && obj[key] !== null) {
+				deleteUndefinedProperties(obj[key]); // 递归调用,处理嵌套的对象
+			} else if (obj[key] === undefined) {
+				delete obj[key];
+			}
+		}
+	}
+}
+
+// 定义并存储域名变量
+const DOMAIN_KEY = 'CURRENT_DOMAIN';
+const DEFAULT_DOMAIN = 'https://5y413b7433.yicp.fun/';
+
+// 检查缓存中是否已有域名,如果没有则设置默认域名
+if (!uni.getStorageSync(DOMAIN_KEY)) {
+	uni.setStorageSync(DOMAIN_KEY, DEFAULT_DOMAIN);
+}
+
+// 获取缓存中的域名
+const getDomain = () => {
+	return uni.getStorageSync(DOMAIN_KEY);
+}
+
+// 设置缓存中的域名
+const setDomain = (domain) => {
+	uni.setStorageSync(DOMAIN_KEY, domain);
 }
 
 /**
  * 发送请求
  */
-function baseRequest(url, method, data, {
-	noAuth = false,
-	noVerify = false
-}, params) {
-	let Url = HTTP_REQUEST_URL,header = HEADER
+function baseRequest(url, method, data, { noAuth = false, noVerify = false }, params) {
+	let Url = HTTP_REQUEST_URL, header = HEADER;
 	if (params != undefined) {
 		header = HEADERPARAMS;
 	}
 	if (!noAuth) {
 		//登录过期自动登录
 		if (!store.state.app.token && !checkLogin()) {
-      // debugger
 			toLogin();
 			return Promise.reject({
 				msg: '未登录'
@@ -46,49 +61,44 @@ function baseRequest(url, method, data, {
 		}
 	}
 
-  deleteUndefinedProperties(data)
+	deleteUndefinedProperties(data);
 
-  // TODO 补个 header 多租户
-  if (url.indexOf('app-api') >= 0) {
-    header = {
-      ...header
-    }
-    header['tenant-id'] = 1
-  }
+	// TODO 补个 header 多租户
+	if (url.indexOf('app-api') >= 0) {
+		header = {
+			...header
+		}
+		header['tenant-id'] = 1;
+	}
 
-  	// 终端
-	header['terminal'] = getTerminal()
+	// 终端
+	header['terminal'] = getTerminal();
 
 	if (store.state.app.token) {
-    // header[TOKENNAME] = store.state.app.token;
-    header['Authorization'] = 'Bearer ' + store.state.app.token;
-  }
-  const isUseSleep = uni.getStorageSync("useSleep")
-  console.log(uni.getStorageSync("useSleep"),'判断从哪来的,true代表从首页来'); 
-  // : 'http://yunai.natapp1.cc/' + url, // TODO 芋艿:搞个 url 的配置
-  // : 'http://127.0.0.1:48080/' + url, // TODO 芋艿:搞个 url 的配置
-  // : 'http://api-dashboard.yudao.iocoder.cn/' + url, // TODO 芋艿:搞个 url 的配置
-  const baseUrl='http://192.168.110.185:48060/'
-  const sleepUrl='http://api.slaaplekker.cn'
-	return new Promise((reslove, reject) => {
+		header['Authorization'] = 'Bearer ' + store.state.app.token;
+	}
+
+	const isUseSleep = uni.getStorageSync("useSleep");
+	console.log(uni.getStorageSync("useSleep"), '判断从哪来的,true代表从首页来'); 
+	// : 'http://yunai.natapp1.cc/' + url, // TODO 芋艿:搞个 url 的配置
+	// : 'http://127.0.0.1:48080/' + url, // TODO 芋艿:搞个 url 的配置
+	// : 'http://api-dashboard.yudao.iocoder.cn/' + url, // TODO 芋艿:搞个 url 的配置
+	const baseUrl = 'http://192.168.110.185:48060/';
+	const sleepUrl = 'http://api.slaaplekker.cn';
+
+	return new Promise((resolve, reject) => {
 		uni.request({
-			// url: url.indexOf('app-api') < 0 ? Url + '/api/front/' + url
-      // url: url.indexOf('app-api') < 0 ? Url + '/api/front/' + url:(isUseSleep ? sleepUrl+url: baseUrl + url), // TODO 芋艿:搞个 url 的配置
-		// url: isUseSleep ?sleepUrl+url:(url.indexOf('app-api') < 0 ? Url + '/api/front/' + url : baseUrl + url),
-		url: url.indexOf('app-api') < 0 ? Url + '/api/front/' + url
-		// :'http://192.168.110.185:48060/'+url,
-		:'https://5y413b7433.yicp.fun/'+url,
-      method: method || 'GET',
+			url: url.indexOf('app-api') < 0 ? Url + '/api/front/' + url : getDomain() + url,
+			method: method || 'GET',
 			header: header,
 			data: data || {},
 			success: (res) => {
-				console.log(url=url.indexOf('app-api') < 0 ? Url + '/api/front/' + url
-				:'http://192.168.110.185:48060/'+url,'成功接口')
-				console.log(res,'我接口请求成功了')
+				console.log(url.indexOf('app-api') < 0 ? Url + '/api/front/' + url : getDomain() + url, '成功接口');
+				console.log(res, '我接口请求成功了');
 				if (noVerify)
-					reslove(res.data, res);
+					resolve(res.data, res);
 				else if (res.data.code === 200 || res.data.code === 0)
-					reslove(res.data, res);
+					resolve(res.data, res);
 				else if ([410000, 410001, 410002, 401].indexOf(res.data.code) !== -1) {
 					toLogin();
 					reject(res.data);
@@ -96,21 +106,22 @@ function baseRequest(url, method, data, {
 					reject(res.data.msg || res.data.message || '系统错误');
 			},
 			fail: (msg) => {
-				console.log(url=url.indexOf('app-api') < 0 ? Url + '/api/front/' + url
-		:'http://192.168.110.185:48060/'+url,'失败接口')
-				console.log(msg,'我是失败接口')
+				console.log(url.indexOf('app-api') < 0 ? Url + '/api/front/' + url : getDomain() + url, '失败接口');
+				console.log(msg, '我是失败接口');
 				reject('请求失败');
 			}
-		})
+		});
 	});
 }
 
 const request = {};
 
 ['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
-	request[method] = (api, data, opt, params) => baseRequest(api, method, data, opt || {}, params)
+	request[method] = (api, data, opt, params) => baseRequest(api, method, data, opt || {}, params);
 });
 
-
-
+export {
+	getDomain,
+	setDomain
+};
 export default request;