分页问题修复;供应链服务列表及状态修改后台接口对接
This commit is contained in:
parent
c300ec60d9
commit
abd92a200c
|
|
@ -2,5 +2,5 @@ export default {
|
|||
deptId: 101,
|
||||
from: 'server',
|
||||
initPageNum: 1,
|
||||
initPageSize: 50
|
||||
initPageSize: 20
|
||||
}
|
||||
|
|
@ -434,4 +434,24 @@ export default {
|
|||
})
|
||||
return res[1].data;
|
||||
},
|
||||
async qryProductPage(params = {}) {
|
||||
let res = await uni.request({
|
||||
url: '/goods/goods/list',
|
||||
method: 'POST',
|
||||
data: params,
|
||||
header: {
|
||||
pageNum: params.pageNum,
|
||||
pageSize: params.pageSize
|
||||
}
|
||||
})
|
||||
return res[1].data;
|
||||
},
|
||||
async updateGoodsStatus(params = {}) {
|
||||
let res = await uni.request({
|
||||
url: '/goods/goods/app/updateStatus',
|
||||
method: 'POST',
|
||||
data: params
|
||||
})
|
||||
return res[1].data;
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="margin-bottom-lg margin-top-sm">
|
||||
<view v-if="hasMoreData" class="text-center bg-main-color light padding-tb-sm">
|
||||
<view v-if="hasMoreData" class="text-center bg-main-color light padding-tb-sm" @click="reqMoreData">
|
||||
<text class="margin-right-xs">查看更多</text>
|
||||
<text class="text-bold cuIcon-unfold"></text>
|
||||
</view>
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'load-status-bar',
|
||||
emits: ['loadMore'],
|
||||
data() {
|
||||
return {
|
||||
loadMoreStatus: '',
|
||||
|
|
@ -35,6 +36,9 @@
|
|||
showLoadErr() {
|
||||
this.loadMoreStatus = 'erro bg-red';
|
||||
this.hasMoreData = false;
|
||||
},
|
||||
reqMoreData() {
|
||||
this.$emit('loadMore')
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,27 @@
|
|||
<view class="margin-left-sm product-content">
|
||||
<view>
|
||||
<view class="text-black">{{product.goodsName}}</view>
|
||||
<view class="text-sm" v-if="ifShowComments">{{product.comments}}</view>
|
||||
<view class="text-sm" v-if="ifShowComments">{{product.remark}}</view>
|
||||
</view>
|
||||
<view class="flex justify-between align-center">
|
||||
<view class="flex justify-start align-center" v-if="product.payMoney">
|
||||
<text class="text-price text-red text-bold text-xl">{{product.payMoney}}</text>
|
||||
</view>
|
||||
<view class="flex justify-start align-center" v-else>
|
||||
<text class="text-price text-red text-bold text-xl">{{product.salePrice}}</text>
|
||||
<text class="text-del">¥{{product.price}}</text>
|
||||
<view v-else-if="product.discountPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-xl">{{product.discountPrice}}</text>
|
||||
<text class="text-del" v-if="product.goodsPrice">¥{{product.goodsPrice}}</text>
|
||||
</view>
|
||||
<view v-else-if="product.goodsPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-xl">{{product.goodsPrice}}</text>
|
||||
</view>
|
||||
<view v-else-if="product.goodsStandardList && product.goodsStandardList.length > 0">
|
||||
<view v-if="product.goodsStandardList[0].discountPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].discountPrice}}</text>
|
||||
<text class="text-del" v-if="product.goodsPrice">¥{{product.goodsStandardList[0].goodsPrice}}</text>
|
||||
</view>
|
||||
<view v-else-if="product.goodsStandardList[0].goodsPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].goodsPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding-xs" v-if="product.type">
|
||||
<view class='cu-tag light bg-blue'>{{product.type}}</view>
|
||||
|
|
@ -28,7 +40,9 @@
|
|||
服务区域
|
||||
</view>
|
||||
</view>
|
||||
<text class="margin-lr-xs text-sm" v-if="ifShowServArea">{{product.servArea}}</text>
|
||||
<text v-for="(item,index) in product.goodsAreaList" v-if="ifShowServArea">
|
||||
<text class="margin-lr-xs text-sm">{{item.areaName}}<text v-if="index != product.goodsAreaList.length - 1">,</text></text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<load-status-bar class="margin-bottom-with-bar" ref="loadStatusBar"></load-status-bar>
|
||||
<load-status-bar class="margin-bottom-with-bar" ref="loadStatusBar" @loadMore="loadTeamPage"></load-status-bar>
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="cu-bar bg-white tabbar border shop fixed-bottom-bar">
|
||||
<view class="left-grid text-center" data-modal="takeRateSet" @click="showModalByRef('setTakeRateModal')">
|
||||
|
|
@ -78,6 +78,7 @@
|
|||
async loadData() {
|
||||
// this.myTeamInfo = await this.$api.data('myTeamInfo');
|
||||
// this.members = this.myTeamInfo.members;
|
||||
this.pageSize = this.$globalData.initPageSize;
|
||||
this.curUserInfo = this.$request.getCurUserInfo();
|
||||
this.loadTeamPage();
|
||||
},
|
||||
|
|
@ -88,7 +89,7 @@
|
|||
},
|
||||
async loadTeamPage(params = {}) {
|
||||
params.pageNum = this.pageNum;
|
||||
params.pageSize = this.$globalData.pageSize;
|
||||
params.pageSize = this.pageSize;
|
||||
this.$refs.loadStatusBar.showLoading();
|
||||
try {
|
||||
let res = await this.$request.getTeamPage(params);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="padding-bottom-with-bar margin-bottom-with-bar">
|
||||
<!-- 顶部操作条 -->
|
||||
<cu-custom :bgColor="'bg-main-color'">
|
||||
<block slot="content">商品管理</block>
|
||||
</cu-custom>
|
||||
<view class="margin-bottom-with-2bar">
|
||||
<view>
|
||||
<!-- 展示商品/服务tab -->
|
||||
<view class="sticky-bar" :style="[{top: stickyTop + 'px'}]">
|
||||
<!-- tab header -->
|
||||
|
|
@ -27,12 +27,32 @@
|
|||
<view>
|
||||
<view class="padding bg-white margin-top-sm margin-lr-sm name-card" v-for="(good, index) in goodsList">
|
||||
<view class="flex justify-start">
|
||||
<view class="cu-avatar xxl-view" :style="'background-image:url(' + good.picUrl + ');'"></view>
|
||||
<view class="cu-avatar xxl-view" :style="'background-image:url(' + good.goodsImgUrl + ');'"></view>
|
||||
<view class="margin-left-sm flex-column-between">
|
||||
<view class="text-black text-cut" style="width: 330rpx;">{{good.name}}</view>
|
||||
<view class="text-price text-red text-lg">{{good.salePrice}}</view>
|
||||
<view class="text-gray">{{good.comments}}</view>
|
||||
<view class="text-gray">服务城市:{{good.servArea}}</view>
|
||||
<view class="text-black text-cut" style="width: 330rpx;">{{good.goodsName}}</view>
|
||||
<view>
|
||||
<view v-if="good.goodsStandardList[0].discountPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-lg">{{good.goodsStandardList[0].discountPrice}}</text>
|
||||
<text class="text-del" v-if="good.goodsPrice">¥{{good.goodsStandardList[0].goodsPrice}}</text>
|
||||
</view>
|
||||
<view v-else-if="good.goodsStandardList[0].goodsPrice" class="flex justify-start align-center">
|
||||
<text class="text-price text-red text-bold text-lg">{{good.goodsStandardList[0].goodsPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-gray" v-if="good.remark">{{good.remark}}</view>
|
||||
<view v-if="good.goodsAreaList && good.goodsAreaList.length">
|
||||
<view class="cu-capsule">
|
||||
<view class='cu-tag bg-main-color sm'>
|
||||
<text class='cuIcon-locationfill'></text>
|
||||
</view>
|
||||
<view class="cu-tag line-main-color sm">
|
||||
服务区域
|
||||
</view>
|
||||
</view>
|
||||
<text v-for="(item,index) in good.goodsAreaList">
|
||||
<text class="margin-lr-xs text-sm">{{item.areaName}}<text v-if="index != good.goodsAreaList.length - 1">,</text></text>
|
||||
</text>
|
||||
</view>
|
||||
<view class="text-gray">团购日期:</view>
|
||||
<uni-datetime-picker :value="good.groupBuyDate" type="datetimerange" rangeSeparator="至" @change="changeGroupBuyDate($event, good)"/>
|
||||
</view>
|
||||
|
|
@ -45,13 +65,16 @@
|
|||
</view>
|
||||
<view>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" @click="addEditGood(good)">编辑</button>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" @click="offGood(good)">下架</button>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" v-if="good.status === 0" @click="offGood(good)">下架</button>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" v-if="good.status === 1" @click="onGood(good)">上架</button>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" @click="copyGood(good)">复制</button>
|
||||
<button class="cu-btn line-main-color margin-right-xs margin-top-sm">优惠券</button>
|
||||
<button class="cu-btn line-red shadow-blur margin-right-xs margin-top-sm" @click="delGood(good)">删除</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<load-status-bar ref="loadStatusBar" @loadMore="loadProductPage"></load-status-bar>
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="padding-tb-sm flex justify-around padding-tb-sm fixed-bottom-bar-with-bar bg-back">
|
||||
<button class="cu-btn bg-main-color lg shadow-blur margin-left-xs" @click="addEditGood(null)">新增服务</button>
|
||||
|
|
@ -59,7 +82,6 @@
|
|||
<button class="cu-btn bg-main-color lg shadow-blur">暂停售卖</button>
|
||||
<button class="cu-btn bg-main-color lg shadow-blur margin-right-xs" data-modal="communityModal" @tap="showModal">社区</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 模态框 -->
|
||||
<view class="cu-modal" :class="communityModal?'show':''">
|
||||
<view class="cu-dialog">
|
||||
|
|
@ -97,11 +119,13 @@
|
|||
|
||||
<script>
|
||||
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
|
||||
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
|
||||
|
||||
export default {
|
||||
name: 'goods-manage',
|
||||
components: {
|
||||
myUniCombox
|
||||
myUniCombox,
|
||||
loadStatusBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -119,6 +143,8 @@
|
|||
keywords: ''
|
||||
},
|
||||
goodsList: [],
|
||||
pageNum: 0,
|
||||
pageSize: 0,
|
||||
datetimerange: ["", ""],
|
||||
communityModal: false,
|
||||
provinceList: [],
|
||||
|
|
@ -134,8 +160,38 @@
|
|||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
async loadData() {
|
||||
this.goodsList = await this.$api.data('goodsList');
|
||||
loadData() {
|
||||
this.pageSize = this.$globalData.initPageSize;
|
||||
this.loadProductPage();
|
||||
},
|
||||
resetData() {
|
||||
this.pageNum = 0;
|
||||
this.goodsList = [];
|
||||
},
|
||||
reloadData() {
|
||||
this.resetData();
|
||||
this.loadProductPage();
|
||||
},
|
||||
async loadProductPage(params = {}) {
|
||||
params.pageNum = this.pageNum;
|
||||
params.pageSize = this.pageSize;
|
||||
this.$refs.loadStatusBar.showLoading();
|
||||
try {
|
||||
let res = await this.$request.qryProductPage(params);
|
||||
let rowsLength = res.rows.length;
|
||||
if (rowsLength > 0) {
|
||||
this.goodsList = this.goodsList.concat(res.rows);
|
||||
this.pageNum++;
|
||||
if (rowsLength === this.pageSize) {
|
||||
this.$refs.loadStatusBar.showLoadMore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.$refs.loadStatusBar.showLoadOver();
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
this.$refs.loadStatusBar.showLoadErr();
|
||||
}
|
||||
},
|
||||
async loadAreaObj() {
|
||||
this.areaObj = await this.$api.data('areaObj');
|
||||
|
|
@ -166,14 +222,50 @@
|
|||
editGood(good) {
|
||||
|
||||
},
|
||||
offGood(good) {
|
||||
|
||||
async offGood(good) {
|
||||
let params = {
|
||||
goodsId: good.goodsId,
|
||||
status: 1
|
||||
}
|
||||
let res = await this.$request.updateGoodsStatus(params);
|
||||
if (res && res.code === 0) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '下架成功'
|
||||
})
|
||||
good.status = 1;
|
||||
}
|
||||
},
|
||||
async onGood(good) {
|
||||
let params = {
|
||||
goodsId: good.goodsId,
|
||||
status: 0
|
||||
}
|
||||
let res = await this.$request.updateGoodsStatus(params);
|
||||
if (res && res.code === 0) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '上架成功'
|
||||
})
|
||||
good.status = 0;
|
||||
}
|
||||
},
|
||||
copyGood(good) {
|
||||
|
||||
},
|
||||
delGood(good) {
|
||||
|
||||
async delGood(good) {
|
||||
let params = {
|
||||
goodsId: good.goodsId,
|
||||
status: 2
|
||||
}
|
||||
let res = await this.$request.updateGoodsStatus(params);
|
||||
if (res && res.code === 0) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
title: '删除成功'
|
||||
})
|
||||
}
|
||||
this.reloadData();
|
||||
},
|
||||
changeCommunity(selectObj, communityCode) {
|
||||
// TODO: 不同的code加载不同的数据
|
||||
|
|
@ -238,8 +330,16 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.margin-bottom-with-2bar {
|
||||
margin-bottom: calc((100rpx + constant(safe-area-inset-bottom) / 2) * 2);
|
||||
margin-bottom: calc((100rpx + env(safe-area-inset-bottom) / 2) * 2);
|
||||
.padding-bottom-with-bar {
|
||||
padding-bottom: calc((50rpx + constant(safe-area-inset-bottom) / 2));
|
||||
padding-bottom: calc((50rpx + env(safe-area-inset-bottom) / 2));
|
||||
}
|
||||
|
||||
.cu-list.menu-avatar>.cu-item .content .cu-tag.sm {
|
||||
display: inline-block;
|
||||
margin-left: 0;
|
||||
height: 28rpx;
|
||||
font-size: 16rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@
|
|||
<text>备注:{{order.remark}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<load-status-bar ref="loadStatusBar"></load-status-bar>
|
||||
<load-status-bar ref="loadStatusBar" @loadMore="loadMasterOrderPage"></load-status-bar>
|
||||
<!-- 模态框 -->
|
||||
<time-arrange :show="showTimeArrangeModal" :data="curOrder" :curDate="curDate" @showArrangeFailTime="showArrangeFailTime" @editServTime="editServTime"></time-arrange>
|
||||
<time-arrange-fail :show="showArrangeFailTimeModal" :data="curOrder"></time-arrange-fail>
|
||||
|
|
|
|||
Loading…
Reference in New Issue