完善签到
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -124,13 +124,6 @@ var render = function () {
|
||||
var _c = _vm._self._c || _h
|
||||
if (!_vm._isMounted) {
|
||||
_vm.e0 = function ($event) {
|
||||
$event.stopPropagation()
|
||||
_vm.count++
|
||||
}
|
||||
_vm.e1 = function ($event) {
|
||||
_vm.showCart = true
|
||||
}
|
||||
_vm.e2 = function ($event) {
|
||||
_vm.showSpec = false
|
||||
}
|
||||
}
|
||||
@ -176,117 +169,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = void 0;
|
||||
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 26));
|
||||
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 28));
|
||||
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 10));
|
||||
var _vuex = __webpack_require__(/*! vuex */ 29);
|
||||
var _tools = __webpack_require__(/*! @/utils/tools */ 37);
|
||||
var _store = __webpack_require__(/*! @/api/store */ 36);
|
||||
var _type = __webpack_require__(/*! @/utils/type */ 38);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
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; }
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
||||
var _default2 = {
|
||||
name: "cate-one",
|
||||
props: {
|
||||
@ -308,10 +197,16 @@ var _default2 = {
|
||||
numberVal: 1,
|
||||
showCart: false,
|
||||
showSpec: false,
|
||||
count: 0
|
||||
goods_num: 0,
|
||||
cartLists: [],
|
||||
totalPrice: 0
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
created: function created() {
|
||||
this.getCartNum();
|
||||
},
|
||||
methods: _objectSpread(_objectSpread({}, (0, _vuex.mapActions)(['getCartNum'])), {}, {
|
||||
// 切换商品分类
|
||||
changeActive: function changeActive(index) {
|
||||
var cateList = this.cateList;
|
||||
this.cateName = cateList[index].name;
|
||||
@ -377,23 +272,121 @@ var _default2 = {
|
||||
}, _callee);
|
||||
}))();
|
||||
},
|
||||
changeNumber: function changeNumber() {},
|
||||
// 显示购物车弹出窗
|
||||
showCartPopup: function showCartPopup() {
|
||||
if (this.cartLists.length > 0) {
|
||||
this.showCart = true;
|
||||
}
|
||||
// else {
|
||||
// this.$toast({
|
||||
// title: '请先添加商品'
|
||||
// });
|
||||
// }
|
||||
},
|
||||
// 添加到购物车(默认商品数量+1,可以让后端连表查询商品数量字段)
|
||||
addCart: function addCart(item) {
|
||||
var _this3 = this;
|
||||
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
||||
var _yield$_addCart, code, data, msg;
|
||||
return _regenerator.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
_context2.next = 2;
|
||||
return (0, _store.addCart)({
|
||||
item_id: item.id,
|
||||
goods_num: 1
|
||||
});
|
||||
case 2:
|
||||
_yield$_addCart = _context2.sent;
|
||||
code = _yield$_addCart.code;
|
||||
data = _yield$_addCart.data;
|
||||
msg = _yield$_addCart.msg;
|
||||
if (code == 1) {
|
||||
_this3.getCartListFun();
|
||||
}
|
||||
case 7:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2);
|
||||
}))();
|
||||
},
|
||||
// 购物车商品里面的数量
|
||||
countChange: function countChange(_ref, cartId, item) {
|
||||
var _this4 = this;
|
||||
var value = _ref.value;
|
||||
console.log("countChange", value, cartId, item);
|
||||
(0, _store.changeGoodsCount)({
|
||||
cart_id: cartId,
|
||||
goods_num: value
|
||||
}).then(function (res) {
|
||||
if (res.code == 1) {
|
||||
_this4.getCartListFun();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取购物车列表数据
|
||||
getCartListFun: function getCartListFun() {
|
||||
var _this5 = this;
|
||||
console.log("1>>>", 1);
|
||||
(0, _store.getCartList)().then(function (res) {
|
||||
if (res.code == 1) {
|
||||
console.log("res>>>", res);
|
||||
var _res$data = res.data,
|
||||
lists = _res$data.lists,
|
||||
total_amount = _res$data.total_amount;
|
||||
// let cartType = 0;
|
||||
|
||||
// if (lists.length == 0) {
|
||||
// cartType = 2;
|
||||
// } else {
|
||||
// cartType = 1;
|
||||
// }
|
||||
|
||||
_this5.cartLists = lists;
|
||||
|
||||
// this.cartType = cartType;
|
||||
_this5.totalPrice = total_amount;
|
||||
// this.isShow = true;
|
||||
_this5.getCartNum();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 购物车删除商品
|
||||
deleteGoods: function deleteGoods(cart_id) {
|
||||
var _this6 = this;
|
||||
(0, _store.deleteGoods)({
|
||||
cart_id: cart_id
|
||||
}).then(function (res) {
|
||||
if (res.code == 1) {
|
||||
_this6.getCartListFun();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 去结算
|
||||
goSettle: function goSettle() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/order_now/order_now?id=".concat(id)
|
||||
});
|
||||
},
|
||||
// 跳转商品详情页
|
||||
toShop: function toShop(id) {
|
||||
console.log(id);
|
||||
uni.navigateTo({
|
||||
url: "/pages/shop/shop?id=".concat(id)
|
||||
});
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
}),
|
||||
computed: _objectSpread(_objectSpread({}, (0, _vuex.mapGetters)(['cartNum'])), {}, {
|
||||
// 显示购物车数量
|
||||
buyNumber: function buyNumber() {
|
||||
if (this.count > 0) {
|
||||
return this.count > 99 ? '99+' : this.count;
|
||||
if (this.goods_num > 0) {
|
||||
return this.goods_num > 99 ? '99+' : this.goods_num;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
}),
|
||||
watch: {
|
||||
list: {
|
||||
handler: function handler(val) {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-popup": "/components/uview-ui/components/u-popup/u-popup",
|
||||
"u-button": "/components/uview-ui/components/u-button/u-button"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-icon": "/components/uview-ui/components/u-icon/u-icon"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-icon": "/components/uview-ui/components/u-icon/u-icon"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-popup": "/components/uview-ui/components/u-popup/u-popup",
|
||||
"u-loading": "/components/uview-ui/components/u-loading/u-loading"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-icon": "/components/uview-ui/components/u-icon/u-icon"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-icon": "/components/uview-ui/components/u-icon/u-icon"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-popup": "/components/uview-ui/components/u-popup/u-popup"
|
||||
},
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user