完善商品分类及商品管理

This commit is contained in:
2025-05-03 17:48:41 +08:00
parent 9c7e8b59c2
commit 889f2b8fca
115 changed files with 1418 additions and 272 deletions

View File

@ -88,8 +88,8 @@ try {
uIcon: function () {
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-icon/u-icon */ "components/uview-ui/components/u-icon/u-icon").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-icon/u-icon.vue */ 318))
},
uBadge: function () {
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-badge/u-badge */ "components/uview-ui/components/u-badge/u-badge").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-badge/u-badge.vue */ 573))
loadingFooter: function () {
return __webpack_require__.e(/*! import() | components/loading-footer/loading-footer */ "components/loading-footer/loading-footer").then(__webpack_require__.bind(null, /*! @/components/loading-footer/loading-footer.vue */ 670))
},
uPopup: function () {
return __webpack_require__.e(/*! import() | components/uview-ui/components/u-popup/u-popup */ "components/uview-ui/components/u-popup/u-popup").then(__webpack_require__.bind(null, /*! @/components/uview-ui/components/u-popup/u-popup.vue */ 510))
@ -124,6 +124,10 @@ 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.showSpec = false
}
}
@ -169,6 +173,16 @@ Object.defineProperty(exports, "__esModule", {
exports.default = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 30));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 32));
var _tools = __webpack_require__(/*! @/utils/tools */ 41);
var _store = __webpack_require__(/*! @/api/store */ 40);
var _type = __webpack_require__(/*! @/utils/type */ 42);
//
//
//
//
//
//
//
//
//
//
@ -282,57 +296,84 @@ var _default2 = {
},
data: function data() {
return {
page: 1,
status: _type.loadingType.LOADING,
selectIndex: 0,
cateList: [],
goodsList: [],
cateName: '',
numberVal: 1,
showCart: false,
showSpec: false
showSpec: false,
count: 0
};
},
methods: {
changeActive: function changeActive(index) {
var cateList = this.cateList;
this.selectIndex = index;
this.cateName = cateList[index].name;
// this.onRefresh()
this.selectIndex = index;
this.onRefresh();
},
onRefresh: function onRefresh() {
var _this = this;
this.page = 1;
this.goodsList = [];
this.status = _type.loadingType.LOADING;
this.$nextTick(function () {
_this.getGoodsSearchFun();
});
},
getGoodsSearchFun: function getGoodsSearchFun() {
var _this2 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
var page, goodsList, priceSort, saleSort, status, cateList, selectIndex, item, params, data;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
page = _this2.page, goodsList = _this2.goodsList, priceSort = _this2.priceSort, saleSort = _this2.saleSort, status = _this2.status, cateList = _this2.cateList, selectIndex = _this2.selectIndex;
item = cateList[selectIndex];
if (!(item.type == 0)) {
_context.next = 4;
break;
}
return _context.abrupt("return");
case 4:
if (!(status == _type.loadingType.FINISHED)) {
_context.next = 6;
break;
}
return _context.abrupt("return");
case 6:
params = {
category_id: item.id,
page_no: page,
price: priceSort,
sales_sum: saleSort
};
_context.next = 9;
return (0, _tools.loadingFun)(_store.getGoodsSearch, page, goodsList, status, params);
case 9:
data = _context.sent;
console.log(data);
if (data) {
_context.next = 13;
break;
}
return _context.abrupt("return");
case 13:
_this2.page = data.page;
_this2.goodsList = data.dataList;
_this2.status = data.status;
case 16:
case "end":
return _context.stop();
}
}
}, _callee);
}))();
} // let {
// page,
// goodsList,
// priceSort,
// saleSort,
// status,
// cateList,
// selectIndex
// } = this;
// const item = cateList[selectIndex]
// if(item.type == 0) return
// if (status == loadingType.FINISHED) return;
// const params = {
// category_id: item.id,
// page_no: page,
// price: priceSort,
// sales_sum: saleSort
// }
// const data = await loadingFun(getGoodsSearch, page, goodsList, status, params)
// if (!data) return
// this.page = data.page
// this.goodsList = data.dataList
// this.status = data.status
,
},
changeNumber: function changeNumber() {},
// 跳转商品详情页
toShop: function toShop() {
@ -341,6 +382,14 @@ var _default2 = {
});
}
},
computed: {
buyNumber: function buyNumber() {
if (this.count > 0) {
return this.count > 99 ? '99+' : this.count;
}
return '';
}
},
watch: {
list: {
handler: function handler(val) {
@ -351,7 +400,6 @@ var _default2 = {
this.selectIndex = index == -1 ? 0 : index;
this.cateName = val[this.selectIndex].name;
this.cateList = val;
this.cateTwoList = val[this.selectIndex] ? val[this.selectIndex].sons : [];
this.getGoodsSearchFun();
}
}

View File

@ -3,7 +3,7 @@
"u-image": "/components/uview-ui/components/u-image/u-image",
"price-format": "/components/price-format/price-format",
"u-icon": "/components/uview-ui/components/u-icon/u-icon",
"u-badge": "/components/uview-ui/components/u-badge/u-badge",
"loading-footer": "/components/loading-footer/loading-footer",
"u-popup": "/components/uview-ui/components/u-popup/u-popup",
"u-number-box": "/components/uview-ui/components/u-number-box/u-number-box",
"shop-spec": "/components/shop-spec/shop-spec"

View File

@ -1 +1 @@
<view class="cate"><view class="cate-one row"><view class="aside"><scroll-view style="height:100%;" scroll-y="true" scroll-with-animation="true"><view style="padding-bottom:200rpx;"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><block><view data-event-opts="{{[['tap',[['changeActive',[index]]]]]}}" class="{{['one-item sm '+(index==selectIndex?'active bg-white':'')]}}" bindtap="__e"><text class="name">{{item.name}}</text><block wx:if="{{index==selectIndex}}"><view class="active-line bg-default"></view></block></view></block></block></view></scroll-view></view><view class="main"><scroll-view style="height:100%;" scroll-y="true" scroll-with-animation="true" data-event-opts="{{[['scrolltolower',[['getGoodsSearchFun',['$event']]]]]}}" bindscrolltolower="__e"><view class="main-wrap"><view class="goods"><view class="u-m-t-32 bold-600">{{cateName}}</view><view class="u-m-t-32"><block wx:for="{{10}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toShop']]]]}}" class="bg-white br16 row u-col-top u-m-b-24" bindtap="__e"><view><u-image vue-id="{{'0565d282-1-'+index}}" src="{{cloudPath+'img/banner.png'}}" width="136" height="136" border-radius="16" bind:__l="__l"></u-image></view><view class="info"><view><view class="u-line-2 u-p-t-10">葱烩海鲜卷边披萨</view><view class="u-p-t-44 row-between"><view class="row"><view class="primary"><price-format vue-id="{{'0565d282-2-'+index}}" price="{{12.9}}" subscriptSize="{{22}}" firstSize="{{34}}" secondSize="{{26}}" bind:__l="__l"></price-format></view><view class="u-m-l-8"><price-format vue-id="{{'0565d282-3-'+index}}" lineThrough="{{true}}" color="#C0C0C0" subscriptSize="{{22}}" firstSize="{{22}}" secondSize="{{22}}" price="{{16.9}}" bind:__l="__l"></price-format></view></view></view></view><view class="column-end"><u-icon vue-id="{{'0565d282-4-'+index}}" name="plus-circle-fill" color="#254062" size="48" bind:__l="__l"></u-icon></view></view></view></block></view></view></view></scroll-view></view></view><view class="buy mx40 px40 br60 row-between"><view class="row"><view class="u-relative"><u-image vue-id="0565d282-5" src="{{cloudPath+'img/icon_cart.png'}}" width="56" height="56" bind:__l="__l"></u-image><u-badge vue-id="0565d282-6" type="error" count="7" absolute="{{true}}" offset="[0, 0]" bind:__l="__l"></u-badge></view><view class="text-fff u-m-l-32">未选购商品</view></view><view class="text-999">去结算</view></view><u-popup bind:input="__e" vue-id="0565d282-7" mode="bottom" border-radius="{{16}}" value="{{showCart}}" data-event-opts="{{[['^input',[['__set_model',['','showCart','$event',[]]]]]]}}" bind:__l="__l" vue-slots="{{['default']}}"><view style="max-height:800rpx;"><view class="px20 text-999 mt20">温馨提示:请适量点餐</view><view><scroll-view style="height:700rpx;" scroll-y="true" scroll-with-animation="true"><block wx:for="{{20}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="row-start u-row-between u-p-t-20 u-padding-bottom-20 px20"><view class="row-start"><view><u-image vue-id="{{('0565d282-8-'+index)+','+('0565d282-7')}}" src="{{cloudPath+'img/banner.png'}}" width="136" height="136" border-radius="16" bind:__l="__l"></u-image></view><view class="ml20"><view class="u-line-2 u-p-t-10">葱烩海鲜卷边披萨</view><view class="primary u-p-t-40"><price-format vue-id="{{('0565d282-9-'+index)+','+('0565d282-7')}}" price="{{12.9}}" subscriptSize="{{22}}" firstSize="{{34}}" secondSize="{{26}}" bind:__l="__l"></price-format></view></view></view><view><view class="u-text-right"><u-icon class="u-p-t-10" vue-id="{{('0565d282-10-'+index)+','+('0565d282-7')}}" name="trash" size="32" bind:__l="__l"></u-icon></view><view class="u-p-t-30"><u-number-box vue-id="{{('0565d282-11-'+index)+','+('0565d282-7')}}" min="1" value="{{numberVal}}" data-event-opts="{{[['^change',[['changeNumber']]],['^input',[['__set_model',['','numberVal','$event',[]]]]]]}}" bind:change="__e" bind:input="__e" bind:__l="__l"></u-number-box></view></view></view></block></scroll-view></view></view></u-popup><shop-spec bind:close="__e" bind:input="__e" vue-id="0565d282-12" value="{{showSpec}}" data-event-opts="{{[['^close',[['e0']]],['^input',[['__set_model',['','showSpec','$event',[]]]]]]}}" bind:__l="__l"></shop-spec></view>
<view class="cate"><view class="cate-one row"><view class="aside"><scroll-view style="height:100%;" scroll-y="true" scroll-with-animation="true"><view style="padding-bottom:200rpx;"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><block><view data-event-opts="{{[['tap',[['changeActive',[index]]]]]}}" class="{{['one-item sm '+(index==selectIndex?'active bg-white':'')]}}" bindtap="__e"><text class="name">{{item.name}}</text><block wx:if="{{index==selectIndex}}"><view class="active-line bg-default"></view></block></view></block></block></view></scroll-view></view><view class="main"><scroll-view style="height:100%;" scroll-y="true" scroll-with-animation="true" data-event-opts="{{[['scrolltolower',[['getGoodsSearchFun',['$event']]]]]}}" bindscrolltolower="__e"><view class="main-wrap"><view class="goods"><view class="u-p-t-32 bold-600">{{cateName}}</view><view class="u-p-t-32"><block wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><navigator class="bg-white br16 row u-col-top u-m-b-24" hover-class="none" data-event-opts="{{[['tap',[['toShop']]]]}}" bindtap="__e"><view><u-image vue-id="{{'0565d282-1-'+index}}" src="{{item.image}}" width="136" height="136" border-radius="16" bind:__l="__l"></u-image></view><view class="info"><view><view class="u-line-2 u-p-t-10">{{item.name}}</view><view class="u-p-t-20 row-between"><view class="row"><view class="primary"><price-format vue-id="{{'0565d282-2-'+index}}" price="{{item.price}}" subscriptSize="{{22}}" firstSize="{{34}}" secondSize="{{26}}" bind:__l="__l"></price-format></view><view class="u-m-l-8"><price-format vue-id="{{'0565d282-3-'+index}}" price="{{item.market_price}}" lineThrough="{{true}}" color="#C0C0C0" subscriptSize="{{22}}" firstSize="{{22}}" secondSize="{{22}}" bind:__l="__l"></price-format></view></view></view></view><view data-event-opts="{{[['tap',[['e0',['$event']]]]]}}" class="column-end" catchtap="__e"><u-icon vue-id="{{'0565d282-4-'+index}}" name="plus-circle-fill" color="#254062" size="48" bind:__l="__l"></u-icon></view></view></navigator></block><loading-footer vue-id="0565d282-5" status="{{status}}" slot-empty="{{true}}" bind:__l="__l" vue-slots="{{['empty']}}"><view class="column-center" style="padding:200rpx 0 0;" slot="empty"><text class="lighter sm">暂无商品</text></view></loading-footer></view></view></view></scroll-view></view></view><view class="buy mx40 px40 br60 row-between"><view class="row"><view class="u-relative"><u-image vue-id="0565d282-6" src="{{cloudPath+'img/icon_cart.png'}}" width="80" height="80" bind:__l="__l"></u-image><block wx:if="{{buyNumber}}"><view class="u-absolute top-0 right-0 text-fff number u-text-center xxs">{{''+buyNumber+''}}</view></block></view><view class="text-fff u-m-l-32">未选购商品</view></view><view class="text-999">去结算</view></view><u-popup bind:input="__e" vue-id="0565d282-7" mode="bottom" border-radius="{{16}}" value="{{showCart}}" data-event-opts="{{[['^input',[['__set_model',['','showCart','$event',[]]]]]]}}" bind:__l="__l" vue-slots="{{['default']}}"><view style="max-height:800rpx;"><view class="px20 text-999 mt20">温馨提示:请适量点餐</view><view><scroll-view style="height:700rpx;" scroll-y="true" scroll-with-animation="true"><block wx:for="{{20}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="row-start u-row-between u-p-t-20 u-padding-bottom-20 px20"><view class="row-start"><view><u-image vue-id="{{('0565d282-8-'+index)+','+('0565d282-7')}}" src="{{cloudPath+'img/banner.png'}}" width="136" height="136" border-radius="16" bind:__l="__l"></u-image></view><view class="ml20"><view class="u-line-2 u-p-t-10">葱烩海鲜卷边披萨</view><view class="primary u-p-t-40"><price-format vue-id="{{('0565d282-9-'+index)+','+('0565d282-7')}}" price="{{12.9}}" subscriptSize="{{22}}" firstSize="{{34}}" secondSize="{{26}}" bind:__l="__l"></price-format></view></view></view><view><view class="u-text-right"><u-icon class="u-p-t-10" vue-id="{{('0565d282-10-'+index)+','+('0565d282-7')}}" name="trash" size="32" bind:__l="__l"></u-icon></view><view class="u-p-t-30"><u-number-box vue-id="{{('0565d282-11-'+index)+','+('0565d282-7')}}" min="1" value="{{numberVal}}" data-event-opts="{{[['^change',[['changeNumber']]],['^input',[['__set_model',['','numberVal','$event',[]]]]]]}}" bind:change="__e" bind:input="__e" bind:__l="__l"></u-number-box></view></view></view></block></scroll-view></view></view></u-popup><shop-spec bind:close="__e" bind:input="__e" vue-id="0565d282-12" value="{{showSpec}}" data-event-opts="{{[['^close',[['e1']]],['^input',[['__set_model',['','showSpec','$event',[]]]]]]}}" bind:__l="__l"></shop-spec></view>

View File

@ -57,9 +57,6 @@ page {
position: relative;
padding: 0 20rpx;
}
.cate-one .main .main-wrap .goods {
padding-bottom: 200rpx;
}
.cate-one .main .main-wrap .goods .info {
width: 100%;
display: flex;
@ -74,4 +71,11 @@ page {
height: 100rpx;
background-color: #212526;
}
.number {
background-color: #FF2C3C;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 100%;
}