|
@@ -279,6 +279,7 @@ var _default =
|
|
|
},
|
|
|
onShow: function onShow() {
|
|
|
var that = this;
|
|
|
+ that.clearPages();
|
|
|
that.searchToken();
|
|
|
},
|
|
|
methods: {
|
|
@@ -529,37 +530,54 @@ var _default =
|
|
|
if (file.length && file.length > 0) return file[0].url;
|
|
|
},
|
|
|
// 去结算
|
|
|
- toSettle: function toSettle() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee6() {var that, goodsList, cartIds, _iterator10, _step10, _val, _i2, _goodsList, val, res, data, key;return _regenerator.default.wrap(function _callee6$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:
|
|
|
+ toSettle: function toSettle() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee6() {var that, list, user, cartIds, _iterator10, _step10, val, _iterator11, _step11, s, res;return _regenerator.default.wrap(function _callee6$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:
|
|
|
that = _this4;
|
|
|
- // 将选中的购物车放到数组中,传回服务端进行检查.然后拿着key去订单页请求数据
|
|
|
- goodsList = [];
|
|
|
+ list = that.list;
|
|
|
+ user = that.user;if (!(
|
|
|
+ user && user._id)) {_context7.next = 17;break;}if (!(
|
|
|
+ user.role == 'jdry' || user.role == '社区人员')) {_context7.next = 14;break;}
|
|
|
cartIds = [];_iterator10 = _createForOfIteratorHelper(
|
|
|
- that.list);try {for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {_val = _step10.value;
|
|
|
- goodsList.push(_val);
|
|
|
- }} catch (err) {_iterator10.e(err);} finally {_iterator10.f();}
|
|
|
- for (_i2 = 0, _goodsList = goodsList; _i2 < _goodsList.length; _i2++) {val = _goodsList[_i2];
|
|
|
- if (val.check) cartIds.push(val.cart_id);
|
|
|
- }_context7.next = 8;return (
|
|
|
- that.$api("/util/checkCartBuy", 'POST', {
|
|
|
- cartIds: cartIds }));case 8:res = _context7.sent;
|
|
|
+ list);try {for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {val = _step10.value;_iterator11 = _createForOfIteratorHelper(
|
|
|
+ val.list);try {for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {s = _step11.value;
|
|
|
+ if (s.check) cartIds.push(s.cart_id);
|
|
|
+ }} catch (err) {_iterator11.e(err);} finally {_iterator11.f();}
|
|
|
+ }} catch (err) {_iterator10.e(err);} finally {_iterator10.f();}_context7.next = 10;return (
|
|
|
+ that.$api("/Cart/checkCartBuy", 'POST', {
|
|
|
+ cartIds: cartIds,
|
|
|
+ totalMoney: that.totalMoney }));case 10:res = _context7.sent;
|
|
|
|
|
|
if (res.errcode == '0') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pagesMy/order/index" });
|
|
|
+
|
|
|
+ }_context7.next = 15;break;case 14:
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: '角色不匹配 无法结算',
|
|
|
+ icon: 'none' });case 15:_context7.next = 18;break;case 17:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/login/index" });case 18:case "end":return _context7.stop();}}}, _callee6);}))();
|
|
|
+
|
|
|
|
|
|
- data =
|
|
|
- res.data;
|
|
|
- if (data.result) {
|
|
|
- key = data.key;
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pagesHome/order/order?key=".concat(key) });
|
|
|
|
|
|
- }
|
|
|
- }case 10:case "end":return _context7.stop();}}}, _callee6);}))();
|
|
|
},
|
|
|
// 是否选中商品,控制提交订单按钮
|
|
|
hasCheck: function hasCheck() {
|
|
|
var that = this;
|
|
|
return that.list.some(function (e) {return e.list.some(function (eg) {return eg.check;});});
|
|
|
},
|
|
|
+ // 清空总信息
|
|
|
+ clearPages: function clearPages() {
|
|
|
+ var that = this;
|
|
|
+ that.$set(that, "list", []);
|
|
|
+ that.$set(that, "isAll", false);
|
|
|
+ that.$set(that, "totalMoney", 0);
|
|
|
+ that.$set(that, "num", 0);
|
|
|
+ },
|
|
|
// 公共跳转
|
|
|
toCommon: function toCommon(route, e) {
|
|
|
uni.navigateTo({
|