chenrong hace 1 año
padre
commit
fa11b8da08

+ 1 - 1
App.vue

@@ -16,7 +16,7 @@
 			inviteId: null,
 			orderConfirmIds: [],
 			selectAddrss: false,
-			
+			selectCoupon: false,
 		}
 	}
 </script>

+ 11 - 0
api/coupon.js

@@ -0,0 +1,11 @@
+import { request } from "@/api/config.js"
+
+
+// 我的优惠卷列表
+export function mylistApi(data) {
+  return request({
+    url: '/wx/coupon/mylist',
+    method: 'get',
+    data: data
+  })
+}

+ 8 - 0
api/knapsack.js

@@ -25,3 +25,11 @@ export function prizeOrderApi(data) {
     data: data
   })
 }
+// 商城订单
+export function packageOrderListApi(data) {
+  return request({
+    url: '/wx/bkm/package/order/list',
+    method: 'get',
+    data: data
+  })
+}

+ 10 - 0
component/paymentPopup.vue

@@ -136,8 +136,18 @@
 				this.$refs.popup2.close()
 			},
 			submit() {
+				this.params.couponId = 10
+				let _this = this
 				drawCardSubmitApi(this.params).then(res => {
 					console.log(res, '提交购买卡牌')
+					// 如果不需要付钱,直接进入抽卡结果
+					if (res.data.orderStatus == 201) {
+						_this.close()
+						_this.$refs.popup2.open('center')
+						_this.getLotteryResults(res)
+						_this.$emit('callBack')
+						return
+					}
 					this.orderId = res.data.orderId
 					// 唤起支付
 					this.wxPayment(res.data)

+ 4 - 1
main.js

@@ -4,12 +4,15 @@ import Vue from 'vue'
 import App from './App'
 
 import {
-	navigateTo
+	navigateTo,
+	redirectTo
 } from '@/utils/utils.js'
 import {
 	selectDictLabel
 } from "@/utils/utils.js"
 Vue.prototype.$navigateTo = navigateTo;
+Vue.prototype.$redirectTo = redirectTo;
+
 Vue.prototype.$selectDictLabel = selectDictLabel;
 Vue.config.productionTip = false
 

+ 9 - 0
pages.json

@@ -103,6 +103,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/coupon/coupon",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "我的优惠卷",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 1 - 0
pages/addressManage/addressManage.vue

@@ -54,6 +54,7 @@
 						addressId: item.id,
 					}
 					this.$navigateTo("/pages/orderConfirm/orderConfirm", params)
+					getApp().globalData.selectAddrss = false
 				}
 			},
 			getList() {

+ 97 - 0
pages/coupon/coupon.vue

@@ -0,0 +1,97 @@
+<template>
+	<view class="container">
+		<view class="card" v-for="(item, index) in list">
+			<view class="leftIcon" ></view>
+			<view class="left"  >
+				¥<span style="font-size: 18px;">{{item.discount}}</span>
+			</view>
+			<view class="right">
+				<view class="row title">
+					{{item.name}}
+				</view>
+				<view class="row endTime">
+					{{item.endTime}}到期
+				</view>
+				<view class="row desc">
+					{{item.desc}}
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mylistApi
+	} from "@/api/coupon.js"
+	export default {
+		onLoad() {
+			this.getList()
+		},
+		data() {
+			return {
+				list: [],
+				params: {
+					limit: 999,
+					page: 1,
+					// status: 0
+				}
+			}
+		},
+		methods: {
+			getList() {
+				mylistApi(this.params).then(res => {
+					console.log(res, '我的优惠卷')
+					this.list = res.data.list
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.container {
+		background: #eaeaea;
+		padding: 10px;
+		
+		.card {
+			background: #fff;
+			border-radius: 8px;
+			overflow: hidden;
+			display: flex;
+			
+			.leftIcon {
+				height: auto; 
+				width: 8px; 
+				background: #FF2C43;
+			}
+			.left {
+				width: 80px;
+				display: inline-flex;
+				justify-content: center;
+				align-items: center;
+				color: #FF2C43;
+				font-weight: 600;
+			}
+			.right {
+				padding: 10px;
+				.row {
+					margin-bottom: 4px;
+					font-size: 12px;
+				}
+				.title {
+					font-size: 14px;
+					font-weight: 600;
+				}
+				.endTime {
+					color: #FF2C43;
+				}
+				.desc {
+					margin-top: 5px;
+					color: #8c8c8c;
+				}
+			}
+		}
+	}
+	
+</style>

+ 1 - 1
pages/mine/mine.vue

@@ -27,7 +27,7 @@
 						积分
 					</view>
 				</view>
-				<view class="box">
+				<view class="box" @click="$redirectTo('/pages/coupon/coupon')">
 					<view class="value">
 						2
 					</view>

+ 1 - 0
pages/orderConfirm/orderConfirm.vue

@@ -184,6 +184,7 @@
 						wx.switchTab({
 							url: '/pages/knapsack/knapsack'
 						})
+						return
 					}
 					_this.wxPayment(res.data)
 				})

+ 16 - 0
utils/utils.js

@@ -31,6 +31,22 @@ export function navigateTo(url, query){
 	})
 }
 
+export function redirectTo(url, query){
+	console.log('进入页面跳转事件')
+	if (query && Object.keys(query).length != 0) {
+		url += '?'
+		for (let i in query) {
+			url += i 
+			url += '='
+			url += query[i]
+			url += '&'
+		}
+	}
+	console.log(url, 'url')
+	wx.redirectTo({
+		url: url
+	})
+}
 // 回显数据字典
 export function selectDictLabel(datas, value) {
     var actions = [];