zs há 1 ano atrás
pai
commit
94de664d58
48 ficheiros alterados com 207 adições e 87 exclusões
  1. 2 0
      App.vue
  2. 1 1
      pages/market/index.vue
  3. 83 24
      pagesGoods/index/index.vue
  4. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map
  5. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/components/upload/index.js.map
  6. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/good/index.js.map
  7. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/index.js.map
  8. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map
  9. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/login/index.js.map
  10. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/market/index.js.map
  11. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/index.js.map
  12. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/procure/index.js.map
  13. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pages/register/index.js.map
  14. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesGoods/index/index.js.map
  15. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/index.js.map
  16. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/info.js.map
  17. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/update.js.map
  18. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/buyExamine/index.js.map
  19. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/collectionExamin/index.js.map
  20. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/goods/add.js.map
  21. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/goods/index.js.map
  22. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/maintenance/index.js.map
  23. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/order/index.js.map
  24. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/record/index.js.map
  25. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/repair/index.js.map
  26. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/shop/index.js.map
  27. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/spec/add.js.map
  28. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/spec/index.js.map
  29. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/user/index.js.map
  30. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.js.map
  31. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.js.map
  32. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.js.map
  33. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js.map
  34. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js.map
  35. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-forms/components/uni-forms/uni-forms.js.map
  36. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.js.map
  37. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js.map
  38. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-grid/components/uni-grid/uni-grid.js.map
  39. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map
  40. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js.map
  41. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js.map
  42. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map
  43. 1 1
      unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js.map
  44. 2 0
      unpackage/dist/dev/mp-weixin/common/main.wxss
  45. 1 1
      unpackage/dist/dev/mp-weixin/pages/market/index.js
  46. 64 5
      unpackage/dist/dev/mp-weixin/pagesGoods/index/index.js
  47. 1 1
      unpackage/dist/dev/mp-weixin/pagesGoods/index/index.wxml
  48. 13 15
      unpackage/dist/dev/mp-weixin/pagesGoods/index/index.wxss

+ 2 - 0
App.vue

@@ -146,6 +146,8 @@
 		--f9Color: #f9f9f9;
 		--f99Color: #999999;
 		--f85Color: #858585;
+		--f80Color: #808080;
+		--fDCColor: #DCDCDC;
 		--fcColor: #cccccc;
 		--f00Color: #000000;
 		--fffColor: #ffffff;

+ 1 - 1
pages/market/index.vue

