zs 1 year ago
parent
commit
0786f43f84

+ 1 - 1
pages/market/index.vue

@@ -330,7 +330,7 @@
 						}
 					} else {
 						uni.showToast({
-							title: '角色不匹配 无法结算',
+							title: '角色不匹配 无法进行结算',
 							icon: 'none'
 						})
 					}

+ 25 - 18
pagesGoods/index/index.vue

@@ -224,26 +224,33 @@
 				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,
-						money: specsInfo.money,
-						total_money: that.$multiply(specsInfo.money, that.buy_num)
-					}
-					res = await that.$api(`/Cart`, 'POST', obj)
-					if (res.errcode == '0') {
-						uni.showToast({
-							title: `加入购物车成功`,
-							icon: 'none'
-						})
-						that.toClose();
+					if (user.role == 'jdry' || user.role == 'sqry') {
+						let res;
+						let obj = {
+							user: user._id,
+							supplier_id: info.supplier_id,
+							spec: specsInfo._id,
+							goods: info._id,
+							num: that.buy_num,
+							money: specsInfo.money,
+							total_money: that.$multiply(specsInfo.money, 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.showToast({
-							title: res.errmsg,
+							title: '角色不匹配 无法加入购物车',
 							icon: 'none'
 						})
 					}

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/market/index.js.map


File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesGoods/index/index.js.map


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

@@ -98,7 +98,7 @@ var components
 try {
   components = {
     uniNumberBox: function() {
-      return __webpack_require__.e(/*! import() | uni_modules/uni-number-box/components/uni-number-box/uni-number-box */ "uni_modules/uni-number-box/components/uni-number-box/uni-number-box").then(__webpack_require__.bind(null, /*! @/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue */ 284))
+      return __webpack_require__.e(/*! import() | uni_modules/uni-number-box/components/uni-number-box/uni-number-box */ "uni_modules/uni-number-box/components/uni-number-box/uni-number-box").then(__webpack_require__.bind(null, /*! @/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue */ 282))
     }
   }
 } catch (e) {
@@ -518,7 +518,7 @@ var _default =
                 }_context6.next = 15;break;case 14:
 
                 uni.showToast({
-                  title: '角色不匹配 无法结算',
+                  title: '角色不匹配 无法进行结算',
                   icon: 'none' });case 15:_context6.next = 18;break;case 17:
 
 

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

@@ -386,7 +386,8 @@ var _default =
                 user = that.user;
                 info = that.info;
                 specsInfo = that.specsInfo;if (!(
-                user && user._id)) {_context3.next = 12;break;}
+                user && user._id)) {_context3.next = 16;break;}if (!(
+                user.role == 'jdry' || user.role == 'sqry')) {_context3.next = 13;break;}
 
                 obj = {
                   user: user._id,
@@ -395,9 +396,9 @@ var _default =
                   goods: info._id,
                   num: that.buy_num,
                   money: specsInfo.money,
-                  total_money: that.$multiply(specsInfo.money, that.buy_num) };_context3.next = 8;return (
+                  total_money: that.$multiply(specsInfo.money, that.buy_num) };_context3.next = 9;return (
 
-                  that.$api("/Cart", 'POST', obj));case 8:res = _context3.sent;
+                  that.$api("/Cart", 'POST', obj));case 9:res = _context3.sent;
                 if (res.errcode == '0') {
                   uni.showToast({
                     title: "\u52A0\u5165\u8D2D\u7269\u8F66\u6210\u529F",
@@ -409,10 +410,16 @@ var _default =
                     title: res.errmsg,
                     icon: 'none' });
 
-                }_context3.next = 13;break;case 12:
+                }_context3.next = 14;break;case 13:
+
+                uni.showToast({
+                  title: '角色不匹配 无法加入购物车',
+                  icon: 'none' });case 14:_context3.next = 17;break;case 16:
+
+
 
                 uni.navigateTo({
-                  url: "/pages/login/index" });case 13:case "end":return _context3.stop();}}}, _callee3);}))();
+                  url: "/pages/login/index" });case 17:case "end":return _context3.stop();}}}, _callee3);}))();
 
 
     },