Browse Source

Signed-off-by: liuboyan <632697560@qq.com>
配置

liuboyan 4 years ago
parent
commit
7de03d91b4
6 changed files with 119 additions and 35 deletions
  1. 4 1
      config/api.js
  2. 41 24
      manifest.json
  3. 18 6
      pages/cart/cart.vue
  4. 1 0
      pages/index/index.vue
  5. 21 3
      pagesGood/orderPay.vue
  6. 34 1
      pagesMain/orderItem.vue

+ 4 - 1
config/api.js

@@ -1,4 +1,5 @@
-const WX_API_BASE = 'https://hubw.jihengcc.cn/'
+const WX_API_BASE = 'https://www.qianjiadi.com/'
+// const WX_API_BASE = 'https://hubw.jihengcc.cn/'
 
 module.exports = {
 	//  微信登录
@@ -79,6 +80,8 @@ module.exports = {
 	
 	//  下订单
 	submitOrder: WX_API_BASE + 'app/order/user/submitOrder',
+	//  立即支付未付款订单
+	payOrder: WX_API_BASE + 'app/order/user/my/orderList/continuePay',
 	//  查询订单列表
 	getOrderList: WX_API_BASE + 'app/order/user/my/orderList/',
 	//  取消订单

+ 41 - 24
manifest.json

@@ -9,7 +9,10 @@
         "usingComponents" : true,
         "compilerVersion" : 3,
         /* 5+App特有相关 */
-        "modules" : {},
+        "modules" : {
+            "OAuth" : {},
+            "Payment" : {}
+        },
         /* 模块配置 */
         "distribute" : {
             /* 应用发布信息 */
@@ -43,7 +46,21 @@
             "ios" : {},
             /* ios打包配置 */
             "sdkConfigs" : {
-                "ad" : {}
+                "ad" : {},
+                "oauth" : {
+                    "weixin" : {
+                        "appid" : "wxc6ab95e70160a2ee",
+                        "appsecret" : "a1eee335af123ba2f7621e6687ddb33b",
+                        "UniversalLinks" : ""
+                    }
+                },
+                "payment" : {
+                    "weixin" : {
+                        "__platform__" : [ "android" ],
+                        "appid" : "wxc6ab95e70160a2ee",
+                        "UniversalLinks" : ""
+                    }
+                }
             },
             "splashscreen" : {
                 "androidStyle" : "default",
@@ -51,33 +68,33 @@
             },
             "icons" : {
                 "android" : {
-                    "hdpi" : "C:/Users/63269/Downloads/zombies.png",
-                    "xhdpi" : "C:/Users/63269/Downloads/zombies.png",
-                    "xxhdpi" : "C:/Users/63269/Downloads/zombies.png",
-                    "xxxhdpi" : "C:/Users/63269/Downloads/zombies.png"
+                    "hdpi" : "",
+                    "xhdpi" : "",
+                    "xxhdpi" : "",
+                    "xxxhdpi" : ""
                 },
                 "ios" : {
-                    "appstore" : "C:/Users/63269/Downloads/zombies.png",
+                    "appstore" : "",
                     "ipad" : {
-                        "app" : "C:/Users/63269/Downloads/zombies.png",
-                        "app@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "notification" : "C:/Users/63269/Downloads/zombies.png",
-                        "notification@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "proapp@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "settings" : "C:/Users/63269/Downloads/zombies.png",
-                        "settings@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "spotlight" : "C:/Users/63269/Downloads/zombies.png",
-                        "spotlight@2x" : "C:/Users/63269/Downloads/zombies.png"
+                        "app" : "",
+                        "app@2x" : "",
+                        "notification" : "",
+                        "notification@2x" : "",
+                        "proapp@2x" : "",
+                        "settings" : "",
+                        "settings@2x" : "",
+                        "spotlight" : "",
+                        "spotlight@2x" : ""
                     },
                     "iphone" : {
-                        "app@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "app@3x" : "C:/Users/63269/Downloads/zombies.png",
-                        "notification@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "notification@3x" : "C:/Users/63269/Downloads/zombies.png",
-                        "settings@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "settings@3x" : "C:/Users/63269/Downloads/zombies.png",
-                        "spotlight@2x" : "C:/Users/63269/Downloads/zombies.png",
-                        "spotlight@3x" : "C:/Users/63269/Downloads/zombies.png"
+                        "app@2x" : "",
+                        "app@3x" : "",
+                        "notification@2x" : "",
+                        "notification@3x" : "",
+                        "settings@2x" : "",
+                        "settings@3x" : "",
+                        "spotlight@2x" : "",
+                        "spotlight@3x" : ""
                     }
                 }
             }

+ 18 - 6
pages/cart/cart.vue

@@ -6,15 +6,15 @@
 		</view>
 		<view class="cart-box" :style="{bottom: manageType ? '52px' : '0px'}">
 			<view class="shop-row" v-for="(item, index1) in cartsList" :key="index1">
-				<view class="shop-info">
+				<view class="shop-info" @click="goToShop(item)">
 					<view class="iconfont" :class="item.allCheck ? 'iconqueding' : 'iconfeigouxuan'" @click="checkShop(item)"></view>
 					<view class="iconfont iconshangjia" @click=""></view>
 					<view class="shop-name" @click="">{{item.supplierName}}</view>
 					<view class="iconfont iconfangxiang" @click=""></view>
 				</view>
 				<view class="goods-list">
-					<view class="goods-row" v-for="(site, index2) in item.products" :key="index2">
-						<view class="iconfont" :class="site.check ? 'iconqueding' : 'iconfeigouxuan'" @click="checkGoods(item, site)"></view>
+					<view class="goods-row" v-for="(site, index2) in item.products" :key="index2" @click.stop="goToGoodDetails(site)">
+						<view class="iconfont" :class="site.check ? 'iconqueding' : 'iconfeigouxuan'" @click.stop="checkGoods(item, site)"></view>
 						<cover-image class="goods-img" :src="site.imgUrl"></cover-image>
 						<view class="goods-info">
 							<view class="goods-name">{{site.productName}}</view>
@@ -23,10 +23,10 @@
 								<view class="goods-price">
 									<text style="font-size: 15px;">¥</text>{{site.bizPrice}}
 								</view>
-								<view class="handle-box">
-									<uni-icons type="minus-filled" size="20" color="#A67A54" @click="numSub(item, site)"></uni-icons>
+								<view class="handle-box" @click.stop="">
+									<uni-icons type="minus-filled" size="20" color="#A67A54" @click.native.stop="numSub(item, site)"></uni-icons>
 									<text class="good-select">{{site.buyNum}}</text>
-									<uni-icons type="plus-filled" size="20" color="#A67A54" @click="numAdd(item, site)"></uni-icons>
+									<uni-icons type="plus-filled" size="20" color="#A67A54" @click.native.stop="numAdd(item, site)"></uni-icons>
 								</view>
 							</view>
 						</view>
@@ -70,6 +70,18 @@
 			this.getCartData()
 		},
 		methods: {
+			//  跳转商铺页
+			goToShop(item) {
+				uni.navigateTo({
+					url: '/pagesGood/shopDetails?goodId=' + item.products[0].productId
+				});
+			},
+			//  跳转商品详情
+			goToGoodDetails(site) {
+				uni.navigateTo({
+					url: '/pagesGood/goodDetails?goodId=' + site.productId
+				});
+			},
 			//  获取购物车列表
 			getCartData() {
 				NET.request(API.getCartList, {}, 'GET').then(res => {

+ 1 - 0
pages/index/index.vue

@@ -100,6 +100,7 @@
 		onLoad() {
 		},
 		onReady(){
+			this.getBaseInfo()
 			this.appLoginWx()
 			setTimeout(() => {
 				this.triggered = true;

+ 21 - 3
pagesGood/orderPay.vue

@@ -291,9 +291,27 @@
 						//  备注
 						notes: this.notes,
 					}, 'POST').then(res => {
-						uni.reLaunch({
-							url: '/pagesMain/paySuccess'
-						});
+						uni.requestPayment({
+							provider: 'wxpay',
+							timeStamp: res.data.timeStamp,
+							nonceStr: res.data.nonceStr,
+							package: res.data.packageValue,
+							signType: res.data.signType,
+							paySign: res.data.paySign,
+							success: (payRes) => {
+								console.log('success:' + JSON.stringify(payRes));
+								uni.reLaunch({
+									url: '/pagesMain/paySuccess'
+								});
+							},
+							fail: (error) => {
+								console.log('fail:' + JSON.stringify(error));
+								this.$refs.uTips.show({
+									title: '支付失败',
+									type: 'warning',
+								})
+							}
+						})
 					}).catch(error => {
 						this.$refs.uTips.show({
 							title: '提交订单失败',

+ 34 - 1
pagesMain/orderItem.vue

@@ -190,7 +190,40 @@
 					})
 				} else if (this.handleType == 2) {
 					//  立即支付
-					this.modalShow = false
+					NET.request(API.payOrder, {
+						mid: uni.getStorageSync("userData").userId,
+						orderCode: this.orderData.orderCode,
+						orderId: this.orderData.orderId,
+					}, 'POST').then(res => {
+						this.modalShow = false
+						uni.requestPayment({
+							provider: 'wxpay',
+							timeStamp: res.data.timeStamp,
+							nonceStr: res.data.nonceStr,
+							package: res.data.packageValue,
+							signType: res.data.signType,
+							paySign: res.data.paySign,
+							success: (payRes) => {
+								console.log('success:' + JSON.stringify(payRes));
+								uni.navigateTo({
+									url: '/pagesMain/paySuccess'
+								});
+							},
+							fail: (error) => {
+								console.log('fail:' + JSON.stringify(error));
+								this.$refs.uTips.show({
+									title: '支付失败',
+									type: 'warning',
+								})
+							}
+						})
+					}).catch(error => {
+						this.modalShow = false
+						this.$refs.uTips.show({
+							title: error.data.msg,
+							type: 'warning',
+						})
+					})
 				} else if (this.handleType == 5) {
 					//  确认收货
 					NET.request(API.confirmOrder, {