@@ -112,7 +112,7 @@
 			// 查询购物车信息
 			async searchMarket() {
 				const that = this;
-				const res = await that.$api(`/Cart`, 'GET', {
+				const res = await that.$api(`/Cart/self`, 'GET', {
 					user: that.user._id
 				});
 				if (res.errcode == '0') that.$set(that, `list`, res.data)

+ 83 - 24
pagesGoods/index/index.vue

@@ -54,20 +54,20 @@
 									<view class="one_1">
 										<view class="l">
 											<image class="image"
-												:src="specInfo&&specInfo.file.length>0?specInfo.file[0].url:''"
+												:src="specsInfo&&specsInfo.file.length>0?specsInfo.file[0].url:''"
 												mode="aspectFill"></image>
 										</view>
 										<view class="r">
 											<view class="money">
-												<text class="money_1"><text>¥</text>{{specInfo.money}}</text>
+												<text class="money_1"><text>¥</text>{{specsInfo.money}}</text>
 											</view>
 											<view class="other_1">
 												<text>已选:</text>
-												<text>{{specInfo.name||'暂无'}}</text>
+												<text>{{specsInfo.name||'暂无'}}</text>
 											</view>
 											<view class="other_1">
 												<text>库存:</text>
-												<text>{{specInfo.num||'0'}}</text>
+												<text>{{specsInfo.num||'0'}}</text>
 											</view>
 										</view>
 									</view>
@@ -76,7 +76,9 @@
 											规格
 										</view>
 										<view class="one_2_2">
-											<view v-for="(item,index) in specList" :key="index" @tap="toSpecs(item)">
+											<view
+												:class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
+												v-for="(item,index) in specList" :key="index" @tap="toSpecs(item)">
 												<text>{{item.name}}</text>
 											</view>
 										</view>
@@ -98,7 +100,7 @@
 						</scroll-view>
 					</view>
 					<view class="info_2">
-						<button class="button" @tap="toMarket">加入购物车</button>
+						<button :disabled="is_zero" class="button" @tap="toMarket">加入购物车</button>
 					</view>
 				</view>
 			</view>
@@ -122,11 +124,12 @@
 				popupShow: '1',
 				// 规格数组
 				specList: [],
-				specInfo: {},
+				specsInfo: {},
 				// 规格信息
 				is_specs: 0,
 				// 购买数量
 				buy_num: 1,
+				is_zero: false,
 				// 底部商品导航
 				options: [{
 						icon: 'shop',
@@ -152,6 +155,10 @@
 			that.searchToken();
 			await that.search();
 		},
+		onShow() {
+			const that = this;
+			that.searchOther()
+		},
 		methods: {
 			searchToken() {
 				const that = this;
@@ -182,7 +189,7 @@
 						})
 						if (data) {
 							res.data.money = data[0].money
-							that.$set(that, `specInfo`, data[0]);
+							that.$set(that, `specsInfo`, data[0]);
 							that.$set(that, `specList`, data);
 						}
 						that.$set(that, `info`, res.data);
@@ -208,13 +215,65 @@
 				that.$refs.popup.open();
 			},
 			// 加入购物车
-			async toMarket(e) {},
+			async toMarket(e) {
+				const that = this;
+				let user = that.user;
+				let info = that.info;
+				let specsInfo = that.specsInfo;
+				if (user && user._id) {
+					let res;
+					let obj = {
+						user: user._id,
+						supplier_id: info.supplier_id,
+						spec: specsInfo._id,
+						goods: info._id,
+						num: that.buy_num,
+					}
+					res = await that.$api(`/Cart`, 'POST', obj)
+					if (res.errcode == '0') {
+						uni.showToast({
+							title: `加入购物车成功`,
+							icon: 'none'
+						})
+						that.toClose();
+					} else {
+						uni.showToast({
+							title: res.errmsg,
+							icon: 'none'
+						})
+					}
+				} else {
+					uni.navigateTo({
+						url: `/pages/login/index`
+					})
+				}
+			},
 			// 加数量
-			async toCount(e) {},
+			async toCount(e) {
+				const that = this;
+				that.$set(that, `buy_num`, e)
+			},
 			// 选择规格
-			async toSpecs(e) {},
+			async toSpecs(e) {
+				const that = this;
+				let specs = that.specList;
+				let dataIndex = specs.findIndex(i => i._id == e._id);
+				that.$set(that, `is_specs`, dataIndex);
+				that.$set(that, `specsInfo`, e)
+				that.$set(that, `buy_num`, 1);
+				if (e.num <= 0) that.$set(that, `is_zero`, true)
+				else that.$set(that, `is_zero`, false)
+			},
+			async searchOther() {
+				const that = this;
+				const res = await that.$api(`/Cart/num`, 'GET', {
+					user: that.user._id
+				})
+				if (res.errcode == '0') that.$set(that.options[1], `info`, res.data);
+			},
 			toClose() {
 				const that = this;
+				that.searchOther()
 				that.$refs.popup.close();
 			},
 		}
@@ -256,13 +315,13 @@
 				padding: 2vw;
 
 				.money {
-					font-size: 20px;
+					font-size: var(--font20Size);
 					padding: 0 1vw 0 0;
 					color: var(--fF0Color);
 					font-weight: bold;
 
 					text {
-						font-size: 14px;
+						font-size: var(--font14Size);
 					}
 				}
 			}
@@ -284,13 +343,13 @@
 					overflow: hidden;
 					text-overflow: ellipsis;
 					word-break: break-all;
-					font-size: 17px;
+					font-size: var(--font17Size);
 					font-weight: bold;
 					margin: 0 0 2vw 0;
 				}
 
 				.brief {
-					font-size: 14px;
+					font-size: var(--font14Size);
 					color: var(--f85Color);
 					margin: 0 0 1vw 0;
 				}
@@ -409,7 +468,7 @@
 						border-bottom: 0.5vw solid var(--f9Color);
 
 						.one_2_1 {
-							font-size: 14px;
+							font-size: var(--font14Size);
 							margin: 0 0 2vw 0;
 						}
 
@@ -418,19 +477,19 @@
 							flex-wrap: wrap;
 
 							.list {
-								background-color: #F5F5F5;
+								background-color: var(--f5Color);
 								margin: 0 2vw 2vw 0;
 								padding: 0.5vw 1vw;
 								border-radius: 5px;
 
 								text {
-									font-size: 14px;
+									font-size: var(--font14Size);
 									color: var(--f00Color);
 								}
 							}
 
 							.huilist {
-								background-color: #DCDCDC;
+								background-color: var(--fDCColor);
 
 								text {
 									color: var(--f85Color);
@@ -438,18 +497,18 @@
 							}
 
 							.redlist {
-								background-color: var(--fF0Color);
+								background-color: var(--f3CColor);
 
 								text {
-									color: #ffffff;
+									color: var(--mainColor);
 								}
 							}
 
 							.huiilist {
-								background-color: #808080;
+								background-color: var(--f80Color);
 
 								text {
-									color: #cccccc;
+									color: var(--fcColor);
 								}
 							}
 						}
