Browse Source

订单地址更新

yuxingxing 2 years ago
parent
commit
c14e0d0320

+ 18 - 1
api/home.js

@@ -50,7 +50,7 @@ export function getUserAddressByUserId(data) {
 }
 
 // 
-export function getUserAddress(data) {
+export function getUserAddressByIdAndFreight(data) {
 	return request.get("v1/userAddress-detailByIdAndFreight",data);
 }
 
@@ -89,3 +89,20 @@ export function postUserAddressRemove(data) {
 export function getUserOrderPage(data) {
 	return request.get("v1/finance/order-page",data);
 }
+
+// 取消订单
+export function postUserOrderCancel(data) {
+	let url = "id="+data.id
+	return request.post("v1/finance/order-cancel?"+url,data);
+}
+
+// 申请退款
+export function postUserOrderRefund(data) {
+	let url = "id="+data.id
+	return request.post("v1/finance/order-refund?"+url,data);
+}
+
+// 立即购买下单前置校验
+export function postBeforeCheck(data) {
+	return request.post("v1/re/order/beforeCheck",data);
+}

+ 10 - 5
components/addressWindow/index.vue

@@ -17,7 +17,7 @@
 			<view class='pictrue' v-if="!is_loading && !addressList.length">
 				<image :src="imgHost + '/statics/images/noAddress.png'"></image>
 			</view>
-			<view class='addressBnt bg-color' @tap='goAddressPages'>{{$t(`选择其它地址`)}}</view>
+			<!-- <view class='addressBnt bg-color' @tap='goAddressPages'>{{$t(`选择其它地址`)}}</view> -->
 		</view>
 		<view class='mask' catchtouchmove="true" :hidden='address.address==false' @tap='close'></view>
 	</view>
@@ -27,6 +27,9 @@
 	import {
 		getAddressList
 	} from '@/api/user.js';
+	import {
+		getUserAddressPage,
+	} from "@/api/home.js";
 	import {HTTP_REQUEST_URL} from '@/config/app';
 	export default {
 		props: {
@@ -57,7 +60,9 @@
 				is_loading: true
 			};
 		},
-
+		created() {
+			this.getAddressList()			
+		},
 		methods: {
 			tapAddress: function(e, addressid) {
 				this.active = e;
@@ -76,9 +81,9 @@
 			},
 			getAddressList: function() {
 				let that = this;
-				getAddressList({
-					page: 1,
-					limit: 5
+				getUserAddressPage({
+					userId: this.$store.state.app.uid,
+					type: 1
 				}).then(res => {
 					let addressList = res.data;
 					//处理默认选中项

+ 337 - 0
components/orderGoods/index_mall.vue

@@ -0,0 +1,337 @@
+<template>
+	<view class="orderGoods">
+		<view class='total' v-if="is_behalf"><text>
+				{{$t(`代付金额`)}}:
+				<text class="pay-price">¥{{pay_price}}</text>
+			</text>
+		</view>
+		<view class='total' v-else-if="!split && !is_behalf">{{$t(`共`)}}{{totalNmu}}{{$t(`件商品`)}}</view>
+		<view class='total' v-else-if="split">
+			<text>{{$t(`订单包裹`)}} {{index + 1}}</text>
+			<view class="rig-btn" v-if="status_type === -1">
+				<view class="refund">{{$t(`申请退款中`)}}</view>
+			</view>
+			<view class="rig-btn" v-else-if="status_type === -2">
+				<view class="refund">{{$t(`已退款`)}}</view>
+			</view>
+			<view class="rig-btn" v-else-if="status_type === 4">
+				<view class="done">{{$t(`已完成`)}}</view>
+			</view>
+		</view>
+
+		<view class='goodWrapper'>
+			<view class='' :class="{op:!item.isSale}" v-for="(item,index) in cartInfo" :key="index"
+				@click="jumpCon(item.id)">
+				<view class="item acea-row row-between-wrapper">
+					<view class='pictrue' :class="{gray:!item.isSale}">
+						<image :src='item.goodsCover'></image>
+					</view>
+					<view class='text'>
+						<view class='acea-row row-between-wrapper'>
+							<view class='name line1'>{{item.goodsName}}</view>
+							<view class='num'>x {{item.totalSales}}</view>
+						</view>
+						<view class='attr line1' v-if="item.salePrice">{{item.unit}}
+						</view>
+						<view class='money font-color pic' v-if="item.salePrice">
+							<text :class="{gray:!item.isSale}">
+								{{$t(`¥`)}}{{item.salePrice}}
+							</text>
+						</view>
+					</view>
+				</view>
+				<!-- <view class="botton-btn">
+					<view class='logistics' v-if="item.is_reply==0 && evaluate==3 && pid != -1 && isShow"
+						@click.stop="evaluateTap(item.unique,orderId)">
+						{{$t(`评价`)}}</view>
+					<view class='logistics'
+						v-if="paid === 1 && refund_status === 0 && item.refund_num !=item.cart_num && !is_confirm && isShow"
+						@click.stop="openSubcribe(item)">
+						{{$t(`申请退款`)}}</view>
+					<view class="rig-btn" v-if="status_type === 2 && index === cartInfo.length - 1 || !split">
+						<view v-if="delivery_type === 'express'" class="logistics" @click.stop="logistics(orderId)">{{$t(`查看物流`)}}
+						</view>
+						<view class="logistics sure" v-if="status_type === 2" @click.stop="confirmOrder(orderId)">{{$t(`确认收货`)}}
+						</view>
+					</view>
+				</view> -->
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			// 订单状态
+			statusType: {
+				type: Number,
+				default: 0,
+			},
+			evaluate: {
+				type: Number,
+				default: 0,
+			},
+			oid: {
+				type: Number,
+				default: 0,
+			},
+			// 1已支付 0未支付
+			paid: {
+				type: Number,
+				default: 0,
+			},
+			cartInfo: {
+				type: Array,
+				default: function() {
+					return [];
+				}
+			},
+			orderId: {
+				type: String,
+				default: '',
+			},
+			shipping_type: {
+				type: Number,
+				default: -1,
+			},
+			delivery_type: {
+				type: String,
+				default: '',
+			},
+			pay_price: {
+				type: String,
+				default: '',
+			},
+			jump: {
+				type: Boolean,
+				default: false,
+			},
+			is_confirm: {
+				type: Boolean,
+				default: false,
+			},
+			// is_behalf 是否是代付列表
+			is_behalf: {
+				type: Boolean,
+				default: false,
+			},
+			split: {
+				type: Boolean,
+				default: false,
+			},
+			jumpDetail: {
+				type: Boolean,
+				default: false,
+			},
+			index: {
+				type: Number,
+				default: 0,
+			},
+			pid: {
+				type: Number,
+				default: 0,
+			},
+			refund_status: {
+				type: Number,
+				default: 0,
+			},
+			status_type: {
+				type: Number,
+				default: 0,
+			},
+			isShow: {
+				type: Boolean,
+				default: true,
+			},
+		},
+		data() {
+			return {
+				totalNmu: 0,
+				operationModel: false,
+				status: "",
+			};
+		},
+		watch: {
+			cartInfo: function(nVal, oVal) {
+				let num = 0
+				nVal.forEach((item, index) => {
+					num += item.totalSales - 0
+				})
+				this.totalNmu = num
+			}
+		},
+		mounted() {
+			let num = 0
+			this.$nextTick(() => {
+				this.cartInfo.forEach((item, index) => {
+					num += item.cart_num
+				})
+				console.log(num)
+				this.$set(this, 'totalNmu', num)
+			})
+
+		},
+		methods: {
+			evaluateTap: function(unique, orderId) {
+				uni.navigateTo({
+					url: "/pages/goods/goods_comment_con/index?unique=" + unique + "&uni=" + orderId
+				})
+			},
+			jumpCon(id) {
+				if (this.jump) {
+					uni.navigateTo({
+						url: `/pages/goods_details/index?id=${id}`
+					})
+				} else if (this.jumpDetail) {
+					uni.navigateTo({
+						url: `/pages/goods/order_details/index?order_id=${this.orderId}`
+					})
+				}
+			},
+			logistics(order_id) {
+				uni.navigateTo({
+					url: '/pages/goods/goods_logistics/index?orderId=' + order_id
+				})
+			},
+			confirmOrder(orderId) {
+				this.$emit('confirmOrder', orderId)
+			},
+			changeOperation() {
+				this.operationModel = !this.operationModel
+			},
+			openSubcribe(item) {
+				let cartList = [];
+				cartList.push({
+					cart_id: item.id,
+					cart_num: item.surplus_refund_num
+				})
+				let obj = JSON.stringify(cartList);
+				this.$emit('openSubcribe',
+					`/pages/goods/goods_return/index?orderId=${this.orderId}&id=${this.oid}&cartIds=${obj}`)
+			},
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.fontcolor {
+		color: #e93323;
+	}
+
+	.orderGoods {
+		background-color: #fff;
+	}
+
+	.orderGoods .total {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		width: 100%;
+		// height: 86rpx;
+		padding: 0 30rpx;
+		border-bottom: 2rpx solid #f0f0f0;
+		font-size: 30rpx;
+		color: #282828;
+		line-height: 86rpx;
+		box-sizing: border-box;
+
+
+	}
+
+	.botton-btn {
+		display: flex;
+		align-items: right;
+		justify-content: flex-end;
+		padding: 0rpx 20rpx 20rpx 20rpx;
+	}
+
+	.rig-btn {
+		display: flex;
+		align-items: center;
+
+		.refund {
+			font-size: 26rpx;
+			color: #e93323;
+		}
+
+		.done {
+			font-size: 26rpx;
+			color: #F19D2F;
+		}
+	}
+
+	.logistics {
+		// height: 46rpx;
+		line-height: 30rpx;
+		color: #666666;
+		font-size: 20rpx;
+		border: 1px solid #CCCCCC;
+		border-radius: 30rpx;
+		padding: 8rpx 22rpx;
+		margin-left: 10rpx;
+	}
+
+	.sure {
+		color: #e93323;
+		border: 1px solid #e93323;
+	}
+
+	.more-operation {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding: 10rpx 0;
+		color: #bbb;
+	}
+
+	.b-top {
+		margin-left: 30rpx;
+		margin-right: 30rpx;
+		border-top: 1px solid #f0f0f0
+	}
+
+	.fade-enter-active,
+	.fade-leave-active {
+		transition: all 0.1s;
+	}
+
+	.fade-enter,
+	.fade-leave-to
+
+	/* .fade-leave-active below version 2.1.8 */
+		{
+		opacity: 0;
+		transform: translateY(-10px);
+	}
+
+	.op {
+		opacity: 0.5;
+		
+	}
+	
+	.gray {
+		filter: grayscale(100%);
+		filter: gray;
+	}
+
+	.pic {
+		display: flex;
+		justify-content: space-between;
+	}
+
+	.valid {
+		margin-left: 20rpx;
+		font-size: 24rpx;
+	}
+
+	.pay-price {
+		color: #E93323;
+	}
+
+	.refund {
+		text-align: right;
+		font-size: 26rpx;
+		color: var(--view-theme);
+	}
+</style>

+ 8 - 12
components/productWindow/index.vue

@@ -43,27 +43,27 @@
 					<view class="title">{{ $t(`数量`) }}</view>
 					<view class="carnum acea-row row-left">
 						<view class="item reduce acea-row row-center-wrapper"
-							:class="attr.productSelect.cart_num <= 1 ? 'on' : ''"
-							v-if="attr.productSelect.cart_num <= 1">
+							:class="attr.productSelect.totalSales <= 1 ? 'on' : ''"
+							v-if="attr.productSelect.totalSales <= 1">
 							<text class="iconfont icon-shangpinshuliang-jian"></text>
 						</view>
 						<view class="item reduce acea-row row-center-wrapper"
-							:class="attr.productSelect.cart_num <= 1 ? 'on' : ''" @click="CartNumDes" v-else>
+							:class="attr.productSelect.totalSales <= 1 ? 'on' : ''" @click="CartNumDes" v-else>
 							<text class="iconfont icon-shangpinshuliang-jian"></text>
 						</view>
 						<view class='item num acea-row row-middle'>
-							<input type="number" v-model="new_cart_num"
-								data-name="productSelect.cart_num" @input="bindCode(attr.productSelect.cart_num)" />
+							<input type="number" v-model="attr.productSelect.totalSales"
+								data-name="productSelect.totalSales" @input="bindCode(attr.productSelect.totalSales)" />
 						</view>
 						<view v-if="iSplus" class="item plus acea-row row-center-wrapper" :class="
-							attr.productSelect.cart_num >= attr.productSelect.totalStock
+							attr.productSelect.totalSales >= attr.productSelect.totalStock
 								? 'on'
 								: ''
 						" @click="CartNumAdd">
 							<text class="iconfont icon-shangpinshuliang-jia"></text>
 						</view>
 						<view v-else class='item plus'
-							:class='attr.productSelect.cart_num >= attr.productSelect.totalStock ? "on" : ""'
+							:class='attr.productSelect.totalSales >= attr.productSelect.totalStock ? "on" : ""'
 							@click='CartNumAdd'>+</view>
 					</view>
 				</view>
@@ -148,7 +148,6 @@ export default {
 		 * 
 		 */
 		bindCode: function (e) {
-			console.log(this.attr.productSelect.cart_num);
 			if (e > this.attr.productSelect.totalStock){
 				this.$util.Tips({
 					title: this.$t(`数量大于库存,请重新输入`),
@@ -156,20 +155,17 @@ export default {
 
 					},
 				});
-				this.new_cart_num = this.attr.productSelect.cart_num
 			}else{
-				this.$emit('iptCartNum', this.attr.productSelect.cart_num - this.new_cart_num);
+				this.$emit('iptCartNum', e);
 			}
 		},
 		closeAttr: function () {
 			this.$emit('myevent');
 		},
 		CartNumDes: function () {
-			new_cart_num --
 			this.$emit('ChangeCartNum', false);
 		},
 		CartNumAdd: function () {
-			new_cart_num ++
 			this.$emit('ChangeCartNum', true);
 		},
 		tapAttr: function (item, indexn) {

+ 206 - 147
pages/goods/order_confirm/index.vue

@@ -11,13 +11,15 @@
 						v-if='store_self_mention && is_shipping'></view>
 				</view>
 				<view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType == 0'>
-					<view class='addressCon' v-if="addressInfo.real_name">
-						<view class='name'>{{addressInfo.real_name}}
+					<view class='addressCon' v-if="addressInfo.realName">
+						<view class='name'>{{addressInfo.realName}}
 							<text class='phone'>{{addressInfo.phone}}</text>
 						</view>
 						<view class="line1">
 							<text class='default font-num'
-								v-if="addressInfo.is_default">[{{$t(`默认`)}}]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.detail}}
+								v-if="addressInfo.defaultState == 2">[{{$t(`默认`)}}]
+							</text>{{addressInfo.province}}{{addressInfo.city}}
+							{{addressInfo.district}}{{addressInfo.detail}}
 						</view>
 						<!-- <view class='setaddress'>设置收货地址</view> -->
 					</view>
@@ -46,24 +48,28 @@
 			</view>
 			<orderGoods :cartInfo="cartInfo" :is_confirm='true' :shipping_type="shippingType"></orderGoods>
 			<view class='wrapper'>
-				<view class='item acea-row row-between-wrapper' @tap='couponTap'
+				<!-- <view class='item acea-row row-between-wrapper' @tap='couponTap'
 					v-if="!pinkId && !BargainId && !combinationId && !seckillId&& !noCoupon && !discountId && !advanceId">
 					<view>{{$t(`优惠券`)}}</view>
 					<view class='discount'>
 						{{couponTitle}}
 						<text class='iconfont icon-jiantou'></text>
 					</view>
+				</view> -->
+				<view class='item acea-row row-between-wrapper'>
+					<view>{{$t(`运费`)}}</view>
+					<view class='discount acea-row row-middle'>
+						<view>
+							<text class='num font-color'>{{freight || 0}}元</text>
+						</view>
+					</view>
 				</view>
-				<view class='item acea-row row-between-wrapper'
-					v-if="!pinkId && !BargainId && !combinationId && !seckillId && !advanceId">
-					<view>{{$t(`积分抵扣`)}}</view>
+				<view class='item acea-row row-between-wrapper'>
+					<view>{{$t(`赠送积分`)}}</view>
 					<view class='discount acea-row row-middle'>
-						<view> {{useIntegral ? $t(`剩余积分`):$t(`当前积分`)}}
-							<text class='num font-color'>{{integral || 0}}</text>
+						<view>
+							<text class='num font-color'>{{integral || 0}}红积分</text>
 						</view>
-						<checkbox-group @change="ChangeIntegral">
-							<checkbox :disabled="integral<=0 && !useIntegral" :checked='useIntegral ? true : false' />
-						</checkbox-group>
 					</view>
 				</view>
 				<view v-if="invoice_func || special_invoice" class='item acea-row row-between-wrapper' @tap="goInvoice">
@@ -169,12 +175,12 @@
 				</view>
 			</view>
 			<view class='moneyList'>
-				<view class='item acea-row row-between-wrapper'>
+				<!-- <view class='item acea-row row-between-wrapper'>
 					<view>{{$t(`商品总价`)}}:</view>
 					<view class='money'>
 						{{$t(`¥`)}}{{(parseFloat(priceGroup.totalPrice)+parseFloat(priceGroup.vipPrice)).toFixed(2)}}
 					</view>
-				</view>
+				</view> -->
 				<view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
 					<view>{{$t(`配送运费`)}}:</view>
 					<view class='money'>
@@ -205,7 +211,7 @@
 					<text class='font-color'>{{$t(`¥`)}}{{totalPrice || 0}}</text>
 				</view>
 				<view class='settlement' style='z-index:100' @tap.stop="goPay"
-					v-if="(valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id)">{{$t(`立即支付`)}}
+					v-if="totalPrice > 0">{{$t(`立即支付`)}}
 				</view>
 				<view class='settlement bg-color-hui' style='z-index:100' v-else>{{$t(`立即支付`)}}</view>
 			</view>
@@ -218,7 +224,7 @@
 		<!-- #ifdef MP -->
 		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
 		<!-- #endif -->
-		<home v-show="!invShow"></home>
+		<!-- <home v-show="!invShow"></home> -->
 		<invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
 			:url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
 		</invoice-picker>
@@ -230,6 +236,9 @@
 	</view>
 </template>
 <script>
+	import {
+		getGoodsDetail, getUserAddressByUserId, postBeforeCheck,getUserAddressByIdAndFreight
+	} from "@/api/home.js";
 	import {
 		orderConfirm,
 		getCouponsOrderPrice,
@@ -255,7 +264,7 @@
 	} from '@/config/cache.js';
 	import couponListWindow from '@/components/couponListWindow';
 	import addressWindow from '@/components/addressWindow';
-	import orderGoods from '@/components/orderGoods';
+	import orderGoods from '@/components/orderGoods/index_mall';
 	import home from '@/components/home';
 	import invoicePicker from '../components/invoicePicker/index.vue';
 	import {
@@ -306,33 +315,33 @@
 						title: this.$t(`使用微信快捷支付`),
 						payStatus: 1,
 					},
-					{
-						"name": this.$t(`支付宝支付`),
-						"icon": "icon-zhifubao",
-						value: 'alipay',
-						title: this.$t(`使用支付宝支付`),
-						payStatus: 1,
-					},
-					{
-						"name": this.$t(`余额支付`),
-						"icon": "icon-yuezhifu",
-						value: 'yue',
-						title: this.$t(`可用余额`),
-						payStatus: 1,
-					},
-					{
-						"name": this.$t(`线下支付`),
-						"icon": "icon-yuezhifu1",
-						value: 'offline',
-						title: this.$t(`使用线下付款`),
-						payStatus: 2,
-					}, {
-						"name": this.$t(`好友代付`),
-						"icon": "icon-haoyoudaizhifu",
-						value: 'friend',
-						title: this.$t(`找微信好友支付`),
-						payStatus: 1,
-					}
+					// {
+					// 	"name": this.$t(`支付宝支付`),
+					// 	"icon": "icon-zhifubao",
+					// 	value: 'alipay',
+					// 	title: this.$t(`使用支付宝支付`),
+					// 	payStatus: 1,
+					// },
+					// {
+					// 	"name": this.$t(`余额支付`),
+					// 	"icon": "icon-yuezhifu",
+					// 	value: 'yue',
+					// 	title: this.$t(`可用余额`),
+					// 	payStatus: 1,
+					// },
+					// {
+					// 	"name": this.$t(`线下支付`),
+					// 	"icon": "icon-yuezhifu1",
+					// 	value: 'offline',
+					// 	title: this.$t(`使用线下付款`),
+					// 	payStatus: 2,
+					// }, {
+					// 	"name": this.$t(`好友代付`),
+					// 	"icon": "icon-haoyoudaizhifu",
+					// 	value: 'friend',
+					// 	title: this.$t(`找微信好友支付`),
+					// 	payStatus: 1,
+					// }
 				],
 				virtual_type: 0,
 				formContent: '',
@@ -391,7 +400,7 @@
 				isShowAuth: false, //是否隐藏授权
 				from: '',
 				news: 1,
-
+				num: 0,
 				// invTitle: '不开发票',
 				invTitle: this.$t(`不开发票`),
 				special_invoice: false,
@@ -408,6 +417,8 @@
 				is_shipping: true,
 				inputTrip: false,
 				focus: true,
+				goodsSpecId: 0,
+				freight: 0
 			};
 		},
 		computed: mapGetters(['isLogin']),
@@ -429,17 +440,19 @@
 			// #ifdef APP-PLUS
 			this.from = 'app'
 			// #endif
-			if (!options.cartId) return this.$util.Tips({
+			if (!options.productId) return this.$util.Tips({
 				title: this.$t(`请选择要购买的商品`)
 			}, {
 				tab: 3,
 				url: 1
 			});
+			this.num = options.num || 0;
+			this.goodsSpecId = options.goodsSpecId || 0;
 			this.couponId = options.couponId || 0;
 			this.noCoupon = Number(options.noCoupon) || 0;
 			this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
 			this.addressId = options.addressId || 0;
-			this.cartId = options.cartId;
+			this.cartId = options.productId;
 			this.is_address = options.is_address ? true : false;
 			this.news = !options.new || options.new === '0' ? 0 : 1;
 			this.invChecked = options.invoice_id || '';
@@ -484,37 +497,39 @@
 		methods: {
 			checkShipping() {
 				let that = this;
-				checkShipping(that.cartId, that.news).then(res => {
-					if (res.data.type == 0) {
-						that.is_shipping = true;
-						that.shippingType = 0;
-						this.getaddressInfo();
-						this.getConfirm();
-						this.$nextTick(function() {
-							this.$refs.addressWindow.getAddressList();
-						})
-					} else {
-						if (res.data.type == 1) {
-							that.is_shipping = false;
-							that.shippingType = 0;
-							this.getaddressInfo();
-							this.getConfirm();
-							this.$nextTick(function() {
-								this.$refs.addressWindow.getAddressList();
-							})
-						} else if (res.data.type == 2) {
-							that.is_shipping = false;
-							that.shippingType = 1;
-							this.getConfirm();
-							this.getList();
-						}
-					}
-				}).catch(err => {
-					uni.showToast({
-						title: err,
-						icon: 'none'
-					});
-				});
+				this.getConfirm();
+				this.getaddressInfo();
+				// checkShipping(that.cartId, that.news).then(res => {
+				// 	if (res.data.type == 0) {
+				// 		that.is_shipping = true;
+				// 		that.shippingType = 0;
+				// 		this.getaddressInfo();
+				// 		this.getConfirm();
+				// 		this.$nextTick(function() {
+				// 			this.$refs.addressWindow.getAddressList();
+				// 		})
+				// 	} else {
+				// 		if (res.data.type == 1) {
+				// 			that.is_shipping = false;
+				// 			that.shippingType = 0;
+				// 			this.getaddressInfo();
+				// 			this.getConfirm();
+				// 			this.$nextTick(function() {
+				// 				this.$refs.addressWindow.getAddressList();
+				// 			})
+				// 		} else if (res.data.type == 2) {
+				// 			that.is_shipping = false;
+				// 			that.shippingType = 1;
+				// 			this.getConfirm();
+				// 			this.getList();
+				// 		}
+				// 	}
+				// }).catch(err => {
+				// 	uni.showToast({
+				// 		title: err,
+				// 		icon: 'none'
+				// 	});
+				// });
 			},
 			// 不开发票
 			invCancel() {
@@ -641,24 +656,46 @@
 				this.computedPrice()
 			},
 			computedPrice: function() {
-				let shippingType = this.shippingType;
-				postOrderComputed(this.orderKey, {
-					addressId: this.addressId,
-					useIntegral: this.useIntegral ? 1 : 0,
-					couponId: this.couponId,
-					shipping_type: parseInt(shippingType) + 1,
-					payType: this.payType
-				}).then(res => {
-					let result = res.data.result;
-					if (result) {
-						this.totalPrice = result.pay_price;
-						this.integral_price = result.deduction_price;
-						this.coupon_price = result.coupon_price;
-						this.integral = this.useIntegral ? result.SurplusIntegral : this.usable_integral;
-						this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
-						this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
+				let that = this
+				postBeforeCheck({
+					goodsSpecId: this.goodsSpecId,
+					num: this.num,
+					userAddressId: this.addressId
+				}).then(function (res) {
+					//验证是否可下单
+					if (res.code == 200) {
+						that.freight = res.data.freight - 0
+						that.totalPrice = res.data.freight - 0
+						that.cartInfo.forEach(e =>{
+							that.totalPrice += e.salePrice - 0 
+						})
+					} else {
+						this.totalPrice = 0
+						that.$util.Tips({
+							title: that.$t(`所选商品属性不支持下单`),
+							success: () => {
+								// that.getCartCount(true);
+							},
+						});
 					}
 				})
+				// postOrderComputed(this.orderKey, {
+				// 	addressId: this.addressId,
+				// 	useIntegral: this.useIntegral ? 1 : 0,
+				// 	couponId: this.couponId,
+				// 	shipping_type: parseInt(shippingType) + 1,
+				// 	payType: this.payType
+				// }).then(res => {
+				// 	let result = res.data.result;
+				// 	if (result) {
+				// 		this.totalPrice = result.pay_price;
+				// 		this.integral_price = result.deduction_price;
+				// 		this.coupon_price = result.coupon_price;
+				// 		this.integral = this.useIntegral ? result.SurplusIntegral : this.usable_integral;
+				// 		this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
+				// 		this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
+				// 	}
+				// })
 			},
 			addressType(e) {
 				let index = e;
@@ -781,64 +818,86 @@
 					title: that.$t(`正在加载中`),
 					mask: true
 				});
-				orderConfirm(that.cartId, that.news, that.addressId, that.shippingType + 1).then(res => {
-					that.$set(that, 'userInfo', res.data.userInfo);
-					that.$set(that, 'confirm', res.data.custom_form || []);
-					this.confirm.map(e => {
-						if (e.label === 'img') e.value = []
-					})
-					that.$set(that, 'integral', res.data.usable_integral);
-					that.$set(that, 'usable_integral', res.data.usable_integral);
-					that.$set(that, 'contacts', res.data.userInfo.real_name);
-					that.$set(that, 'contactsTel', res.data.userInfo.record_phone === '0' ? '' : res.data
-						.userInfo.record_phone);
-					that.$set(that, 'cartInfo', res.data.cartInfo);
-					that.$set(that, 'integralRatio', res.data.integralRatio);
-					that.$set(that, 'offlinePostage', res.data.offlinePostage);
-					that.$set(that, 'orderKey', res.data.orderKey);
-					that.$set(that, 'valid_count', res.data.valid_count);
-					that.$set(that, 'discount_id', res.data.discount_id)
-					that.$set(that, 'priceGroup', res.data.priceGroup);
-					that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
-						parseFloat(res.data
-							.priceGroup.storePostage)));
-					that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
-					that.$set(that, 'invoice_func', res.data.invoice_func);
-					that.$set(that, 'special_invoice', res.data.special_invoice);
-					that.$set(that, 'store_self_mention', res.data.store_self_mention);
-					that.$set(that, 'virtual_type', res.data.virtual_type || 0);
-					//微信支付是否开启
-					that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
-					//支付宝是否开启
-					that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
-					//#ifdef MP
-					that.cartArr[1].payStatus = 0;
-					//#endif
-					//余额支付是否开启
-					// that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
-					that.cartArr[2].number = res.data.userInfo.now_money;
-					that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
-					if (res.data.offline_pay_status == 2 || res.data.deduction) {
-						that.cartArr[3].payStatus = 0
-					} else {
-						that.cartArr[3].payStatus = 1
-					}
-					//好友代付是否开启
-					that.cartArr[4].payStatus = res.data.friend_pay_status || 0;
-					// that.$set(that, 'cartArr', that.cartArr);
-					that.$set(that, 'ChangePrice', that.totalPrice);
-					that.getBargainId();
-					that.getCouponList();
-					if (this.addressId) {
-						this.computedPrice();
-					}
+				getGoodsDetail({ id: that.cartId })
+				.then((res) => {
+					this.cartInfo = []
+					let porject = res.data
+					//找出选择的规格
+					porject.goodsSpecList.forEach(element => {
+						if (that.goodsSpecId == element.id){
+							porject.unit = element.spceName
+						}
+					});
+					porject.totalSales = this.num
+					// 计算总价
+					this.totalPrice = (this.num - 0) * (porject.salePrice - 0) + this.freight
+					this.cartInfo.push(porject)
 					uni.hideLoading()
-				}).catch(err => {
+				})
+				.catch((err) => {
 					uni.hideLoading()
 					return this.$util.Tips({
 						title: err
 					});
 				});
+				// orderConfirm(that.cartId, that.news, that.addressId, that.shippingType + 1).then(res => {
+				// 	that.$set(that, 'userInfo', res.data.userInfo);
+				// 	that.$set(that, 'confirm', res.data.custom_form || []);
+				// 	this.confirm.map(e => {
+				// 		if (e.label === 'img') e.value = []
+				// 	})
+				// 	that.$set(that, 'integral', res.data.usable_integral);
+				// 	that.$set(that, 'usable_integral', res.data.usable_integral);
+				// 	that.$set(that, 'contacts', res.data.userInfo.real_name);
+				// 	that.$set(that, 'contactsTel', res.data.userInfo.record_phone === '0' ? '' : res.data
+				// 		.userInfo.record_phone);
+				// 	that.$set(that, 'cartInfo', res.data.cartInfo);
+				// 	that.$set(that, 'integralRatio', res.data.integralRatio);
+				// 	that.$set(that, 'offlinePostage', res.data.offlinePostage);
+				// 	that.$set(that, 'orderKey', res.data.orderKey);
+				// 	that.$set(that, 'valid_count', res.data.valid_count);
+				// 	that.$set(that, 'discount_id', res.data.discount_id)
+				// 	that.$set(that, 'priceGroup', res.data.priceGroup);
+				// 	that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
+				// 		parseFloat(res.data
+				// 			.priceGroup.storePostage)));
+				// 	that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
+				// 	that.$set(that, 'invoice_func', res.data.invoice_func);
+				// 	that.$set(that, 'special_invoice', res.data.special_invoice);
+				// 	that.$set(that, 'store_self_mention', res.data.store_self_mention);
+				// 	that.$set(that, 'virtual_type', res.data.virtual_type || 0);
+				// 	//微信支付是否开启
+				// 	that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
+				// 	//支付宝是否开启
+				// 	that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
+				// 	//#ifdef MP
+				// 	that.cartArr[1].payStatus = 0;
+				// 	//#endif
+				// 	//余额支付是否开启
+				// 	// that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
+				// 	that.cartArr[2].number = res.data.userInfo.now_money;
+				// 	that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
+				// 	if (res.data.offline_pay_status == 2 || res.data.deduction) {
+				// 		that.cartArr[3].payStatus = 0
+				// 	} else {
+				// 		that.cartArr[3].payStatus = 1
+				// 	}
+				// 	//好友代付是否开启
+				// 	that.cartArr[4].payStatus = res.data.friend_pay_status || 0;
+				// 	// that.$set(that, 'cartArr', that.cartArr);
+				// 	that.$set(that, 'ChangePrice', that.totalPrice);
+				// 	that.getBargainId();
+				// 	that.getCouponList();
+				// 	if (this.addressId) {
+				// 		this.computedPrice();
+				// 	}
+				// 	uni.hideLoading()
+				// }).catch(err => {
+				// 	uni.hideLoading()
+				// 	return this.$util.Tips({
+				// 		title: err
+				// 	});
+				// });
 			},
 			/*
 			 * 提取砍价和拼团id
@@ -886,7 +945,7 @@
 			getaddressInfo: function() {
 				let that = this;
 				if (that.addressId) {
-					getAddressDetail(that.addressId).then(res => {
+					getUserAddressByIdAndFreight({id:that.addressId}).then(res => {
 						res.data.is_default = parseInt(res.data.is_default);
 						that.addressInfo = res.data || {};
 						that.addressId = res.data.id || 0;

+ 111 - 63
pages/goods/order_list/index.vue

@@ -43,29 +43,21 @@
 					<view @click="goOrderDetails(item.id)">
 						<view class="title acea-row row-between-wrapper">
 							<view class="acea-row row-middle">
-								<text class="sign cart-color acea-row row-center-wrapper"
-									v-if="item.type == 2">{{ $t(`砍价`) }}</text>
-								<text class="sign cart-color acea-row row-center-wrapper"
-									v-else-if="item.type == 3">{{ $t(`拼团`) }}</text>
-								<text class="sign cart-color acea-row row-center-wrapper"
-									v-else-if="item.type == 1">{{ $t(`秒杀`) }}</text>
-								<text class="sign cart-color acea-row row-center-wrapper"
-									v-else-if="item.type == 4">{{ $t(`预售`) }}</text>
+								<text class="sign cart-color acea-row row-center-wrapper" v-if="item.type == 2">{{
+										$t(`砍价`)
+								}}</text>
+								<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.type == 3">{{
+										$t(`拼团`)
+								}}</text>
+								<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.type == 1">{{
+										$t(`秒杀`)
+								}}</text>
+								<text class="sign cart-color acea-row row-center-wrapper" v-else-if="item.type == 4">{{
+										$t(`预售`)
+								}}</text>
 								<view>{{ item.createTime }}</view>
 							</view>
-							<view v-if="item.payFlag == 9" class="font-color">{{ $t(`线下付款,未支付`) }}</view>
-							<view v-else-if="item.payFlag == 1" class="font-color">{{ $t(`待付款`) }}</view>
-							<view v-else-if="item.payFlag == 2" class="font-color">{{ $t(`待发货`) }}
-								<!-- <text v-if="item.refund.length">,{{item.is_all_refund?$t(`退款中`):$t(`部分退款中`)}}</text> -->
-							</view>
-							<view v-else-if="item.payFlag == 3" class="font-color">{{ $t(`待收货`) }}
-								<!-- <text v-if="item.refund.length">,{{item.is_all_refund?$t(`退款中`):$t(`部分退款中`)}}</text> -->
-							</view>
-							<view v-else-if="item.payFlag == 4" class="font-color">{{ $t(`已完成`) }}
-								<!-- <text v-if="item.refund.length">,{{item.is_all_refund?$t(`退款中`):$t(`部分退款中`)}}</text> -->
-							</view>
-							<view v-else-if="item.payFlag == -2" class="font-color">{{ $t(`已退款`) }}
-							</view>
+							<view class="font-color">{{ item.payFlagDisplayName }}</view>
 						</view>
 						<view class="item-info acea-row row-between row-top" v-for="(items, index) in item.orderGoods"
 							:key="index">
@@ -94,7 +86,7 @@
 						<view class="bnt cancelBnt" v-if="item.payFlag == 1 || item.payFlag == 9"
 							@click="cancelOrder(index, item.id)">{{ $t(`取消订单`) }}</view>
 						<view class="bnt cancelBnt" v-if="item.payFlag == 2 || item.payFlag == 3"
-							@click="cancelOrder(index, item.id)">{{ $t(`申请退款`) }}</view>
+							@click="refundOrder(index, item.id)">{{ $t(`申请退款`) }}</view>
 						<view class="bnt bg-color" v-if="item.payFlag == 1" @click="goPay(item.totalFee, item.id)">
 							{{ $t(`立即支付`) }}</view>
 						<!-- <view class="bnt bg-color" v-else-if="item.payFlag == 3"
@@ -104,7 +96,7 @@
 							@click="goOrderDetails(item.order_id)">
 							再次购买
 						</view> -->
-						<view class="bnt cancelBnt" v-if="item.payFlag == 4" @click="delOrder(item.order_id, index)">
+						<view class="bnt cancelBnt" v-if="item.payFlag == 5" @click="delOrder(item.order_id, index)">
 							{{ $t(`删除订单`) }}</view>
 						<!-- <view class="bnt bg-color" @click="goOrderDetails(item.order_id)">{{$t(`查看详情`)}}</view> -->
 					</view>
@@ -131,7 +123,9 @@
 
 <script>
 import {
-	getUserOrderPage
+	getUserOrderPage,
+	postUserOrderCancel,
+	postUserOrderRefund
 } from '@/api/home.js';
 import {
 	getOrderList,
@@ -186,27 +180,27 @@ export default {
 				title: this.$t(`使用微信快捷支付`),
 				payStatus: true
 			},
-			// {
-			// 	name: this.$t(`支付宝支付`),
-			// 	icon: 'icon-zhifubao',
-			// 	value: 'alipay',
-			// 	title: this.$t(`使用支付宝支付`),
-			// 	payStatus: true
-			// },
-			// {
-			// 	name: this.$t(`余额支付`),
-			// 	icon: 'icon-yuezhifu',
-			// 	value: 'yue',
-			// 	title: this.$t(`可用余额`),
-			// 	number: 0,
-			// 	payStatus: true
-			// }, {
-			// 	"name": this.$t(`好友代付`),
-			// 	"icon": "icon-haoyoudaizhifu",
-			// 	value: 'friend',
-			// 	title: this.$t(`找微信好友支付`),
-			// 	payStatus: 1,
-			// }
+				// {
+				// 	name: this.$t(`支付宝支付`),
+				// 	icon: 'icon-zhifubao',
+				// 	value: 'alipay',
+				// 	title: this.$t(`使用支付宝支付`),
+				// 	payStatus: true
+				// },
+				// {
+				// 	name: this.$t(`余额支付`),
+				// 	icon: 'icon-yuezhifu',
+				// 	value: 'yue',
+				// 	title: this.$t(`可用余额`),
+				// 	number: 0,
+				// 	payStatus: true
+				// }, {
+				// 	"name": this.$t(`好友代付`),
+				// 	"icon": "icon-haoyoudaizhifu",
+				// 	value: 'friend',
+				// 	title: this.$t(`找微信好友支付`),
+				// 	payStatus: 1,
+				// }
 			],
 			pay_close: false,
 			pay_order_id: '',
@@ -307,25 +301,79 @@ export default {
 				return that.$util.Tips({
 					title: that.$t(`缺少订单号无法取消订单`)
 				});
-			orderCancel(order_id)
-				.then(res => {
-					return that.$util.Tips({
-						title: res.msg,
-						icon: 'success'
-					},
-						function () {
-							that.orderList.splice(index, 1);
-							that.$set(that, 'orderList', that.orderList);
-							that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
-							that.getOrderData();
-						}
-					);
-				})
-				.catch(err => {
-					return that.$util.Tips({
-						title: err
-					});
+			uni.showModal({
+				title: that.$t(`删除订单`),
+				content: that.$t(`确定删除该订单`),
+				success: function (res) {
+					if (res.confirm) {
+						postUserOrderCancel({ id: order_id })
+							.then(res => {
+								return that.$util.Tips({
+									title: res.msg,
+									icon: 'success'
+								},
+									function () {
+										// that.orderList.splice(index, 1);
+										// that.$set(that, 'orderList', that.orderList);
+										// that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
+										// that.getOrderData();
+										this.getOrderList()
+									}
+								);
+							})
+							.catch(err => {
+								return that.$util.Tips({
+									title: err
+								});
+							});
+					} else if (res.cancel) {
+						return that.$util.Tips({
+							title: that.$t(`已取消`)
+						});
+					}
+				}
+			});
+
+		},
+		refundOrder: function (index, order_id) {
+			let that = this;
+			if (!order_id)
+				return that.$util.Tips({
+					title: that.$t(`缺少订单号无法申请退款订单`)
 				});
+			uni.showModal({
+				title: that.$t(`删除订单`),
+				content: that.$t(`确定删除该订单`),
+				success: function (res) {
+					if (res.confirm) {
+						postUserOrderRefund({ id: order_id })
+							.then(res => {
+								return that.$util.Tips({
+									title: res.msg,
+									icon: 'success'
+								},
+									function () {
+										// that.orderList.splice(index, 1);
+										// that.$set(that, 'orderList', that.orderList);
+										// that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
+										// that.getOrderData();
+										this.getOrderList()
+									}
+								);
+							})
+							.catch(err => {
+								return that.$util.Tips({
+									title: err
+								});
+							});
+					} else if (res.cancel) {
+						return that.$util.Tips({
+							title: that.$t(`已取消`)
+						});
+					}
+				}
+			});
+
 		},
 		/**
 		 * 打开支付组件

+ 63 - 67
pages/goods_details/index.vue

@@ -106,7 +106,8 @@
 								<view style="display: flex; align-items: center; width: 90%">
 									<view class="attr-txt"> 送至: </view>
 									<view class="atterTxt line1" style="width: 82%">{{
-											attrAddrValue.province + attrAddrValue.city + attrAddrValue.district + attrAddrValue.detail
+											attrAddrValue.province + attrAddrValue.city + attrAddrValue.district +
+											attrAddrValue.detail
 									}}</view>
 								</view>
 								<u-icon name="more-dot-fill"></u-icon>
@@ -197,13 +198,13 @@
 							</form>
 						</view>
 						<view class="bnt acea-row skeleton-rect" v-else>
-							<form v-if="storeInfo.cart_button" @submit="joinCart" class="joinCart bnts">
+							<form @submit="joinCart" class="joinCart bnts">
 								<button class="joinCart bnts" form-type="submit">
 									{{ $t(`加入购物车`) }}
 								</button>
 							</form>
-							<form @submit="goBuy" class="buy bnts" :class="!storeInfo.cart_button ? 'virbnt' : ''">
-								<button class="buy bnts" :class="!storeInfo.cart_button ? 'virbnt' : ''"
+							<form @submit="goBuy" class="buy bnts" :class="storeInfo.cart_button ? 'virbnt' : ''">
+								<button class="buy bnts" :class="storeInfo.cart_button ? 'virbnt' : ''"
 									form-type="submit">
 									{{ $t(`立即购买`) }}
 								</button>
@@ -218,7 +219,7 @@
 							</form>
 						</view>
 						<view class="acea-row"
-							v-else-if="attr.productSelect.quota <= 0 || attr.productSelect.quota < attr.productSelect.cart_num">
+							v-else-if="attr.productSelect.quota <= 0 || attr.productSelect.quota < attr.productSelect.totalSales">
 							<form class=" bnts bg-color-hui"><button class=" bnts bg-color-hui" form-type="submit">{{
 									$t(`已售罄`)
 							}}</button></form>
@@ -325,7 +326,7 @@
 <script>
 let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
 import {
-	getGoodsDetail, getUserAddressByUserId
+	getGoodsDetail, getUserAddressByUserId, postBeforeCheck
 } from "@/api/home.js";
 import {
 	getProductDetail,
@@ -465,7 +466,7 @@ export default {
 				cartAttr: false,
 				productAttr: [],
 				productSelect: {
-					cart_num: 1
+					totalSales: 1
 				},
 				attrValueId: 0 //已选属性Id
 			},
@@ -707,8 +708,8 @@ export default {
 		 *
 		 */
 		iptCartNum: function (e) {
-			this.attr.productSelect.totalStock = this.attr.productSelect.totalStock - e;
-			this.$set(this.attr.productSelect, "cart_num", e);
+			// this.attr.productSelect.totalStock = this.attr.productSelect.totalStock - e;
+			this.$set(this.attr.productSelect, "totalSales", e);
 		},
 		// 后退
 		returns() {
@@ -826,18 +827,18 @@ export default {
 			if (productSelect === undefined) return;
 			let stock = productSelect.totalStock || 0;
 			if (changeValue) {
-				this.attr.productSelect.cart_num++;
-				this.attr.productSelect.totalStock--;
-				if (this.attr.productSelect.cart_num > stock) {
-					this.$set(this.attr.productSelect, "cart_num", stock ? stock : 1);
-					this.$set(this, "cart_num", stock ? stock : 1);
+				this.attr.productSelect.totalSales++;
+				// this.attr.productSelect.totalStock--;
+				if (this.attr.productSelect.totalSales > stock) {
+					this.$set(this.attr.productSelect, "totalSales", stock ? stock : 1);
+					this.$set(this, "totalSales", stock ? stock : 1);
 				}
 			} else {
-				this.attr.productSelect.cart_num--;
-				this.attr.productSelect.totalStock++;
-				if (this.attr.productSelect.cart_num < 1) {
-					this.$set(this.attr.productSelect, "cart_num", 1);
-					this.$set(this, "cart_num", 1);
+				this.attr.productSelect.totalSales--;
+				// this.attr.productSelect.totalStock++;
+				if (this.attr.productSelect.totalSales < 1) {
+					this.$set(this.attr.productSelect, "totalSales", 1);
+					this.$set(this, "totalSales", 1);
 				}
 			}
 		},
@@ -1080,7 +1081,7 @@ export default {
 			}
 		},
 		// 跳转到地址列表
-		selecAddrAttr: function() {
+		selecAddrAttr: function () {
 			uni.navigateTo({
 				url: '/pages/users/user_address_list/index?type=1'
 			});
@@ -1091,7 +1092,7 @@ export default {
 		selecAttr: function () {
 			this.$set(this.attr, "cartAttr", true);
 			this.$set(this.attr, "productAttr", this.skuArr);
-			this.storeInfo.cart_num = 1
+			this.storeInfo.totalSales = 1
 			this.$set(this.attr, "productSelect", this.storeInfo);
 			this.$set(this, "isOpen", true);
 		},
@@ -1133,7 +1134,7 @@ export default {
 		 */
 		goCat: function (news) {
 			let that = this,
-			productSelect = that.productValue[this.attrValue];
+				productSelect = that.productValue[this.attrValue];
 			that.currentPage = false;
 			//打开属性
 			if (that.attrValue) {
@@ -1147,54 +1148,49 @@ export default {
 			if (that.attr.cartAttr === true && that.isOpen === false)
 				return (that.isOpen = true);
 			//如果有属性,没有选择,提示用户选择
-			if (
-				that.attr.productAttr.length &&
-				productSelect === undefined &&
-				that.isOpen === true
-			)
-				return that.$util.Tips({
-					title: that.$t(`产品库存不足,请选择其它属性`),
-				});
-			if (that.attr.productSelect.cart_num <= 0) {
-				that.attr.productSelect.cart_num = 1;
+			// if (
+			// 	that.attr.productAttr.length &&
+			// 	productSelect === undefined &&
+			// 	that.isOpen === true
+			// )
+			// 	return that.$util.Tips({
+			// 		title: that.$t(`产品库存不足,请选择其它属性`),
+			// 	});
+			// if (that.attr.productSelect.totalSales <= 0) {
+			// 	that.attr.productSelect.totalSales = 1;
+			// 	that.isOpen = false;
+			// 	return that.$util.Tips({
+			// 		title: that.$t(`请选择数量`),
+			// 	});
+			// }
+			postBeforeCheck({
+				goodsSpecId: that.attr.attrValueId,
+				num: that.attr.productSelect.totalSales,
+				userAddressId: that.attrAddrValue.id
+			}).then(function (res) {
 				that.isOpen = false;
-				return that.$util.Tips({
-					title: that.$t(`请选择数量`),
-				});
-			}
-			let q = {
-				productId: that.id,
-				cartNum: that.attr.productSelect.cart_num,
-				new: news === undefined ? 0 : 1,
-				uniqueId: that.attr.productSelect !== undefined ?
-					that.attr.productSelect.unique : "",
-				virtual_type: that.storeInfo.virtual_type,
-			};
-			// console.log(q)
-			postCartAdd(q)
-				.then(function (res) {
-					that.isOpen = false;
-					that.attr.cartAttr = false;
-					if (news) {
-						uni.navigateTo({
-							url: "/pages/goods/order_confirm/index?new=1&cartId=" +
-								res.data.cartId,
-						});
-					} else {
-						that.$util.Tips({
-							title: that.$t(`添加成功`),
-							success: () => {
-								that.getCartCount(true);
-							},
-						});
-					}
-				})
-				.catch((err) => {
-					that.isOpen = false;
-					return that.$util.Tips({
-						title: err,
+				that.attr.cartAttr = false;
+				if (res.code == 200) {
+					uni.navigateTo({
+						url: "/pages/goods/order_confirm/index?num=" + that.attr.productSelect.totalSales + "&productId=" +
+							that.attr.productSelect.id + "&addressId=" + that.attrAddrValue.id +
+							"&goodsSpecId=" + that.attr.attrValueId,
+					});
+				} else {
+					that.$util.Tips({
+						title: that.$t(`所选商品属性不支持下单`),
+						success: () => {
+							// that.getCartCount(true);
+						},
 					});
+				}
+			})
+			.catch((err) => {
+				that.isOpen = false;
+				return that.$util.Tips({
+					title: err,
 				});
+			});
 		},
 		/**
 		 * 获取购物车数量