2022-05-15 01:46:26 +08:00
|
|
|
|
<template>
|
2023-03-03 00:01:15 +08:00
|
|
|
|
<view class="padding-bottom-with-bar">
|
2022-05-15 01:46:26 +08:00
|
|
|
|
<!-- 顶部操作条 -->
|
2022-05-24 18:03:36 +08:00
|
|
|
|
<cu-custom :bgColor="'bg-main-color'">
|
2022-05-15 01:46:26 +08:00
|
|
|
|
<block slot="content">商品管理</block>
|
|
|
|
|
|
</cu-custom>
|
2022-06-17 13:53:52 +08:00
|
|
|
|
<view>
|
2022-05-24 18:03:36 +08:00
|
|
|
|
<!-- 展示商品/服务tab -->
|
|
|
|
|
|
<view class="sticky-bar" :style="[{top: stickyTop + 'px'}]">
|
|
|
|
|
|
<!-- tab header -->
|
|
|
|
|
|
<scroll-view scroll-x class="bg-white nav text-center" :scroll-with-animation="true"
|
|
|
|
|
|
:scroll-left="scrollLeft">
|
|
|
|
|
|
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''" v-for="(item,index) in tabHeaders"
|
|
|
|
|
|
:key="index" @tap="tabSelect" :data-id="index">
|
|
|
|
|
|
{{item.name}}
|
2022-05-15 01:46:26 +08:00
|
|
|
|
</view>
|
2022-05-24 18:03:36 +08:00
|
|
|
|
</scroll-view>
|
|
|
|
|
|
<!-- 条件筛选栏 -->
|
|
|
|
|
|
<view class="padding bg-white solid-bottom">
|
|
|
|
|
|
<view class="flex justify-between align-center">
|
|
|
|
|
|
<input class="line-input radius-input" v-model="formData.keywords" placeholder="请输入关键字"></input>
|
|
|
|
|
|
<button class="cu-btn bg-main-color shadow-blur">搜索</button>
|
2022-05-15 01:46:26 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-05-24 18:03:36 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<!-- tab content -->
|
|
|
|
|
|
<view>
|
2022-07-04 17:00:52 +08:00
|
|
|
|
<view class="padding bg-white margin-top-sm margin-lr-sm name-card" v-for="(good, index) in goodsList" v-if="good.status !== 2">
|
2022-05-24 18:03:36 +08:00
|
|
|
|
<view class="flex justify-start">
|
2022-06-17 13:53:52 +08:00
|
|
|
|
<view class="cu-avatar xxl-view" :style="'background-image:url(' + good.goodsImgUrl + ');'"></view>
|
2022-05-24 18:03:36 +08:00
|
|
|
|
<view class="margin-left-sm flex-column-between">
|
2022-06-17 13:53:52 +08:00
|
|
|
|
<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>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
<!-- <view class="text-gray">团购日期:</view> -->
|
|
|
|
|
|
<!-- <uni-datetime-picker :value="good.groupBuyDate" type="datetimerange" rangeSeparator="至" @change="changeGroupBuyDate($event, good)"/> -->
|
2022-05-24 18:03:36 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="flex justify-end oper-bar">
|
|
|
|
|
|
<view class="text-center margin-right-sm" v-if="good.isGoldenServ">
|
|
|
|
|
|
<view class="cuIcon-selectionfill text-orange"></view>
|
|
|
|
|
|
<view class="text-xs">金牌服务</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<button class="cu-btn line-main-color margin-right-xs margin-top-sm" @click="addEditGood(good)">编辑</button>
|
2022-06-17 13:53:52 +08:00
|
|
|
|
<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>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
<!-- <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> -->
|
2023-04-01 18:56:30 +08:00
|
|
|
|
<!-- <button class="cu-btn line-red shadow-blur margin-right-xs margin-top-sm" @click="delGood(good)">删除</button> -->
|
2022-05-24 18:03:36 +08:00
|
|
|
|
</view>
|
2022-05-15 01:46:26 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-06-17 13:53:52 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<load-status-bar ref="loadStatusBar" @loadMore="loadProductPage"></load-status-bar>
|
2023-03-03 00:01:15 +08:00
|
|
|
|
<view class="margin-bottom-with-bar"></view>
|
2022-06-17 13:53:52 +08:00
|
|
|
|
<!-- 底部操作栏 -->
|
|
|
|
|
|
<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>
|
2022-07-19 11:34:36 +08:00
|
|
|
|
<button class="cu-btn bg-main-color lg shadow-blur" disabled type="">优惠券</button>
|
|
|
|
|
|
<button class="cu-btn bg-main-color lg shadow-blur" disabled type="">暂停售卖</button>
|
|
|
|
|
|
<!-- <button class="cu-btn bg-main-color lg shadow-blur margin-right-xs" data-modal="communityModal" @tap="showModal">社区</button> -->
|
|
|
|
|
|
<button class="cu-btn bg-main-color lg shadow-blur margin-right-xs" disabled type="">社区</button>
|
2022-05-15 01:46:26 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<!-- 模态框 -->
|
|
|
|
|
|
<view class="cu-modal" :class="communityModal?'show':''">
|
|
|
|
|
|
<view class="cu-dialog">
|
|
|
|
|
|
<view class="cu-bar bg-white justify-end solid-bottom">
|
|
|
|
|
|
<view class="content">社区入驻</view>
|
|
|
|
|
|
<view class="action" data-modal="communityModal" @tap="hideModal">
|
|
|
|
|
|
<text class="cuIcon-close text-red"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="padding bg-white text-left">
|
|
|
|
|
|
<view>你可选择一个物业/楼盘作为入驻的社区,则你所有服务或商品将展示在该社区。社区服务属于一公里范围便利服务内容,你必须选择你驻点所在地入驻,以便提供快捷便利的社区服务。</view>
|
|
|
|
|
|
<view class="margin-top">社区入驻:</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<my-uni-combox class="inline-combox margin-right-xs margin-bottom-xs" :candidates="provinceList" placeholder="省"
|
|
|
|
|
|
v-model="selectedCommunity.province" @input="changeCommunity($event, 0)"></my-uni-combox>
|
|
|
|
|
|
<my-uni-combox class="inline-combox margin-right-xs margin-bottom-xs" :candidates="cityList" placeholder="市"
|
|
|
|
|
|
v-model="selectedCommunity.city" @input="changeCommunity($event, 0)"></my-uni-combox>
|
|
|
|
|
|
<my-uni-combox class="inline-combox margin-right-xs margin-bottom-xs" :candidates="districtList" placeholder="区"
|
|
|
|
|
|
v-model="selectedCommunity.district" @input="changeCommunity($event, 0)"></my-uni-combox>
|
|
|
|
|
|
<my-uni-combox class="inline-combox margin-bottom-xs" :candidates="streetList" placeholder="街道"
|
|
|
|
|
|
v-model="selectedCommunity.street" @input="changeCommunity($event, 0)"></my-uni-combox>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<my-uni-combox :candidates="communityList" placeholder="社区/物业选择"
|
|
|
|
|
|
v-model="selectedCommunity.community" @input="changeCommunity($event, 0)"></my-uni-combox>
|
|
|
|
|
|
<view class="margin-top text-gray">注:未创建的社区可在商城端创建再行入驻</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="cu-bar bg-white solid-top">
|
|
|
|
|
|
<view class="action margin-0 flex-sub text-black" data-modal="communityModal" @tap="hideModal">新增社区上架</view>
|
|
|
|
|
|
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="communityModal" @tap="hideModal" @click="comfirmCommunity">确认入驻社区</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
|
2022-06-17 13:53:52 +08:00
|
|
|
|
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
|
2022-05-15 01:46:26 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
2022-05-24 18:03:36 +08:00
|
|
|
|
name: 'goods-manage',
|
2022-05-15 01:46:26 +08:00
|
|
|
|
components: {
|
2022-06-17 13:53:52 +08:00
|
|
|
|
myUniCombox,
|
|
|
|
|
|
loadStatusBar
|
2022-05-15 01:46:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
tabCur: 0,
|
|
|
|
|
|
tabHeaders: [{
|
|
|
|
|
|
code: 0,
|
|
|
|
|
|
name: '服务商品'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
code: 1,
|
|
|
|
|
|
name: '配件商品'
|
|
|
|
|
|
}],
|
|
|
|
|
|
scrollLeft: 0,
|
|
|
|
|
|
stickyTop: this.CustomBar,
|
|
|
|
|
|
formData: {
|
|
|
|
|
|
keywords: ''
|
|
|
|
|
|
},
|
2022-06-17 13:53:52 +08:00
|
|
|
|
goodsList: [],
|
|
|
|
|
|
pageNum: 0,
|
|
|
|
|
|
pageSize: 0,
|
2022-05-15 01:46:26 +08:00
|
|
|
|
datetimerange: ["", ""],
|
|
|
|
|
|
communityModal: false,
|
|
|
|
|
|
provinceList: [],
|
|
|
|
|
|
cityList: [],
|
|
|
|
|
|
districtList: [],
|
|
|
|
|
|
streetList: [],
|
|
|
|
|
|
communityList: {},
|
|
|
|
|
|
selectedCommunity: {
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-05-24 18:03:36 +08:00
|
|
|
|
onReady() {
|
2022-05-15 01:46:26 +08:00
|
|
|
|
this.loadData();
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2022-06-17 13:53:52 +08:00
|
|
|
|
loadData() {
|
2022-07-09 18:41:34 +08:00
|
|
|
|
this.pageNum = this.$globalData.initPageNum;
|
2022-06-17 13:53:52 +08:00
|
|
|
|
this.pageSize = this.$globalData.initPageSize;
|
|
|
|
|
|
this.loadProductPage();
|
|
|
|
|
|
},
|
|
|
|
|
|
resetData() {
|
2022-07-09 18:41:34 +08:00
|
|
|
|
this.pageNum = this.$globalData.initPageNum;
|
|
|
|
|
|
this.pageSize = this.$globalData.initPageSize;
|
2022-06-17 13:53:52 +08:00
|
|
|
|
this.goodsList = [];
|
|
|
|
|
|
},
|
|
|
|
|
|
reloadData() {
|
|
|
|
|
|
this.resetData();
|
|
|
|
|
|
this.loadProductPage();
|
|
|
|
|
|
},
|
|
|
|
|
|
async loadProductPage(params = {}) {
|
|
|
|
|
|
params.pageNum = this.pageNum;
|
|
|
|
|
|
params.pageSize = this.pageSize;
|
2022-07-04 17:00:52 +08:00
|
|
|
|
params.workerId = this.$request.getCurUserInfo().workerId;
|
2022-06-17 13:53:52 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
2022-05-24 18:03:36 +08:00
|
|
|
|
},
|
|
|
|
|
|
async loadAreaObj() {
|
2022-05-15 01:46:26 +08:00
|
|
|
|
this.areaObj = await this.$api.data('areaObj');
|
|
|
|
|
|
this.provinceList = this.areaObj.provinceList;
|
|
|
|
|
|
this.cityList = this.areaObj.cityList;
|
|
|
|
|
|
this.districtList = this.areaObj.districtList;
|
|
|
|
|
|
this.streetList = this.areaObj.streetList;
|
2022-05-24 18:03:36 +08:00
|
|
|
|
this.communityList = this.areaObj.communityList;
|
2022-05-15 01:46:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
tabSelect(e) {
|
|
|
|
|
|
this.tabCur = e.currentTarget.dataset.id;
|
|
|
|
|
|
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
|
|
|
|
|
|
},
|
|
|
|
|
|
showModal(e) {
|
2022-05-24 18:03:36 +08:00
|
|
|
|
let modalName = e.currentTarget.dataset.modal;
|
|
|
|
|
|
this[modalName] = true;
|
|
|
|
|
|
if (modalName === 'communityModal') {
|
|
|
|
|
|
this.loadAreaObj();
|
|
|
|
|
|
}
|
|
|
|
|
|
this[modalName] = true;
|
2022-05-15 01:46:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
hideModal(e) {
|
|
|
|
|
|
this[e.currentTarget.dataset.modal] = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
changeGroupBuyDate(value, good) {
|
|
|
|
|
|
console.log(value)
|
|
|
|
|
|
},
|
|
|
|
|
|
editGood(good) {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
2022-06-17 13:53:52 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
2022-05-15 01:46:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
copyGood(good) {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
2022-06-17 13:53:52 +08:00
|
|
|
|
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();
|
2022-05-15 01:46:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
changeCommunity(selectObj, communityCode) {
|
|
|
|
|
|
// TODO: 不同的code加载不同的数据
|
|
|
|
|
|
console.log(selectObj)
|
|
|
|
|
|
},
|
|
|
|
|
|
comfirmCommunity() {
|
|
|
|
|
|
|
2022-05-16 22:52:59 +08:00
|
|
|
|
},
|
|
|
|
|
|
addEditGood(servItem) {
|
|
|
|
|
|
let params = '';
|
|
|
|
|
|
if (servItem != null) {
|
2023-02-12 04:15:15 +08:00
|
|
|
|
params = '?goodId=' + servItem.goodsId
|
2022-05-16 22:52:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: '/pages/my/new-serv' + params
|
|
|
|
|
|
})
|
2022-05-15 01:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.nav .cu-item {
|
|
|
|
|
|
width: 50%;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.line-input {
|
|
|
|
|
|
width: 77%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.xxl-view {
|
|
|
|
|
|
min-width: 200rpx;
|
|
|
|
|
|
min-height: 200rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.name-card {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.name-card .oper-bar {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 20rpx;
|
|
|
|
|
|
right: 20rpx;
|
|
|
|
|
|
font-size: 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/deep/ .uni-date__x-input {
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.inline-combox {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
width: calc((100vw - 158rpx)/4);
|
2022-05-24 18:03:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fixed-bottom-bar-with-bar {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
bottom: calc(100rpx + constant(safe-area-inset-bottom) / 2);
|
|
|
|
|
|
bottom: calc(100rpx + env(safe-area-inset-bottom) / 2);
|
|
|
|
|
|
z-index: 98;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-17 13:53:52 +08:00
|
|
|
|
.padding-bottom-with-bar {
|
2023-03-03 00:01:15 +08:00
|
|
|
|
padding-bottom: calc((100rpx + constant(safe-area-inset-bottom) / 2));
|
|
|
|
|
|
padding-bottom: calc((100rpx + env(safe-area-inset-bottom) / 2));
|
2022-06-17 13:53:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.cu-list.menu-avatar>.cu-item .content .cu-tag.sm {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
|
height: 28rpx;
|
|
|
|
|
|
font-size: 16rpx;
|
|
|
|
|
|
line-height: 32rpx;
|
2022-05-15 01:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|