@@ -476,11 +535,11 @@
 			}
 
 			.info_2 {
-				border-bottom: 0.5vw solid var(--f9Color);
 
 				.button {
 					background-color: var(--f3CColor);
 					color: var(--mainColor);
+					border-radius: 0;
 				}
 			}
 		}

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/components/upload/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/good/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/home/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/login/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/market/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/procure/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/register/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesGoods/index/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/info.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/account/update.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/buyExamine/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/collectionExamin/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/goods/add.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/goods/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/maintenance/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/order/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/record/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/repair/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/shop/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/spec/add.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/spec/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesMy/user/index.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-forms/components/uni-forms/uni-forms.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-goods-nav/components/uni-goods-nav/uni-goods-nav.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-grid/components/uni-grid/uni-grid.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-icons/components/uni-icons/uni-icons.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js.map


+ 2 - 0
unpackage/dist/dev/mp-weixin/common/main.wxss

@@ -2462,6 +2462,8 @@ page {
   --f9Color: #f9f9f9;
   --f99Color: #999999;
   --f85Color: #858585;
+  --f80Color: #808080;
+  --fDCColor: #DCDCDC;
   --fcColor: #cccccc;
   --f00Color: #000000;
   --fffColor: #ffffff;

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/market/index.js

@@ -300,7 +300,7 @@ var _default =
     // 查询购物车信息
     searchMarket: function searchMarket() {var _this = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var that, res;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:
                 that = _this;_context.next = 3;return (
-                  that.$api("/Cart", 'GET', {
+                  that.$api("/Cart/self", 'GET', {
                     user: that.user._id }));case 3:res = _context.sent;
 
                 if (res.errcode == '0') that.$set(that, "list", res.data);case 5:case "end":return _context.stop();}}}, _callee);}))();

+ 64 - 5
unpackage/dist/dev/mp-weixin/pagesGoods/index/index.js

@@ -269,6 +269,8 @@ __webpack_require__.r(__webpack_exports__);
 //
 //
 //
+//
+//
 var _default =
 {
   data: function data() {
@@ -285,11 +287,12 @@ var _default =
       popupShow: '1',
       // 规格数组
       specList: [],
-      specInfo: {},
+      specsInfo: {},
       // 规格信息
       is_specs: 0,
       // 购买数量
       buy_num: 1,
+      is_zero: false,
       // 底部商品导航
       options: [{
         icon: 'shop',
@@ -315,6 +318,10 @@ var _default =
               that.searchToken();_context.next = 5;return (
                 that.search());case 5:case "end":return _context.stop();}}}, _callee, this);}));function onLoad(_x) {return _onLoad.apply(this, arguments);}return onLoad;}(),
 
+  onShow: function onShow() {
+    var that = this;
+    that.searchOther();
+  },
   methods: {
     searchToken: function searchToken() {
       var that = this;
@@ -345,7 +352,7 @@ var _default =
                   });
                   if (data) {
                     res.data.money = data[0].money;
-                    that.$set(that, "specInfo", data[0]);
+                    that.$set(that, "specsInfo", data[0]);
                     that.$set(that, "specList", data);
                   }
                   that.$set(that, "info", res.data);
@@ -371,13 +378,65 @@ var _default =
       that.$refs.popup.open();
     },
     // 加入购物车
-    toMarket: function toMarket(e) {return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3() {return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:case "end":return _context3.stop();}}}, _callee3);}))();},
+    toMarket: function toMarket(e) {var _this2 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3() {var that, user, info, specsInfo, res, obj;return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:
+                that = _this2;
+                user = that.user;
+                info = that.info;
+                specsInfo = that.specsInfo;if (!(
+                user && user._id)) {_context3.next = 12;break;}
+
+                obj = {
+                  user: user._id,
+                  supplier_id: info.supplier_id,
+                  spec: specsInfo._id,
+                  goods: info._id,
+                  num: that.buy_num };_context3.next = 8;return (
+
+                  that.$api("/Cart", 'POST', obj));case 8:res = _context3.sent;
+                if (res.errcode == '0') {
+                  uni.showToast({
+                    title: "\u52A0\u5165\u8D2D\u7269\u8F66\u6210\u529F",
+                    icon: 'none' });
+
+                  that.toClose();
+                } else {
+                  uni.showToast({
+                    title: res.errmsg,
+                    icon: 'none' });
+
+                }_context3.next = 13;break;case 12:
+
+                uni.navigateTo({
+                  url: "/pages/login/index" });case 13:case "end":return _context3.stop();}}}, _callee3);}))();
+
+
+    },
     // 加数量
