zpj пре 1 година
родитељ
комит
262f13092e

+ 8 - 0
api/project.js

@@ -0,0 +1,8 @@
+import {request} from '@/common/js/ajax.js'
+
+const commonUrl = 'api/project/'
+
+// 查当前用户折扣
+export const projectDiscount = (data) => request(commonUrl + 'discount', 'post', { ...data },true)
+// 支付成功以后调用核销
+export const projectWriteDiscount = (data) => request(commonUrl + 'write_discount', 'post', { ...data },true)

+ 15 - 2
common/css/common.css

@@ -213,7 +213,12 @@ image {
 .fc-lan{
 	color: #0093dc;
 }
-
+.fc-074B86{
+	color: #074B86;
+}
+.fc-1778FD{
+	color: #1778FD;
+}
 /* 背景颜色 */
 .bgc-f{
 	background-color: #fff;
@@ -256,4 +261,12 @@ image {
 .mb-25{
 	margin-bottom: 25rpx;
 }
-
+.mb-40{
+	margin-bottom: 40rpx;
+}
+.mb-13{
+	margin-bottom: 13rpx;
+}
+.mr-10{
+	margin-right: 10rpx;
+}

+ 14 - 1
common/js/ajax.js

@@ -7,7 +7,7 @@ let BASE_URL =''
 BASE_URL ='https://demoapi.jhcs888.com/'
 //#endif
 
-export const request = (url, method, data, show = false) => {
+export const request = (url, method, data,isFinance = false,show = false) => {
   let token = uni.getStorageSync('token')
   let u_id = uni.getStorageSync('u_id')
   if(token&&u_id){
@@ -20,6 +20,19 @@ export const request = (url, method, data, show = false) => {
   if (data === undefined) {
     data = {};
   }
+
+  //#ifndef H5
+	if(isFinance){
+		  let nodeEnv = process.env.NODE_ENV;
+		  if(nodeEnv === 'development'){
+			  BASE_URL = 'http://testadopted.jhcs888.com/'
+		  }else{
+			  BASE_URL = 'https://adopted.jhcs888.com/'
+		  }
+	}
+  //#endif
+  
+  
   return new Promise((resolve, reject) => {
     uni.request({
       url:BASE_URL+  url,

+ 7 - 1
manifest.json

@@ -83,7 +83,13 @@
                     "pathRewrite" : {
                         "^/cashierApi" : "cashierApi"
                     }
-                }
+                },
+				"/api" : {
+				    // "target" : "https://adopted.jhcs888.com/",
+				    "target" : "http://testadopted.jhcs888.com/",
+				    "changeOrigin" : true,
+				    "secure" : false
+				}
             }
         }
     }

+ 252 - 33
pages/index/order.vue

@@ -37,23 +37,37 @@
 		</view>
 	  </scroll-view>
 		
-		
+	 
+	 
+	 <view class="box-2-b align-items-center">
+			<view class="box-2-shou flex-justify-center align-items-center" @click="headInput()">
+				<image src="@/static/img/txm.png" mode=""></image>
+				<view class="fs-30 fc-3 fw-400">手输条码</view>
+			</view>
+			<view class="box-2-shou flex-justify-center align-items-center" @click="openMenber()">
+				<image src="@/static/img/txm.png" mode=""></image>
+				<view class="fs-30 fc-3 fw-400">扫会员码</view>
+			</view>
+			<view v-if="member_id" class="flex-justify-center align-items-center">
+				<view class="fs-24 fc-074B86 fw-400">会员ID {{member_id}}</view>
+			</view>
+	 </view>
+	 
 	 <!-- 3 -->
 	  <view class="box-2">
-		  <view class="">
-		  	{{msgTest}}
-		  </view>
-		<view class="box-2-shou flex-justify-center align-items-center" @click="headInput()">
-			<image src="@/static/img/txm.png" mode=""></image>
-			<view class="fs-30 fc-3 fw-400">手输条码</view>
-		</view>
 		<view class="flex-justify-space">
 			<view class="">
-				<view class="fs-30 fc-3">共{{totalNum}}件</view>
+				<view class="fs-30 fc-3">
+					共{{totalNum}}件
+					<span v-if="discount&&discount>0">,已优惠</span>
+					<span class="fs-30 fc-ED301D fw-600 mr-10" v-if="discount&&discount>0">¥{{(totalPrice - (totalPrice*discount)).toFixed(2)}}</span>
+					<span class="fs-30 fc-ED301D fw-600" v-if="discount&&discount>0">{{discount*10||'0'}}折</span>
+				</view>
 				<view class="">
 					<span class="fs-30 fc-3">合计</span>
 					<span class="fs-30 fc-ED301D">¥</span>
-					<span class="fs-40 fc-ED301D fw-600">{{totalPrice}}</span>
+					<span class="fs-40 fc-ED301D fw-600" v-if="discount&&discount>0">{{(totalPrice*discount).toFixed(2)}}</span>
+					<span class="fs-40 fc-ED301D fw-600" v-else>{{totalPrice}}</span>
 				</view>
 			</view>
 			<view class="to-save text-align-center fs-32 fc-f" @click="save()">去结算</view>
@@ -98,10 +112,69 @@
 	  <uni-popup ref="inputDialog" type="dialog">
 			<uni-popup-dialog v-model="headValue" mode="input" title="输入条码"  placeholder="请输入条码" @confirm="dialogInputConfirm"></uni-popup-dialog>
 	  </uni-popup>
+	  
+	  <!-- 会员码 -->
+	  <uni-popup ref="inputMember" type="bottom" :mask-click="false">
+	  		<view class="flex-common-css member-pop-view">
+	  			<view class="member-pop-view-1"></view>
+				<view class="member-pop-view-2 flex-1">
+					<view class="flex-justify-space align-items-center mb-40">
+						<image class="img-11" src="@/static/member/shuom.png" mode=""></image>
+						<image @click="closePOP()" class="img-close" src="@/static/member/close.png" mode=""></image>
+					</view>
+					<view class="mb-40">
+						<view class="align-items-center mb-13">
+							<view class="yuan">1</view>
+							<view class="align-items-center">
+								<view class="fs-30">微信搜索</view>
+								<view class="fs-30 fc-1778FD">振合网实体联盟</view>
+								<view class="fs-30">公众号,点击</view>
+								<view class="fs-30 fc-1778FD">民营经济</view>
+							</view>
+						</view>
+						<view class="bg-1 flex-justify-center align-items-center">
+							<image class="img-12" src="@/static/member/1.png" mode=""></image>
+							<image class="img-13" src="@/static/member/right.png" mode=""></image>
+							<image class="img-12" src="@/static/member/2.png" mode=""></image>
+						</view>
+					</view>
+					<view class="mb-40">
+						<view class="align-items-center mb-13">
+							<view class="yuan">2</view>
+							<view class="align-items-center">
+								<view class="fs-30">找到个人中心点击</view>
+								<view class="fs-30 fc-1778FD">分享码</view>
+							</view>
+						</view>
+						<view class="bg-1 flex-justify-center align-items-center">
+							<image class="img-12" src="@/static/member/3.png" mode=""></image>
+							<image class="img-13" src="@/static/member/right.png" mode=""></image>
+							<image class="img-12" src="@/static/member/4.png" mode=""></image>
+						</view>
+					</view>
+					<view class="">
+						<view class="align-items-center mb-13">
+							<view class="yuan">3</view>
+							<view class="align-items-center">
+								<view class="fs-30">二维码对准扫描口,</view>
+								<view class="fs-30 fc-1778FD">识别完成,显示会员IP</view>
+							</view>
+						</view>
+						<view class="bg-1 flex-justify-center align-items-center">
+							<image class="img-12" src="@/static/member/5.png" mode=""></image>
+							<image class="img-13" src="@/static/member/right.png" mode=""></image>
+							<image class="img-12" src="@/static/member/6.png" mode=""></image>
+						</view>
+					</view>
+				</view>
+	  		</view>
+	  </uni-popup>
 	</view>
 </template>
 
 <script>
+import {projectDiscount} from '@/api/project.js';
+	
 import keyboardListener from 'uniapp-keyboard-listener';
 import {GoodsInfo,OrderCreate,OrderPay} from '@/api/cashierApi.js'
 import tools from '@/common/js/tools';
@@ -111,6 +184,11 @@ export default {
   components: {keyboardListener,Countdown},
   data() {
     return {
+	  isMemeber:false,
+	  discount:'',//折扣
+	  member_id:'',//会员id
+	  invite_code:'',//推荐码
+		
 	  totalNum:0,//总数量
 	  totalPrice:0,//总金额
       payType:'',//1微信 2支护宝
@@ -128,7 +206,6 @@ export default {
 	  
 	  headValue:'',//手动输入的值
 	  
-	  msgTest:'',
 	  
     };
   },
@@ -143,7 +220,7 @@ export default {
   },
   
   mounted() {
-  	
+	  
   },
   
   methods: {
@@ -155,34 +232,69 @@ export default {
         this.nvalue = '';
         // 条码中可能会有大写字母和未定义的按键,所以要过滤出来
         newArr = this.keyArr.filter(item => item != 'Shift' && item != 'Enter' && item != 'Unidentified')
-        if(this.payFLag){
-			// 添加商品
+		if(this.isMemeber){
 			if(this.isAJAX){
 				return
 			}
 			this.isAJAX = true;
-        	this.nvalue = newArr.join("")
-        	this.getGoods();
-        }else{
-			// 支付扫码
-			if(this.isAJAX){
-				return
+			let href = newArr.join("")
+			const urlArr = href.split('?')
+			const rightUrlArr = urlArr[1].split('#/')
+			const queryObj = {}
+			rightUrlArr[0].split('&').map((item)=> {
+				const splitStr = item.split('=')
+				return{
+					key:splitStr[0],
+					value:splitStr[1]
+				}
+			}).forEach((item)=>{
+				queryObj[item.key]= item.value
+			})
+			if(urlArr.length >= 3){
+				rightUrlArr[1]="?"+ urlArr[2]
 			}
-			this.isAJAX = true;
-			this.auth_code = newArr.join("")
-			OrderPay({order_id:this.order_id,pay_type:this.payType,auth_code:this.auth_code}).then((res)=>{
-				this.msgTest = res
+			this.invite_code = queryObj.memberCode
+			projectDiscount({invite_code:this.invite_code}).then((res)=>{
 				if(res.code == 1){
-					this.payFLag = true;
 					this.isAJAX = false;
-					uni.redirectTo({
-						url:'/pages/index/success?money=' + this.totalPrice
-					})
+					this.member_id = res.data.member_id;
+					this.discount = res.data.discount * 1;
+					this.closePOP();
 				}else{
 					this.isAJAX = false;
 					tools.error(res.msg)
 				}
 			})
+		}else{
+			if(this.payFLag){
+				// 添加商品
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				this.nvalue = newArr.join("")
+				this.getGoods();
+			}else{
+				// 支付扫码
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				this.auth_code = newArr.join("")
+				OrderPay({order_id:this.order_id,pay_type:this.payType,auth_code:this.auth_code}).then((res)=>{
+					if(res.code == 1){
+						this.payFLag = true;
+						this.isAJAX = false;
+						
+						uni.redirectTo({
+							url:'/pages/index/success?money=' + this.totalPrice + "&discount=" + this.discount + '&invite_code=' + this.invite_code
+						})
+					}else{
+						this.isAJAX = false;
+						tools.error(res.msg)
+					}
+				})
+			}
 		}
         this.keyArr = [];
       }
@@ -296,6 +408,50 @@ export default {
 		this.nvalue = this.headValue;
 		this.getGoods();
 	},
+	
+	// 会员扫码
+	openMenber(){
+		// let href = "http://test-wapadopted.jhcs888.com/#/pages/index/index?memberCode=53913013";
+		// const urlArr = href.split('?')
+		// const rightUrlArr = urlArr[1].split('#/')
+		// const queryObj = {}
+		// rightUrlArr[0].split('&').map((item)=> {
+		// 	const splitStr = item.split('=')
+		// 	return{
+		// 		key:splitStr[0],
+		// 		value:splitStr[1]
+		// 	}
+		// }).forEach((item)=>{
+		// 	queryObj[item.key]= item.value
+		// })
+		// if(urlArr.length >= 3){
+		// 	rightUrlArr[1]="?"+ urlArr[2]
+		// }
+		// this.invite_code = queryObj.memberCode
+		// projectDiscount({invite_code:this.invite_code}).then((res)=>{
+		// 	if(res.code == 1){
+		// 		this.isAJAX = false;
+		// 		this.member_id = res.data.member_id;
+		// 		this.discount = res.data.discount * 1;
+		// 	}else{
+		// 		this.isAJAX = false;
+		// 		tools.error(res.msg)
+		// 	}
+		// })
+		
+		this.isMemeber = true;
+		this.$refs.inputMember.open();
+	},
+	closePOP(){
+		this.isMemeber = false;
+		this.$refs.inputMember.close();
+	},
+	lookBigImg(list, index) {
+		uni.previewImage({
+			urls: list,
+			current: index,
+		})
+	},
   },
   
 };
@@ -303,6 +459,56 @@ export default {
 
 
 <style scoped lang="scss">
+	.member-pop-view{
+		width: 100%;
+		height: 100vh;
+		background: #939394;
+		.member-pop-view-1{
+			width: 100%;
+			height: 187rpx;
+		}
+		.member-pop-view-2{
+			background-color: #fff;
+			box-sizing: border-box;
+			padding: 38rpx;
+			border-radius: 20rpx;
+			.img-11{
+				width: 258rpx;
+				height: 50rpx;
+			}
+			.img-close{
+				width: 58rpx;
+				height: 58rpx;
+			}
+			.yuan{
+				width: 41rpx;
+				height: 41rpx;
+				border-radius: 50%;
+				background: #1778FD;
+				margin-right: 17rpx;
+				text-align: center;
+				line-height: 41rpx;
+				font-size: 24rpx;
+				font-weight: bold;
+				color: #fff;
+			}
+			.bg-1{
+				width: 100%;
+				height: 221rpx;
+				background: #E8EFF9;
+				border-radius: 25rpx;
+			}
+			.img-12{
+				width: 270rpx;;
+				height: 210rpx;
+			}
+			.img-13{
+				width: 42rpx;;
+				height: 42rpx;
+			}
+		}
+	}
+	
 	.index-home{
 		.no-img{
 			width: 200rpx;
@@ -370,22 +576,35 @@ export default {
 				}
 			}
 		}
-		.box-2{
+		
+		.box-2-b{
 			width: 100%;
-			height: 220rpx;
+			height: 83rpx;
+			background: #E6E7E9;
 			box-sizing: border-box;
-			padding: 20rpx 16rpx;
+			padding: 12rpx 23rpx;
 			.box-2-shou{
 				width: 177rpx;
 				height: 58rpx;
 				border-radius: 104rpx;
-				border: 2rpx solid #CCCCCC;
-				margin: 0 0 20rpx auto;
+				background: #fff;
+				margin-right: 20rpx;
 				image{
 					width: 25rpx;
 					height: 25rpx;
 				}
 			}
+		}
+		
+		
+		
+		.box-2{
+			width: 100%;
+			height: 150rpx;
+			box-sizing: border-box;
+			padding: 20rpx 23rpx;
+			
+			
 			
 			.to-save{
 				margin-top: auto;

+ 14 - 3
pages/index/success.vue

@@ -20,21 +20,32 @@
 </template>
 
 <script>
+	import {projectWriteDiscount} from '@/api/project.js';
 	export default {
 		data(){
 			return{
-				totalPrice:'',
+				totalPrice:'',//实付款
+				money:'',//原价
+				discount:'',
+				invite_code:'',
 			}
 		},
 		onLoad(e) {
-			this.totalPrice = e.money
+			this.totalPrice = ((e.money*1)*(e.discount*1)).toFixed(2);
+			this.money = e.money;
+			this.invite_code = e.invite_code;
+			this.discount = e.discount;
+			this.upData();
 		},
 		methods:{
 			buy(){
 				uni.reLaunch({
 					url:'/pages/index/index'
 				})
-			}
+			},
+			upData(){
+				projectWriteDiscount({order_money:this.money,invite_code:this.invite_code,discount:this.discount}).then((res)=>{})
+			},
 		},
 	}
 </script>

+ 2 - 2
pages/login/index.vue

@@ -33,8 +33,8 @@
 		data(){
 			return{
 				inputType:true,
-				phone:'19112107434',
-				password:'123456',
+				phone:'',
+				password:'',
 				isAJAX:false,
 			}
 		},

BIN
static/member/1.png


BIN
static/member/2.png


BIN
static/member/3.png


BIN
static/member/4.png


BIN
static/member/5.png


BIN
static/member/6.png


BIN
static/member/close.png


BIN
static/member/right.png


BIN
static/member/shuom.png