una vor 4 Monaten
Ursprung
Commit
658ed7fea8

+ 62 - 12
pages/mall/checkout/checkout.js

@@ -6,13 +6,14 @@ var app = getApp();
 
 Page({
   data: {
+		addressShow: false,
 		addressList:[],
 		address:{
 			detail:'',
 			name:'',
 			tel:''
 		},
-    shopAddress:'',//门店地址
+    // shopAddress:'',//门店地址
     buyNumber:'',
     memberDiscount: '',
     isMember: false,
@@ -105,7 +106,8 @@ Page({
     petinfo: null, //宠物保险内容
     shareId: 0,
     userInfo: {},
-    remarkDisable: false,
+		remarkDisable: false,
+		code:'',
   },
   //获取checkou信息
   getCheckoutInfo: function () {
@@ -130,7 +132,7 @@ Page({
           // isMember: res.data.isMember,
           // memberDiscount: res.data.memberDiscount,
           checkedGoodsList: res.data.skus,
-          shopAddress:res.data.address,
+          // shopAddress:res.data.address,
           buyNumber:res.data.buyNumber,
 					actualPrice: res.data.price,
 					addressId:res.data.addressId
@@ -434,8 +436,14 @@ Page({
     }
 
   },
-
-  orderPay() {
+   async getWxCode(){
+	let res=await user.login();
+	console.log(res);
+	this.setData({
+		code:res.code
+	});
+	},
+     async orderPay() {
 		  if(this.data.addressId==null||this.data.addressId==''){
 				if(this.data.address.detail==''){
 					util.showErrorToast('请输入收货地址');
@@ -463,7 +471,8 @@ Page({
 			receiverPhone:this.data.address.tel
       
     };
-
+await	this.getWxCode();
+	
     util.request(mall.OrderSubmit, orderInfo, 'POST').then(res => {
       if (res.errno === 0) {
         console.log(res);
@@ -471,9 +480,11 @@ Page({
         const orderId = res.data;
         this.setData({
           orderId: orderId
-        });
+				});
+			
         util.request(mall.OrderPrepay, {
-          orderId: orderId
+					orderId: orderId,
+					code:this.data.code
         }, 'POST').then(res => {
           if (res.errno === 0) {
             const payParam = res.data;
@@ -1142,9 +1153,12 @@ Page({
       payFailShow: false
     });
   },
-  rePay() {
+   async rePay() {
+		await	this.getWxCode();
+	
     util.request(mall.OrderPrepay, {
-      orderId: this.data.orderId
+			orderId: this.data.orderId,
+			code:this.data.code
     }, 'POST').then(res => {
       if (res.errno === 0) {
         const payParam = res.data;
@@ -1198,7 +1212,7 @@ getAddressList() {
 	util.request(mall.AddressList).then((res) => {
 			if (res.errno === 0) {
 					this.setData({
-							addressList: res.data.list
+							addressList: res.data
 					});
 					let current = this.data.addressList.filter((item) => {
 							return item.id == this.data.addressId;
@@ -1216,7 +1230,43 @@ addressSelect() {
 			addressShow: true
 	});
 },
-
+addressConfirm(e) {
+	let address = e.currentTarget.dataset.address;
+	this.setData({
+		checkedAddress: address,
+		addressShow: false
+	});
+},
+onAddressClose() {
+	this.setData({
+		addressShow: false
+	})
+},
+goAddAddress(){
+	this.setData({
+		addressId:0,
+		addressShow: false
+	})
+},
+bindinputAddress(event) {
+let detail = event.detail.value.replace(/[,,]/g, '');
+	this.setData({
+		'address.detail': detail
+	});
+	
+},
+bindinputMobile(event) {
+	let tel = event.detail.value;
+	this.setData({
+		'address.tel': tel
+	});
+},
+bindinputName(event) {
+	let name = event.detail.value;
+	this.setData({
+		'address.name': name
+	});
+},
 
 
 

+ 33 - 0
pages/mall/checkout/checkout.wxml

@@ -337,4 +337,37 @@
   </van-overlay>
 
 
+  
+
+  <!-- 地址弹框 -->
+  <view class="appoint-overlay-wrapper address-overlay" wx:if="{{ addressShow }}" bindtap="onAddressClose">
+
+<view class="address-popup" cantap="onAddressClick">
+	<view class="title">
+		选择地址
+	</view>
+	<view class="address-list">
+		<view class="address-item" wx:for="{{addressList}}" wx:key="index" data-address="{{item}}"
+			bindtap="addressConfirm">
+			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/jzmall-dy/icon-order-map.png"
+				class="map-img"></image>
+
+			<view class="address-main">
+				<view class="main-line">
+					<view>{{item.receiverName}}</view>
+					<view class="phone">{{item.receiverPhone}}</view>
+				</view>
+			
+				<view class="customer-address" >{{item.receiverAddress}}</view>
+			</view>
+			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-dy/arrow-grey.png" class="arrow-img">
+			</image>
+		</view>
+	</view>
+	<view class="add-address-btn" bindtap="goAddAddress">新增地址</view>
+</view>
+</view>
+
+
+
 </view>

+ 73 - 1
pages/mall/checkout/checkout.wxss

@@ -901,4 +901,76 @@ background: linear-gradient(177deg, #F1E3C8 0%, #E6C162 100%);
   .female text {
     color: #ACADB1;
     font-size: 24rpx;
-  }
+	}
+	
+/* 地址选择 */
+.appoint-overlay-wrapper.address-overlay {
+  display: flex;
+  align-items: flex-end;
+}
+
+.address-popup {
+  width: 750rpx;
+  padding: 0 24rpx 0rpx;
+  background: #FFFFFF;
+  border-radius: 56rpx 56rpx 0 0;
+}
+
+.address-popup .title {
+  font-weight: 600;
+  color: #191919;
+  font-size: 28rpx;
+  height: 122rpx;
+  line-height: 122rpx;
+  text-align: center;
+}
+
+.address-list {
+  height: 720rpx;
+  overflow-y: scroll;
+  padding-bottom: 20rpx;
+}
+
+.address-popup .add-address-btn {
+  width: 654rpx;
+  margin: 40rpx 24rpx 40rpx;
+  height: 90rpx;
+  background: linear-gradient(90deg, #00BAFF 0%, #008DFF 100%);
+  border-radius: 45rpx;
+  font-size: 36rpx;
+  text-align: center;
+  color: rgba(255, 255, 255, 0.9);
+  line-height: 90rpx;
+}
+
+.address-item {
+  width: 702rpx;
+  display: flex;
+  align-items: center;
+  min-height: 132rpx;
+  border-radius: 24rpx;
+  border: 2rpx solid #E3E3E3;
+  margin-bottom: 30rpx;
+}
+
+.address-item .arrow-img {
+  width: 28rpx;
+  height: 28rpx;
+  margin-left: 20rpx;
+}
+
+.address-item .map-img {
+  width: 48rpx;
+  height: 48rpx;
+  margin-right: 24rpx;
+
+}
+.appoint-overlay-wrapper {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: rgba(0, 0, 0, .7);
+  z-index: 999;
+}

+ 17 - 6
pages/mall/order/order.js

@@ -1,5 +1,6 @@
 var util = require('../../../utils/jmsUtil.js');
 var mall = require('../../../api/mall.js'); 
+var user = require('../../../utils/user.js');
 var app = getApp();
 Page({
   data: {
@@ -13,7 +14,8 @@ Page({
     myqr_blur:0,//背景模糊值
     myqr_width:0,
     hasLogin:false,
-    goodsId:''
+		goodsId:'',
+		code:'',
   },
   onLoad: function(options) {
     // 页面初始化 options为页面跳转所带来的参数
@@ -34,7 +36,7 @@ Page({
     let that = this;
     util.request(mall.OrderList, {
       showType: that.data.showType,
-      page: that.data.page,
+      pageNo: that.data.page,
       limit: that.data.limit
     }).then(function(res) {
       wx.hideLoading();
@@ -194,13 +196,22 @@ Page({
         console.log(res);
       }
     })
-  },
+	},
+	async getWxCode(){
+		let res=await user.login();
+		console.log(res);
+		this.setData({
+			code:res.code
+		});
+		},
   // “去付款”按钮点击效果
-  payOrder: function(e) {
+   async payOrder(e) {
     let that = this;
-    let id = e.currentTarget.dataset.id;
+		let id = e.currentTarget.dataset.id;
+		await	this.getWxCode();
     util.request(mall.OrderPrepay, {
-      orderId: id
+			orderId: id,
+			code:this.data.code
     }, 'POST').then(function(res) {
       if (res.errno === 0) {
         const payParam = res.data;