-    toCount: function toCount(e) {return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4() {return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:case "end":return _context4.stop();}}}, _callee4);}))();},
+    toCount: function toCount(e) {var _this3 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4() {var that;return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:
+                that = _this3;
+                that.$set(that, "buy_num", e);case 2:case "end":return _context4.stop();}}}, _callee4);}))();
+    },
     // 选择规格
-    toSpecs: function toSpecs(e) {return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee5() {return _regenerator.default.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0:case "end":return _context5.stop();}}}, _callee5);}))();},
+    toSpecs: function toSpecs(e) {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee5() {var that, specs, dataIndex;return _regenerator.default.wrap(function _callee5$(_context5) {while (1) {switch (_context5.prev = _context5.next) {case 0:
+                that = _this4;
+                specs = that.specList;
+                dataIndex = specs.findIndex(function (i) {return i._id == e._id;});
+                that.$set(that, "is_specs", dataIndex);
+                that.$set(that, "specsInfo", e);
+                that.$set(that, "buy_num", 1);
+                if (e.num <= 0) that.$set(that, "is_zero", true);else
+                that.$set(that, "is_zero", false);case 7:case "end":return _context5.stop();}}}, _callee5);}))();
+    },
+    searchOther: function searchOther() {var _this5 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee6() {var that, res;return _regenerator.default.wrap(function _callee6$(_context6) {while (1) {switch (_context6.prev = _context6.next) {case 0:
+                that = _this5;_context6.next = 3;return (
+                  that.$api("/Cart/num", 'GET', {
+                    user: that.user._id }));case 3:res = _context6.sent;
+
+                if (res.errcode == '0') that.$set(that.options[1], "info", res.data);case 5:case "end":return _context6.stop();}}}, _callee6);}))();
+    },
     toClose: function toClose() {
       var that = this;
+      that.searchOther();
       that.$refs.popup.close();
     } } };exports.default = _default;
 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesGoods/index/index.wxml


+ 13 - 15
unpackage/dist/dev/mp-weixin/pagesGoods/index/index.wxss

@@ -31,13 +31,13 @@
   padding: 2vw;
 }
 .content .one .one_2 .money {
-  font-size: 20px;
+  font-size: var(--font20Size);
   padding: 0 1vw 0 0;
   color: var(--fF0Color);
   font-weight: bold;
 }
 .content .one .one_2 .money text {
-  font-size: 14px;
+  font-size: var(--font14Size);
 }
 .content .one .one_3 {
   display: flex;
@@ -54,12 +54,12 @@
   overflow: hidden;
   text-overflow: ellipsis;
   word-break: break-all;
-  font-size: 17px;
+  font-size: var(--font17Size);
   font-weight: bold;
   margin: 0 0 2vw 0;
 }
 .content .one .one_4 .brief {
-  font-size: 14px;
+  font-size: var(--font14Size);
   color: var(--f85Color);
   margin: 0 0 1vw 0;
 }
@@ -154,7 +154,7 @@
   border-bottom: 0.5vw solid var(--f9Color);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_1 {
-  font-size: 14px;
+  font-size: var(--font14Size);
   margin: 0 0 2vw 0;
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 {
@@ -162,32 +162,32 @@
   flex-wrap: wrap;
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .list {
-  background-color: #F5F5F5;
+  background-color: var(--f5Color);
   margin: 0 2vw 2vw 0;
   padding: 0.5vw 1vw;
   border-radius: 5px;
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .list text {
-  font-size: 14px;
+  font-size: var(--font14Size);
   color: var(--f00Color);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .huilist {
-  background-color: #DCDCDC;
+  background-color: var(--fDCColor);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .huilist text {
   color: var(--f85Color);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .redlist {
-  background-color: var(--fF0Color);
+  background-color: var(--f3CColor);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .redlist text {
-  color: #ffffff;
+  color: var(--mainColor);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .huiilist {
-  background-color: #808080;
+  background-color: var(--f80Color);
 }
 .popup .specs_1 .info_1 .one .one_2 .one_2_2 .huiilist text {
-  color: #cccccc;
+  color: var(--fcColor);
 }
 .popup .specs_1 .info_1 .one .one_3 {
   display: flex;
@@ -203,11 +203,9 @@
   color: var(--fF0Color);
   padding: 0 0 0 2vw;
 }
-.popup .specs_1 .info_2 {
-  border-bottom: 0.5vw solid var(--f9Color);
-}
 .popup .specs_1 .info_2 .button {
   background-color: var(--f3CColor);
   color: var(--mainColor);
+  border-radius: 0;
 }