|
@@ -21,31 +21,42 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="list">
|
|
<view class="list">
|
|
|
- <view class="product_item" v-for="(item, index) in productList" :key="index">
|
|
|
|
|
- <view class="details">
|
|
|
|
|
- <view class="img">
|
|
|
|
|
- <image :src="item.productImage" mode=""></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="data">
|
|
|
|
|
- <span>{{ item.productName }}</span>
|
|
|
|
|
- <!-- <span>售卖时间:{{item.time}}</span> -->
|
|
|
|
|
- <!-- <view class="repertory">售卖时间:{{ item.saleStartDate }} - {{ item.saleEndDate }}</view> -->
|
|
|
|
|
- <view class="price">
|
|
|
|
|
- <span style="font-size: 22rpx;margin: 0px;">¥</span>{{ item.soldPrice }}
|
|
|
|
|
- <span style="color:#999 ;font-size: 22rpx; text-decoration: line-through;">¥{{ item.price }}</span>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="ticket" v-if="item.isRights == 1">
|
|
|
|
|
- <image src="/static/product/ticket.png" mode=""></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="tag" @click.stop="select(item)">
|
|
|
|
|
- <!-- <span>组合套餐</span>
|
|
|
|
|
- <span class="frame"></span> -->
|
|
|
|
|
- <image src="/static/product/select.png" mode="" v-if="item.select"></image>
|
|
|
|
|
- <image src="/static/product/round.png" mode="" v-else></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <ListScrollView
|
|
|
|
|
+ ref="listScroll"
|
|
|
|
|
+ :api="api"
|
|
|
|
|
+ :init="initParams"
|
|
|
|
|
+ :pageSize="10"
|
|
|
|
|
+ :keyName="'records'"
|
|
|
|
|
+ @afterFetch="afterFetch"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template v-slot:list="{ data }">
|
|
|
|
|
+ <view class="product_item" v-for="(item, index) in data" :key="index">
|
|
|
|
|
+ <view class="details">
|
|
|
|
|
+ <view class="img">
|
|
|
|
|
+ <image :src="item.productImage" mode=""></image>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="data">
|
|
|
|
|
+ <span>{{ item.productName }}</span>
|
|
|
|
|
+ <!-- <span>售卖时间:{{item.time}}</span> -->
|
|
|
|
|
+ <!-- <view class="repertory">售卖时间:{{ item.saleStartDate }} - {{ item.saleEndDate }}</view> -->
|
|
|
|
|
+ <view class="price">
|
|
|
|
|
+ <span style="font-size: 22rpx;margin: 0px;">¥</span>{{ item.soldPrice }}
|
|
|
|
|
+ <span style="color:#999 ;font-size: 22rpx; text-decoration: line-through;">¥{{ item.price }}</span>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="ticket" v-if="item.isRights == 1">
|
|
|
|
|
+ <image src="/static/product/ticket.png" mode=""></image>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="tag" @click.stop="select(item)">
|
|
|
|
|
+ <!-- <span>组合套餐</span>
|
|
|
|
|
+ <span class="frame"></span> -->
|
|
|
|
|
+ <image src="/static/product/select.png" mode="" v-if="item.select"></image>
|
|
|
|
|
+ <image src="/static/product/round.png" mode="" v-else></image>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </ListScrollView>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="creat">
|
|
<view class="creat">
|
|
|
<view class="operate">
|
|
<view class="operate">
|
|
@@ -63,7 +74,11 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import configService from '../../common/service/config.service'
|
|
import configService from '../../common/service/config.service'
|
|
|
|
|
+ import ListScrollView from '@/components/list-scroll-view/index.vue';
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ ListScrollView
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
isManage: false,
|
|
isManage: false,
|
|
@@ -74,7 +89,11 @@
|
|
|
productName: '',
|
|
productName: '',
|
|
|
productList: [],
|
|
productList: [],
|
|
|
merchantId: '',
|
|
merchantId: '',
|
|
|
- tabIndex: 1
|
|
|
|
|
|
|
+ api: {
|
|
|
|
|
+ url: '/app/product/purveyor/list',
|
|
|
|
|
+ method: 'GET'
|
|
|
|
|
+ },
|
|
|
|
|
+ initParams: {},
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -98,64 +117,76 @@
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
add() {
|
|
add() {
|
|
|
- if (this.productList.filter(e => e.select).map(e => e.productId).length > 0) {
|
|
|
|
|
- let ids = this.productList.filter(e => e.select).map(e => e.productId).join(',')
|
|
|
|
|
-
|
|
|
|
|
- this.$http.get("/app/product/addPurveyorProduct?ids=" + ids + '&merchantId=' + this.merchantId)
|
|
|
|
|
- .then(res => {
|
|
|
|
|
- if (res.data.code == 200) {
|
|
|
|
|
- this.$tip.success(res.data.message || '添加成功');
|
|
|
|
|
- this.back()
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- icon:'error',
|
|
|
|
|
- title:'不能重复添加'
|
|
|
|
|
- })
|
|
|
|
|
- // this.$tip.error(res.data.message);
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$tip.alert('请选择品牌标品');
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const dataList = this.$refs.listScroll?.dataList || [];
|
|
|
|
|
+ const selectedProducts = dataList.filter(e => e.select);
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedProducts.length > 0) {
|
|
|
|
|
+ let ids = selectedProducts.map(e => e.productId).join(',');
|
|
|
|
|
+
|
|
|
|
|
+ this.$http.get("/app/product/addPurveyorProduct?ids=" + ids + '&merchantId=' + this.merchantId)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
|
+ this.$tip.success(res.data.message || '添加成功');
|
|
|
|
|
+ this.back()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon:'error',
|
|
|
|
|
+ title:'不能重复添加'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$tip.alert('请选择品牌标品');
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
select(item) {
|
|
select(item) {
|
|
|
item.select = !item.select
|
|
item.select = !item.select
|
|
|
},
|
|
},
|
|
|
- //全选
|
|
|
|
|
|
|
+ // 全选
|
|
|
allSelect() {
|
|
allSelect() {
|
|
|
- if (this.isAll) {
|
|
|
|
|
- this.isAll = false
|
|
|
|
|
- this.productList.forEach(item => {
|
|
|
|
|
- item.select = false
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.isAll = true
|
|
|
|
|
- this.productList.forEach(item => {
|
|
|
|
|
- item.select = true
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.isAll) {
|
|
|
|
|
+ this.isAll = false;
|
|
|
|
|
+ // 更新ListScrollView组件内部的数据列表
|
|
|
|
|
+ if (this.$refs.listScroll && this.$refs.listScroll.dataList) {
|
|
|
|
|
+ this.$refs.listScroll.dataList.forEach(item => {
|
|
|
|
|
+ item.select = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.isAll = true;
|
|
|
|
|
+ // 更新ListScrollView组件内部的数据列表
|
|
|
|
|
+ if (this.$refs.listScroll && this.$refs.listScroll.dataList) {
|
|
|
|
|
+ this.$refs.listScroll.dataList.forEach(item => {
|
|
|
|
|
+ item.select = true;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
getProductList() {
|
|
getProductList() {
|
|
|
- this.$http.get("/app/product/purveyor/list?merchantId=" + this.merchantId + "&productStatus=" + this
|
|
|
|
|
- .productStatus +
|
|
|
|
|
- '&productName=' + this.productName, )
|
|
|
|
|
- .then(res => {
|
|
|
|
|
- if (res.data.code == 200) {
|
|
|
|
|
- res.data.result.records.forEach((item) => {
|
|
|
|
|
- item.select = false;
|
|
|
|
|
- // item.saleEndDate = item.saleEndDate.includes('00:00:00') ? item.saleEndDate.slice(0, 10) : item
|
|
|
|
|
- // .saleEndDate
|
|
|
|
|
- // item.saleStartDate = item.saleStartDate.includes('00:00:00') ? item.saleStartDate.slice(0, 10) :
|
|
|
|
|
- // item.saleStartDate
|
|
|
|
|
- // item.productImage = configService.apiUrl + '/' + item.productImage
|
|
|
|
|
- })
|
|
|
|
|
- this.productList = res.data.result.records
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // 更新初始化参数
|
|
|
|
|
+ this.initParams = {
|
|
|
|
|
+ merchantId: this.merchantId,
|
|
|
|
|
+ productStatus: this.productStatus,
|
|
|
|
|
+ productName: this.productName
|
|
|
|
|
+ };
|
|
|
|
|
+ // 重置列表
|
|
|
|
|
+ if (this.$refs.listScroll) {
|
|
|
|
|
+ this.$refs.listScroll.reloadList(this.initParams);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
|
|
+ // 数据加载完成后的回调
|
|
|
|
|
+ afterFetch(result) {
|
|
|
|
|
+ if (result && result.records && Array.isArray(result.records)) {
|
|
|
|
|
+ result.records.forEach((item) => {
|
|
|
|
|
+ item.select = false;
|
|
|
|
|
+ // item.saleEndDate = item.saleEndDate.includes('00:00:00') ? item.saleEndDate.slice(0, 10) : item
|
|
|
|
|
+ // .saleEndDate
|
|
|
|
|
+ // item.saleStartDate = item.saleStartDate.includes('00:00:00') ? item.saleStartDate.slice(0, 10) :
|
|
|
|
|
+ // item.saleStartDate
|
|
|
|
|
+ // item.productImage = configService.apiUrl + '/' + item.productImage
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
|
|
|
|
@@ -174,7 +205,11 @@
|
|
|
key: 'group',
|
|
key: 'group',
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad() {
|
|
|
|
|
+ // 初始化列表
|
|
|
|
|
+ this.getProductList();
|
|
|
|
|
+ }
|
|
|
// async onShow() {
|
|
// async onShow() {
|
|
|
// let that = this
|
|
// let that = this
|
|
|
// uni.getStorage({
|
|
// uni.getStorage({
|