cmy 11 months ago
parent
commit
0379c2f5e1
3 changed files with 46 additions and 8 deletions
  1. 12 1
      api/order.js
  2. 0 1
      components/payment/index.vue
  3. 34 6
      pages/goods/order_confirm/yuyue.vue

+ 12 - 1
api/order.js

@@ -240,10 +240,20 @@ export function orderConfirm(cartId, news, addressId, shippingType, store_id, co
  * @param string price
  * 
  */
+export function getCouponsServeOrderPrice(price, data) {
+	return request.post('coupons/subscribe_coupon_list/' + price, data)
+}
+
+/**
+ * 获取当前金额服务卡能使用的优惠卷
+ * @param string price
+ * 
+ */
 export function getCouponsOrderPrice(price, data) {
 	return request.get('coupons/order/' + price, data)
 }
 
+
 /**
  * 订单创建
  * @param string key
@@ -399,11 +409,12 @@ export function computedServe(data) {
 	return request.get(`v2/Subscribe/cart`, data);
 }
 
-//
+//创建服务项目
 export function SubscribeCreate(data) {
 	return request.post(`v2/Subscribe/create`, data);
 }
 
+// 服务项目退款申请
 export function storecompleteSubscribe(data) {
 	return request.post(`store/order/complete_subscribe`, data);
 }

+ 0 - 1
components/payment/index.vue

@@ -115,7 +115,6 @@
 				uni.showLoading({
 					title: '支付中'
 				});
-				return
 				orderPay({
 					uni: that.order_id,
 					paytype: paytype,

+ 34 - 6
pages/goods/order_confirm/yuyue.vue

@@ -85,7 +85,14 @@
 						<view class="zp-name">{{ygitem.alias}}</view>
 					</view>
 				</scroll-view>
-
+			</view>
+			<view class='wrapper'>
+				<view class='item acea-row row-between-wrapper' @tap='couponTap'>
+					<view>优惠券</view>
+					<view class='discount'>{{couponTitle}}
+						<text class='iconfont icon-jiantou'></text>
+					</view>
+				</view>
 			</view>
 			<view class='moneyList'>
 
@@ -156,7 +163,7 @@
 	import dayjs from '@/plugin/dayjs/dayjs.min.js';
 	import {
 		orderConfirm,
-		getCouponsOrderPrice,
+		getCouponsServeOrderPrice,
 		orderCreate,
 		postOrderComputed,
 		checkShipping,
@@ -408,6 +415,21 @@
 			this.timeranges = arrayNew;
 		},
 		methods: {
+			/**
+			 * 获取当前金额可用优惠券
+			 * 
+			 */
+			getCouponList: function() {
+				let that = this;
+				let data = {
+					products:that.product_id,
+					store_id:that.system_store.id
+				}
+				getCouponsServeOrderPrice(this.totalPrice, data).then(res => {
+					that.$set(that.coupon, 'list', res.data);
+					that.openType = 1;
+				});
+			},
 			getUserInfo() {
 				let that = this
 				getUserInfo().then(res => {
@@ -421,7 +443,8 @@
 			},
 			computedServe() {
 				computedServe({
-					products: this.product_id
+					products: this.product_id,
+					coupon_id:this.couponId
 				}).then(ress => {
 					console.log(ress)
 					this.payInfo = ress.data
@@ -774,6 +797,7 @@
 						store_id: that.system_store.id,
 						reservation_time: that.yytime,
 						sale_uid: that.sale_yg.id || 0,
+						coupon_id:this.couponId,
 						// #ifdef MP-WEIXIN
 						from: "routine"
 						// #endif
@@ -1101,7 +1125,8 @@
 					this.yg.list = []
 					this.yg.loadingType = 'more'
 					this.yg.page = 1
-					this.getMen()
+					this.getMen();
+					this.getCouponList();
 				}).catch(err => {})
 			},
 			// 关闭地址弹窗;
@@ -1121,10 +1146,11 @@
 			},
 			changePayType(type) {
 				this.payType = type
-				// this.computedPrice()
+				this.computedPrice()
 			},
 			computedPrice: function() {
 				let shippingType = this.shippingType;
+				console.log(this.priceGroup.couponPrice == 0 ? 0 : this.couponId,'this.priceGroup.couponPrice == 0 ? 0 : this.couponId');
 				postOrderComputed(this.orderKey, {
 					addressId: this.addressId,
 					useIntegral: this.useIntegral ? 1 : 0,
@@ -1241,7 +1267,9 @@
 			 * 获取当前订单详细信息
 			 * 
 			 */
-			getConfirm: function(numType) {},
+			getConfirm: function(numType) {
+				this.computedServe();
+			},
 			/*
 			 * 获取默认收货地址或者获取某条地址信息
 			 */