This commit is contained in:
cclu 2025-02-28 13:56:15 +08:00
parent dc58d0e773
commit 1ca32e6e0c
6 changed files with 143 additions and 68 deletions

View File

@ -779,7 +779,7 @@ export default {
if (this.bigPageType === "UnionMall") {
if (!(this.userInfo.ACCOUNT_BALANCE > 0)) {
uni.showToast({
title: "工会商城余额不足,无法下单!",
title: "工会商城余额为0,无法下单!",
icon: "none",
});
return;

View File

@ -856,7 +856,29 @@ export default {
}, 2000);
},
//
handleMakeOrder() {
async handleMakeOrder() {
let userInfo = {};
if (this.pageType === "UnionMall") {
//
uni.showLoading({
title: "获取用户余额...",
});
const userData = await this.$api.getCoop({
action_type: "GetMembershipInfo",
WechatUserId: this.user.WechatUserId,
});
userInfo = userData.Data;
console.log("this.userInfo", this.userInfo);
uni.hideLoading();
if (!(userInfo && userInfo.ACCOUNT_BALANCE > 0)) {
uni.showToast({
title: "余额为0无法支付",
icon: "none",
});
return;
}
}
if (
this.good.SKULIST &&
this.good.SKULIST.length > 0 &&

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -749,7 +749,7 @@ var _default = {
if (this.bigPageType === "UnionMall") {
if (!(this.userInfo.ACCOUNT_BALANCE > 0)) {
uni.showToast({
title: "工会商城余额不足,无法下单!",
title: "工会商城余额为0,无法下单!",
icon: "none"
});
return;

View File

@ -200,7 +200,9 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 30));
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _vuex = __webpack_require__(/*! vuex */ 33);
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@ -516,70 +518,121 @@ var _default = {
},
// 立即购买方法
handleMakeOrder: function handleMakeOrder() {
if (this.good.SKULIST && this.good.SKULIST.length > 0 && (this.good.COMMODITY_RULE === "默认" || !this.good.COMMODITY_RULE)) {
uni.showToast({
title: "请先选择规格!",
icon: "none"
});
return;
}
// 是否为已售罄
if (this.good.COMMODITY_STOCK === 0) {
uni.showToast({
title: "商品已售罄!",
icon: "none"
});
return;
}
if (this.good.COMMODITY_STOCK < this.good.count) {
uni.showToast({
title: "商品库存不足!",
icon: "none"
});
return;
}
console.log("this.good", this.good);
var nowShopList = [this.good];
if (nowShopList && nowShopList.length > 0) {
this.pageOut = true;
var orderList = [];
var noSelectList = [];
nowShopList.forEach(function (item) {
item.ORDER_COUNT = item.count;
item.AVERAGE_PRICE = item.COMMODITY_MEMBERPRICE;
item.cartItemAoumt = Number((item.AVERAGE_PRICE * item.ORDER_COUNT).toFixed(2));
item.ORDER_AMOUNT = Number((item.AVERAGE_PRICE * item.ORDER_COUNT).toFixed(2));
item.COMMODITY_INTRO = "";
orderList.push(item);
});
// this.$store.commit('shopcartOrder', orderList)
// 购物车改了后有些id不一样了 统一一下
if (orderList && orderList.length > 0) {
orderList.forEach(function (item) {
var _item$COMMODITY_MEMBE = item.COMMODITY_MEMBERPRICE.toString().split("."),
_item$COMMODITY_MEMBE2 = (0, _slicedToArray2.default)(_item$COMMODITY_MEMBE, 2),
big = _item$COMMODITY_MEMBE2[0],
small = _item$COMMODITY_MEMBE2[1];
item.COMMODITY_INYEGER = big;
item.COMMODITY_DECIMAL = small;
// item.COMMODITY_ID = item.SELLERCOMMODITY_ID
});
}
var _this4 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var userInfo, userData, nowShopList, orderList, noSelectList, id;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
userInfo = {};
if (!(_this4.pageType === "UnionMall")) {
_context.next = 12;
break;
}
// 获取最新的用户余额
uni.showLoading({
title: "获取用户余额..."
});
_context.next = 5;
return _this4.$api.getCoop({
action_type: "GetMembershipInfo",
WechatUserId: _this4.user.WechatUserId
});
case 5:
userData = _context.sent;
userInfo = userData.Data;
console.log("this.userInfo", _this4.userInfo);
uni.hideLoading();
if (userInfo && userInfo.ACCOUNT_BALANCE > 0) {
_context.next = 12;
break;
}
uni.showToast({
title: "余额为0无法支付",
icon: "none"
});
return _context.abrupt("return");
case 12:
if (!(_this4.good.SKULIST && _this4.good.SKULIST.length > 0 && (_this4.good.COMMODITY_RULE === "默认" || !_this4.good.COMMODITY_RULE))) {
_context.next = 15;
break;
}
uni.showToast({
title: "请先选择规格!",
icon: "none"
});
return _context.abrupt("return");
case 15:
if (!(_this4.good.COMMODITY_STOCK === 0)) {
_context.next = 18;
break;
}
uni.showToast({
title: "商品已售罄!",
icon: "none"
});
return _context.abrupt("return");
case 18:
if (!(_this4.good.COMMODITY_STOCK < _this4.good.count)) {
_context.next = 21;
break;
}
uni.showToast({
title: "商品库存不足!",
icon: "none"
});
return _context.abrupt("return");
case 21:
console.log("this.good", _this4.good);
nowShopList = [_this4.good];
if (nowShopList && nowShopList.length > 0) {
_this4.pageOut = true;
orderList = [];
noSelectList = [];
nowShopList.forEach(function (item) {
item.ORDER_COUNT = item.count;
item.AVERAGE_PRICE = item.COMMODITY_MEMBERPRICE;
item.cartItemAoumt = Number((item.AVERAGE_PRICE * item.ORDER_COUNT).toFixed(2));
item.ORDER_AMOUNT = Number((item.AVERAGE_PRICE * item.ORDER_COUNT).toFixed(2));
item.COMMODITY_INTRO = "";
orderList.push(item);
});
// this.$store.commit('shopcartOrder', orderList)
// 购物车改了后有些id不一样了 统一一下
if (orderList && orderList.length > 0) {
orderList.forEach(function (item) {
var _item$COMMODITY_MEMBE = item.COMMODITY_MEMBERPRICE.toString().split("."),
_item$COMMODITY_MEMBE2 = (0, _slicedToArray2.default)(_item$COMMODITY_MEMBE, 2),
big = _item$COMMODITY_MEMBE2[0],
small = _item$COMMODITY_MEMBE2[1];
item.COMMODITY_INYEGER = big;
item.COMMODITY_DECIMAL = small;
// item.COMMODITY_ID = item.SELLERCOMMODITY_ID
});
}
console.log("noSelectList", noSelectList);
console.log("orderList", orderList);
var id = Number(Math.random().toString().substr(3, 5) + Date.now()).toString(36);
if (orderList.length > 0) {
uni.navigateTo({
url: "/pages/shopPages/settlement/index?pageType=".concat(this.pageType, "&shopCarList=").concat(JSON.stringify(orderList))
});
} else {
uni.showToast({
title: "购物车内无勾选商品",
icon: "none"
});
}
}
console.log("noSelectList", noSelectList);
console.log("orderList", orderList);
id = Number(Math.random().toString().substr(3, 5) + Date.now()).toString(36);
if (orderList.length > 0) {
uni.navigateTo({
url: "/pages/shopPages/settlement/index?pageType=".concat(_this4.pageType, "&shopCarList=").concat(JSON.stringify(orderList))
});
} else {
uni.showToast({
title: "购物车内无勾选商品",
icon: "none"
});
}
}
case 24:
case "end":
return _context.stop();
}
}
}, _callee);
}))();
},
// 减少当前商品
handleDetailSubtract: function handleDetailSubtract(e, obj) {