Browse Source

规格更新

yuxingxing 2 years ago
parent
commit
34718b0dc5

+ 15 - 3
api/home.js

@@ -2,6 +2,7 @@
 
 import request from "@/utils/request.js";
 
+/* 首页*/
 // 查询轮播数据
 export function getAdsList(data) {
 	return request.get("v1/re/ads/list",data);
@@ -37,12 +38,23 @@ export function getGoodsInfo(data) {
 	return request.get("v1/re/goodsInfo/page",data);
 }
 
+/* 商品详情*/
 // 商品详情
 export function getGoodsDetail(data) {
 	return request.get("v1/re/goodsInfo/detail",data);
 }
 
-// 商品推荐商品列表查询
-export function get7(data) {
-	return request.get("",data);
+// 获取用户收获地址
+export function getUserAddressByUserId(data) {
+	return request.get("v1/userAddress-detailByUserId",data);
+}
+
+// 
+export function getUserAddress(data) {
+	return request.get("v1/userAddress-detailByIdAndFreight",data);
+}
+
+// 
+export function getAvailableChec(data) {
+	return request.get("v1/re/order/availableChec",data);
 }

+ 3 - 20
components/productWindow/index.vue

@@ -30,7 +30,7 @@
 					<view class="item">
 						<view class="title">选择规格</view>
 						<view class="listn acea-row row-middle">
-							<view class="itemn" :class="1 === 1 ? 'on' : ''"
+							<view class="itemn" :class="attr.attrValueId === itemn.id ? 'on' : ''"
 								v-for="(itemn, indexn) in attr.productAttr" @click="tapAttr(itemn, indexn)"
 								:key="indexn">
 								{{ itemn.spceName }}
@@ -155,26 +155,9 @@
 			CartNumAdd: function() {
 				this.$emit('ChangeCartNum', true);
 			},
-			tapAttr: function(indexw, indexn) {
-				
+			tapAttr: function(item, indexn) {
 				let that = this;
-				that.$emit("attrVal", {
-					indexw: indexw,
-					indexn: indexn
-				});
-				this.$set(this.attr.productAttr[indexw], 'index', this.attr.productAttr[indexw].attr_values[indexn]);
-				let value = that
-					.getCheckedValue()
-					.join(",");
-				that.$emit("ChangeAttr", value);
-				if(this.limitNum == 1){
-					if(this.attr.productSelect.quota>0){
-						this.attr.productSelect.cart_num = 1
-					}else{
-						this.attr.productSelect.cart_num = 0
-					}
-				}
-
+				that.$emit("ChangeAttr", item);
 			},
 			//获取被选中属性;
 			getCheckedValue: function() {

+ 1 - 1
libs/routine.js

@@ -198,7 +198,7 @@ class Routine {
 			routineLogin(data).then(res => {
 				if (res.data.key !== undefined && res.data.key) {} else {
 					store.commit('UPDATE_USERINFO', res.data.userInfo);
-					store.commit('SETUID', res.data.userInfo.uid);
+					store.commit('SETUID', res.data.userInfo.id);
 					Cache.set(USER_INFO, res.data.userInfo);
 				}
 				return resolve(res);

+ 20 - 44
pages/goods_details/index.vue

@@ -106,13 +106,13 @@
 								<view style="display: flex; align-items: center; width: 90%">
 									<view class="attr-txt"> 送至: </view>
 									<view class="atterTxt line1" style="width: 82%">{{
-											attrValue
+											attrAddrValue
 									}}</view>
 								</view>
 								<u-icon name="more-dot-fill"></u-icon>
 							</view>
 						</view>
-						<view class="attribute acea-row row-between-wrapper skeleton-rect" @click="selecAttr">
+						<!-- <view class="attribute acea-row row-between-wrapper skeleton-rect" @click="selecAttr">
 							<view class="flex">
 								<view style="display: flex; align-items: center; width: 90%">
 									<view class="attr-txt"> 参数: </view>
@@ -122,7 +122,7 @@
 								</view>
 								<u-icon name="more-dot-fill"></u-icon>
 							</view>
-						</view>
+						</view> -->
 					</view>
 					<view class="userEvaluation skeleton-rect" id="past1" v-if="replyCount">
 						<view class="title acea-row row-between-wrapper">
@@ -324,7 +324,7 @@
 <script>
 let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
 import {
-	getGoodsDetail
+	getGoodsDetail,getUserAddressByUserId
 } from "@/api/home.js";
 import {
 	getProductDetail,
@@ -406,6 +406,7 @@ export default {
 	data() {
 		let that = this;
 		return {
+			attrAddrValue: '请选择收获地址',
 			imgHost: HTTP_REQUEST_URL,
 			sysHeight: sysHeight,
 			a: false,
@@ -463,6 +464,7 @@ export default {
 				cartAttr: false,
 				productAttr: [],
 				productSelect: {},
+				attrValueId: 0 //已选属性Id
 			},
 			description: "",
 			navActive: 0,
@@ -496,7 +498,7 @@ export default {
 			svip_price_open: 1
 		};
 	},
-	computed: mapGetters(["isLogin"]),
+	computed: mapGetters(["isLogin","uid","userInfo"]),
 	watch: {
 		isLogin: {
 			handler: function (newV, oldV) {
@@ -847,49 +849,17 @@ export default {
 		 * 属性变动赋值
 		 *
 		 */
-		ChangeAttr: function (res) {
-			let productSelect = this.productValue[res];
-			// console.log(productSelect)
-			if (!productSelect) {
+		ChangeAttr: function (item) {
+			if (!item.id) {
 				this.$util.Tips({
 					title: this.$t(`重新选择`),
 					success: () => {
-						this.a = true
-						this.attr.productSelect.stock = 0
-						this.attr.productSelect.quota = 0
-						this.attr.productSelect.cart_num = 0
+						
 					},
 				});
 			} else {
-				this.a = false
-			}
-			this.$set(this, "selectSku", productSelect);
-			if (productSelect && productSelect.stock > 0) {
-				this.$set(this.attr.productSelect, "image", productSelect.image);
-				this.$set(this.attr.productSelect, "price", productSelect.price);
-				this.$set(this.attr.productSelect, "stock", productSelect.stock);
-				this.$set(this.attr.productSelect, "unique", productSelect.unique);
-				this.$set(this.attr.productSelect, "cart_num", 1);
-				this.$set(
-					this.attr.productSelect,
-					"vip_price",
-					productSelect.vip_price
-				);
-				this.$set(this, "attrValue", res);
-				this.$set(this, "attrTxt", this.$t(`已选择`));
-			} else {
-				this.$set(this.attr.productSelect, "image", productSelect.image);
-				this.$set(this.attr.productSelect, "price", productSelect.price);
-				this.$set(this.attr.productSelect, "stock", 0);
-				this.$set(this.attr.productSelect, "unique", "");
-				this.$set(this.attr.productSelect, "cart_num", 0);
-				this.$set(
-					this.attr.productSelect,
-					"vip_price",
-					this.storeInfo.vip_price
-				);
-				this.$set(this, "attrValue", "");
-				this.$set(this, "attrTxt", this.$t(`请选择`));
+				this.attrValue = this.skuArr[0].spceName
+				this.attr.attrValueId = item.id
 			}
 		},
 		/**
@@ -1008,8 +978,14 @@ export default {
 		 *
 		 */
 		DefaultSelect: function () {
-			this.attrTxt = '12'
-			this.attrValue = '34'
+			this.attrValue = this.skuArr[0].spceName
+			this.attr.attrValueId = this.skuArr[0].id
+			getUserAddressByUserId({
+				userId: this.$store.state.app.uid,
+				type: 1
+			}).then(res => {
+				
+			})
 		},
 		/**
 		 * 获取优惠券

+ 1 - 1
pages/user/index.vue

@@ -550,7 +550,7 @@ export default {
 			let that = this;
 			getUserInfo().then(res => {
 				that.userInfo = res.data
-				that.$store.commit("SETUID", res.data.uid);
+				that.$store.commit("SETUID", res.data.id);
 				that.orderMenu.forEach((item, index) => {
 					switch (item.title) {
 						case '待付款':

+ 1 - 1
pages/users/components/login_mobile/index.vue

@@ -226,7 +226,7 @@
 				getUserInfo().then(res => {
 					uni.hideLoading();
 					that.userInfo = res.data
-					that.$store.commit("SETUID", res.data.uid);
+					that.$store.commit("SETUID", res.data.id);
 					that.$store.commit("UPDATE_USERINFO", res.data);
 					// #ifdef MP
 					that.$util.Tips({

+ 1 - 1
pages/users/components/login_mobile/routine_phone.vue

@@ -90,7 +90,7 @@
 				getUserInfo().then(res => {
 					uni.hideLoading();
 					that.userInfo = res.data
-					that.$store.commit("SETUID", res.data.uid);
+					that.$store.commit("SETUID", res.data.id);
 					that.$store.commit("UPDATE_USERINFO", res.data);
 					that.isStatus = true
 					this.close()

+ 1 - 1
store/getters.js

@@ -5,7 +5,7 @@ export default {
   isLogin: state => !!state.app.token,
   backgroundColor: state => state.app.backgroundColor,
   userInfo: state => state.app.userInfo || {},
-	uid:state => state.app.uid,
+	uid:state => state.app.userInfo.id,
 	homeActive: state => state.app.homeActive,
 	home: state => state.app.home,
 	cartNum: state => state.indexData.cartNum,

+ 2 - 2
store/modules/app.js

@@ -73,11 +73,11 @@ const actions = {
 		else
 			return new Promise(reslove => {
 				let res = user_res;
-				// getUserInfo().then(res => {
+				getUserInfo().then(res => {
 					commit("UPDATE_USERINFO", res.data);
 					Cache.set(USER_INFO, res.data);
 					reslove(res.data);
-				// });
+				});
 			}).catch(() => {
 
 			});