接口对接
This commit is contained in:
parent
d429c2739d
commit
74b719b427
|
|
@ -13,7 +13,7 @@
|
|||
<view class="cu-bar search bg-white">
|
||||
<view class="search-form round">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input @confirm="searchGoods" :adjust-position="true" type="text" placeholder="输入搜索内容"
|
||||
<input @confirm="searchGoods" v-model="searchInfo.inputGoodsName" :adjust-position="true" type="text" placeholder="输入搜索内容"
|
||||
confirm-type="search"></input>
|
||||
</view>
|
||||
<!-- 区域筛选picker -->
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
<!-- 热门细类 -->
|
||||
<view class="cu-list grid no-border hot-sub-category" :class="['col-5']">
|
||||
<view class="cu-item" v-for="(item,index) in subCategories" :key="index" v-if="index < 5"
|
||||
@click="searchGoods(item)">
|
||||
@click="chooseCategory(item)">
|
||||
<view class="hot-sub-category-icon" :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
|
||||
<view class="cu-tag badge" v-if="item.badge!=0">
|
||||
<block v-if="item.badge!=1">{{item.badge}}</block>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
<!-- 细类 -->
|
||||
<view class="cu-list grid no-border" :class="['col-5']" v-if="subCategories.length > 5">
|
||||
<view class="cu-item" v-for="(item,index) in subCategories" :key="index"
|
||||
v-if="index < subCategories.length && index > 4" @click="searchGoods(item)">
|
||||
v-if="index < subCategories.length && index > 4" @click="chooseCategory(item)">
|
||||
<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
|
||||
<view class="cu-tag badge" v-if="item.badge!=0">
|
||||
<block v-if="item.badge!=1">{{item.badge}}</block>
|
||||
|
|
@ -192,7 +192,9 @@
|
|||
}
|
||||
this.areaList.push(regionList);
|
||||
this.areaList.push(subRegionList);
|
||||
this.areaList.push(subSubRegionList);
|
||||
this.areaList.push(subSubRegionList);
|
||||
// 默认选中第一个,因此将第一个区域默认加入查询条件中
|
||||
this.searchInfo.area = [regionList[0], subRegionList[0], subSubRegionList[0]];
|
||||
},
|
||||
regionChange(e) {
|
||||
this.areaMultiIndex = e.detail.value;
|
||||
|
|
@ -240,10 +242,20 @@
|
|||
console.log("切换细类, 大类id=" + categoryId);
|
||||
let allSubCategories = await this.$api.data('subCategories');
|
||||
this.subCategories = allSubCategories.slice(0, (4 - categoryId) * 5);
|
||||
},
|
||||
chooseCategory(item) {
|
||||
this.searchInfo.category = item;
|
||||
this.searchGoods();
|
||||
},
|
||||
searchGoods(item) {
|
||||
console.log("搜索条件信息: " + item)
|
||||
console.log("商品搜索中...");
|
||||
searchGoods() {
|
||||
let params = {
|
||||
category: this.searchInfo.category,
|
||||
area: this.searchInfo.area,
|
||||
inputGoodsName: this.searchInfo.inputGoodsName
|
||||
};
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/filtered-products?params=' + encodeURIComponent(JSON.stringify(params))
|
||||
})
|
||||
},
|
||||
showDetails(productItem) {
|
||||
let params = {
|
||||
|
|
|
|||
|
|
@ -248,19 +248,18 @@
|
|||
curUserInfo: {},
|
||||
myInfo: {},
|
||||
servOrderTabList: [{
|
||||
type: 'ordersWait2Pay',
|
||||
name: '待付款'
|
||||
}, {
|
||||
type: 'ordersWait2Serv',
|
||||
name: '待服务'
|
||||
type: 1,
|
||||
name: '待排期'
|
||||
}, {
|
||||
type: 'ordersServing',
|
||||
type: 2,
|
||||
name: '待上门'
|
||||
}, {
|
||||
type: 3,
|
||||
name: '服务中'
|
||||
}, {
|
||||
type: 'ordersAfterServ',
|
||||
name: '售后中'
|
||||
}, {
|
||||
type: 'ordersFinish',
|
||||
type: 4,
|
||||
name: '已完成'
|
||||
}],
|
||||
servOrderType: 0,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="bg-white padding-bottom">
|
||||
<!-- 图片 -->
|
||||
<view class="flex justify-start">
|
||||
<view class="cu-avatar" :style="'background-image:url(' + product.goodsLogoUrl + '); min-width:150rpx; min-height:150rpx;'"></view>
|
||||
<view class="margin-left-sm flex-column-between" style="width: 100%">
|
||||
<view class="text-black text-lg">{{product.goodsName}}</view>
|
||||
<view class="flex flex-wrap">
|
||||
<view class="basis-xl">{{product.standardName}}</view>
|
||||
<view class="basis-xs text-right">×{{product.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "product-picked",
|
||||
props: {
|
||||
product: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<view class="cu-bar solid-bottom">
|
||||
<view class="action bar-first-action">
|
||||
<text class="cuIcon-shopfill text-main-color"></text>
|
||||
{{shopOrder.worker.name}}
|
||||
{{shopOrder.workerName}}
|
||||
<view>
|
||||
<view class="cuIcon-right"></view>
|
||||
</view>
|
||||
|
|
@ -31,19 +31,18 @@
|
|||
</view>
|
||||
<view class="padding-lr">
|
||||
<view class="margin-top-sm">
|
||||
<product-picked :product="shopOrder.orderGoods" :pickedList="shopOrder.orderGoods.pickedList">
|
||||
</product-picked>
|
||||
<product-picked :product="shopOrder"></product-picked>
|
||||
</view>
|
||||
<view class="flex justify-end align-end padding-bottom-sm">
|
||||
<view class="margin-right-sm"><text>总价</text><text class="text-price text-red">{{shopOrder.financialMaster.totalMoney}}</text>
|
||||
<view class="margin-right-sm"><text>总价</text><text class="text-price text-red">{{shopOrder.totalMoney}}</text>
|
||||
</view>
|
||||
<view class="margin-right-sm"><text>优惠</text><text class="text-price text-red">{{shopOrder.financialMaster.discountMoney}}</text>
|
||||
<view class="margin-right-sm"><text>优惠</text><text class="text-price text-red">{{shopOrder.discountMoney}}</text>
|
||||
</view>
|
||||
<view class="text-lg"><text>需付款</text><text
|
||||
class="text-price text-red text-lg text-bold">{{shopOrder.financialMaster.payMoney}}</text></view>
|
||||
class="text-price text-red text-lg text-bold">{{shopOrder.payMoney}}</text></view>
|
||||
</view>
|
||||
<view v-if="orderType === 0" class="padding-tb-sm flex justify-end oper-bar">
|
||||
<!-- <view class="padding-tb-sm flex justify-end oper-bar">
|
||||
<view v-if="orderType === 0">
|
||||
<!-- <view class="padding-tb-sm flex justify-end oper-bar" v-if="">
|
||||
|
||||
</view> -->
|
||||
<button v-if="shopOrder.subProcessStatus <= 4 && shopOrder.mainProcess !== 'ordersWait2Serv'"
|
||||
|
|
@ -115,7 +114,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import productPicked from '@/components/goods-card/product-picked.vue';
|
||||
import productPicked from '@/pages/my/components/product-picked.vue';
|
||||
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
|
||||
|
||||
export default {
|
||||
|
|
@ -145,12 +144,12 @@
|
|||
}
|
||||
if (Array.isArray(tabInfo.tabHeaderList) && tabInfo.tabHeaderList.length > 0) {
|
||||
this.tabHeaderList = tabInfo.tabHeaderList;
|
||||
this.loadData(this.tabHeaderList[this.tabCur].type);
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData(mainProcess) {
|
||||
loadData() {
|
||||
for(let i = 0; i < this.tabHeaderList.length; i++) {
|
||||
this.pageParams.push({
|
||||
pageNum: 0
|
||||
|
|
@ -159,9 +158,7 @@
|
|||
// 真实对接口的时候使用
|
||||
// this.myOrders = await this.$api.data(this.orderType, mainProcess);
|
||||
// this.myOrders = await this.$api.data(mainProcess);
|
||||
this.loadOrderPage({
|
||||
orderType: this.orderType
|
||||
});
|
||||
this.loadOrderPage();
|
||||
},
|
||||
reloadOrderPage(params = {}) {
|
||||
this.pageParams = [];
|
||||
|
|
@ -174,11 +171,16 @@
|
|||
this.$refs.loadStatusBar.showLoadMore();
|
||||
this.loadOrderPage(params);
|
||||
},
|
||||
async loadOrderPage(params) {
|
||||
async loadOrderPage(params = {}) {
|
||||
params.pageNum = this.pageParams[this.tabCur].pageNum;
|
||||
params.pageSize = this.$globalData.initPageSize;
|
||||
this.$refs.loadStatusBar.showLoading();
|
||||
try {
|
||||
params.orderType = this.orderType;
|
||||
params.orderStatus = this.tabHeaderList[this.tabCur].type;
|
||||
if (this.tabCur === 0) {
|
||||
params.payStatus = 0;
|
||||
}
|
||||
let res = await this.$request.qryOrderPage(params);
|
||||
let rowsLength = res.rows.length;
|
||||
if (rowsLength > 0) {
|
||||
|
|
@ -197,10 +199,8 @@
|
|||
},
|
||||
tabSelect(e) {
|
||||
this.tabCur = e.currentTarget.dataset.id;
|
||||
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
|
||||
this.reloadOrderPage({
|
||||
orderType: this.tabHeaderList[this.tabCur].type
|
||||
})
|
||||
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
|
||||
this.reloadOrderPage();
|
||||
},
|
||||
updateAgreeStatus(status, index) {
|
||||
this.myOrders[index].agreedServTime.customerAgreeStatus = status;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
<script>
|
||||
import productPicked from '@/components/goods-card/product-picked.vue';
|
||||
import urgentMsg from '@/pages/my/modal/urgent-msg.vue';
|
||||
import urgentMsg from '@/pages/my/components/modal/urgent-msg.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<view class="cu-bar search bg-white">
|
||||
<view class="search-form round">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input @confirm="searchGoods" :adjust-position="true" type="text" placeholder="输入搜索内容"
|
||||
<input @confirm="searchGoods" v-model="inputGoodsName" :adjust-position="true" type="text" placeholder="输入搜索内容"
|
||||
confirm-type="search"></input>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -19,22 +19,22 @@
|
|||
<view class="cu-item" v-for="(item,index) in taskConditions" v-if="item.type !== 1" :key="index"
|
||||
@tap="tabSelect" :data-id="index">
|
||||
<!-- 区域筛选picker -->
|
||||
<picker v-if="item.code === 'area'" :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange"
|
||||
<picker v-if="item.code === 'areaId'" :mode="'multiSelector'" @change="regionChange" @columnchange="regionColChange"
|
||||
:value="areaMultiIndex" :range-key="'areaName'" :range="areaList">
|
||||
<view class="flex justify-start">
|
||||
<view class="text-cut search-nav-item-text">
|
||||
{{taskConditions[0].value && taskConditions[0].value.length ? taskConditions[0].value[2].areaName : item.title}}
|
||||
{{chosenArea && chosenArea.length ? chosenArea[2].areaName : item.title}}
|
||||
</view>
|
||||
<text class="text-lg"><text class="cuIcon-triangledownfill"></text></text>
|
||||
</view>
|
||||
</picker>
|
||||
<!-- 品类筛选picker -->
|
||||
<picker v-else-if="item.code === 'category'" :mode="'multiSelector'" @change="categoryChange"
|
||||
<picker v-else-if="item.code === 'deptGoodsCategoryId'" :mode="'multiSelector'" @change="categoryChange"
|
||||
@columnchange="categoryColChange" :value="categoryMultiIndex" :range-key="'goodsCategoryName'"
|
||||
:range="categoryList">
|
||||
<view class="flex justify-start">
|
||||
<view class="text-cut search-nav-item-text">
|
||||
{{taskConditions[1].value && taskConditions[1].value.length ? taskConditions[1].value[2].goodsCategoryName : item.title}}
|
||||
{{chosenCategory && chosenCategory.length ? chosenCategory[2].goodsCategoryName : item.title}}
|
||||
</view>
|
||||
<text class="text-lg"><text class="cuIcon-triangledownfill"></text></text>
|
||||
</view>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="cu-item" v-else>
|
||||
<button class="cu-btn bg-grey round shadow-blur">{{item.title}}</button>
|
||||
<button class="cu-btn bg-grey round shadow-blur" @click="barBtnClick(index)">{{item.title}}</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
|
@ -83,53 +83,107 @@
|
|||
pageNum: this.$globalData.initPageNum,
|
||||
pageSize: this.$globalData.initPageSize,
|
||||
stickyTop: this.CustomBar,
|
||||
// type: 0=升降序,1=功能按钮;order: 0=升序,1=降序;
|
||||
// type: 0=升降序,1=功能按钮,2=选择器;order: 0=升序,1=降序;
|
||||
tabCur: 0,
|
||||
scrollLeft: 0,
|
||||
taskConditions: [{
|
||||
code: 'area',
|
||||
title: '区域'
|
||||
code: 'areaId',
|
||||
title: '区域',
|
||||
type: 2
|
||||
}, {
|
||||
code: 'category',
|
||||
title: '品类'
|
||||
}, {
|
||||
code: 'distance',
|
||||
title: '距离',
|
||||
type: 0,
|
||||
value: 0,
|
||||
}, {
|
||||
code: 'time',
|
||||
code: 'deptGoodsCategoryId',
|
||||
title: '品类',
|
||||
type: 2
|
||||
},
|
||||
// {
|
||||
// code: 'distance',
|
||||
// title: '距离',
|
||||
// type: 0,
|
||||
// value: 0,
|
||||
// },
|
||||
{
|
||||
code: 'createTimeSort',
|
||||
title: '时间',
|
||||
type: 0,
|
||||
value: 0,
|
||||
}, {
|
||||
code: 'reset',
|
||||
type: 1,
|
||||
title: '重置'
|
||||
}],
|
||||
title: '重置',
|
||||
action: 'resetConditions'
|
||||
}],
|
||||
originTaskConditions: [{
|
||||
code: 'areaId',
|
||||
title: '区域',
|
||||
type: 2
|
||||
}, {
|
||||
code: 'deptGoodsCategoryId',
|
||||
title: '品类',
|
||||
type: 2
|
||||
},
|
||||
// {
|
||||
// code: 'distance',
|
||||
// title: '距离',
|
||||
// type: 0,
|
||||
// value: 0,
|
||||
// },
|
||||
{
|
||||
code: 'createTimeSort',
|
||||
title: '时间',
|
||||
type: 0,
|
||||
value: 0,
|
||||
}, {
|
||||
code: 'reset',
|
||||
type: 1,
|
||||
title: '重置',
|
||||
action: 'resetConditions'
|
||||
}],
|
||||
inputGoodsName: null,
|
||||
areaList: [],
|
||||
areaMultiIndex: [0, 0, 0],
|
||||
areaMultiIndex: [0, 0, 0],
|
||||
chosenArea: [],
|
||||
categoryList: [],
|
||||
categoryMultiIndex: [0, 0, 0]
|
||||
categoryMultiIndex: [0, 0, 0],
|
||||
chosenCategory: []
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
let params = JSON.parse(decodeURIComponent(options.params));
|
||||
if (typeof params.pageNum === 'number' && typeof params.pageSize === 'number') {
|
||||
this.pageNum = params.pageNum;
|
||||
this.pageSize = params.pageSize;
|
||||
// if (typeof params.pageNum === 'number' && typeof params.pageSize === 'number') {
|
||||
// this.pageNum = params.pageNum;
|
||||
// this.pageSize = params.pageSize;
|
||||
// }
|
||||
if (params.category) {
|
||||
this.chosenCategory[2] = params.category;
|
||||
this.taskConditions[1].value = this.chosenCategory[2].goodsCategoryId;
|
||||
}
|
||||
if (params.area) {
|
||||
this.chosenArea = params.area;
|
||||
this.taskConditions[0].value = this.chosenArea[2].areaId;
|
||||
}
|
||||
if (params.inputGoodsName) {
|
||||
this.inputGoodsName = params.inputGoodsName;
|
||||
}
|
||||
this.loadData(params);
|
||||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
loadData(params) {
|
||||
loadData() {
|
||||
this.loadCategoryList();
|
||||
this.loadRegionList();
|
||||
this.loadProductData(params);
|
||||
this.loadProductData();
|
||||
},
|
||||
async loadProductData(params) {
|
||||
async loadProductData(params = {}) {
|
||||
params.pageNum = this.pageNum;
|
||||
params.pageSize = this.pageSize;
|
||||
params.pageSize = this.pageSize;
|
||||
params.goodsName = this.inputGoodsName;
|
||||
this.taskConditions.forEach((condition) => {
|
||||
if (condition.type === 2) {
|
||||
params[condition.code] = condition.value;
|
||||
} else if (condition.type === 0) {
|
||||
params.params = params.params ? params.params : {};
|
||||
params.params[condition.code] = condition.value === 1 ? 'desc' : 'asc';
|
||||
}
|
||||
})
|
||||
this.loadMoreStatus = 'loading bg-main-color light';
|
||||
this.hasMoreData = false;
|
||||
try {
|
||||
|
|
@ -138,18 +192,28 @@
|
|||
} catch (e) {
|
||||
this.loadMoreStatus = 'erro bg-red'
|
||||
}
|
||||
},
|
||||
reloadProductPage() {
|
||||
this.pageNum = 0;
|
||||
this.pageSize = this.$globalData.initPageSize;
|
||||
this.loadProductData();
|
||||
},
|
||||
async loadProductPage(params) {
|
||||
// let shopInfo = await this.$api.data('shopInfo');
|
||||
// this.productList = shopInfo.productList;
|
||||
let res = await this.$request.qryProductPage(params);
|
||||
let rowsLength = res[1].data.rows.length;
|
||||
if (rowsLength == 0) {
|
||||
if (rowsLength == 0) {
|
||||
this.productList = [];
|
||||
return;
|
||||
} else if (rowsLength === this.pageSize) {
|
||||
this.hasMoreData = true;
|
||||
}
|
||||
if (this.pageNum === 0) {
|
||||
this.productList = res[1].data.rows;
|
||||
} else {
|
||||
this.productList = this.productList.concat(res[1].data.rows);
|
||||
}
|
||||
this.productList = this.productList.concat(res[1].data.rows);
|
||||
this.pageNum++;
|
||||
},
|
||||
async loadCategoryList(idArr) {
|
||||
|
|
@ -190,8 +254,21 @@
|
|||
this.areaList.push(subRegionList);
|
||||
this.areaList.push(subSubRegionList);
|
||||
},
|
||||
searchGoods(e) {
|
||||
console.log("搜索" + e.detail.value)
|
||||
searchGoods() {
|
||||
this.reloadProductPage();
|
||||
},
|
||||
resetConditions() {
|
||||
this.inputGoodsName = null;
|
||||
for(let i = 0; i < this.originTaskConditions.length; i++) {
|
||||
this.taskConditions[i].value = this.originTaskConditions[i].value;
|
||||
}
|
||||
this.chosenArea = [];
|
||||
this.chosenCategory = [];
|
||||
// this.$forceUpdate();
|
||||
this.reloadProductPage();
|
||||
},
|
||||
barBtnClick(index) {
|
||||
this[this.taskConditions[index].action]();
|
||||
},
|
||||
tabSelect(e) {
|
||||
this.tabCur = e.currentTarget.dataset.id;
|
||||
|
|
@ -201,7 +278,8 @@
|
|||
if (conditionType === 0) {
|
||||
// 升降序类型的条件切换升降序
|
||||
let orderVal = this.taskConditions[this.tabCur].value;
|
||||
this.taskConditions[this.tabCur].value = orderVal === 0 ? 1 : 0;
|
||||
this.taskConditions[this.tabCur].value = orderVal === 0 ? 1 : 0;
|
||||
this.searchGoods();
|
||||
}
|
||||
},
|
||||
showDetails(productItem) {
|
||||
|
|
@ -217,8 +295,10 @@
|
|||
let chosenArea = [];
|
||||
for (let i = 0; i < this.areaList.length; i++) {
|
||||
chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]);
|
||||
}
|
||||
this.taskConditions[this.tabCur].value = chosenArea;
|
||||
}
|
||||
this.chosenArea = chosenArea;
|
||||
this.taskConditions[this.tabCur].value = chosenArea[chosenArea.length - 1].areaId;
|
||||
this.searchGoods();
|
||||
},
|
||||
async regionColChange(e) {
|
||||
let colObj = e.detail;
|
||||
|
|
@ -250,8 +330,10 @@
|
|||
let chosenCategory = [];
|
||||
for (let i = 0; i < this.categoryList.length; i++) {
|
||||
chosenCategory.push(this.categoryList[i][this.categoryMultiIndex[i]]);
|
||||
}
|
||||
this.taskConditions[this.tabCur].value = chosenCategory;
|
||||
}
|
||||
this.chosenCategory = chosenCategory;
|
||||
this.taskConditions[this.tabCur].value = chosenCategory[chosenCategory.length - 1].goodsCategoryId;
|
||||
this.searchGoods();
|
||||
},
|
||||
async categoryColChange(e) {
|
||||
let colObj = e.detail;
|
||||
|
|
@ -295,6 +377,7 @@
|
|||
display: inline-block;
|
||||
line-height: 90rpx;
|
||||
margin: 0;
|
||||
padding: 0 10rpx;
|
||||
padding: 0 10rpx;
|
||||
width: 180rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@
|
|||
},
|
||||
chooseSubType(item) {
|
||||
let params = {
|
||||
goodsCategoryId: item.goodsCategoryId
|
||||
}
|
||||
category: item
|
||||
};
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/filtered-products?params=' + encodeURIComponent(JSON.stringify(params))
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue