|
@@ -15,7 +15,7 @@
|
|
|
<view :class="'s-' + themeClass" v-if="serachRecordList.length>0">
|
|
|
<view class="header">
|
|
|
搜索历史
|
|
|
- <text class="iconfont icon-shanchu" @click="delhistory"></text>
|
|
|
+ <text class="iconfont icon-shanchu" @click="confirmDetele"></text>
|
|
|
</view>
|
|
|
<view class="list">
|
|
|
<view v-for="(item,index) in serachRecordList" :key="index" @click="keywordsClick(item.searchWord)">{{item.searchWord}}</view>
|
|
@@ -87,17 +87,6 @@
|
|
|
:orderID="btnoRderID"
|
|
|
@shareConfirm ='onShareAppMessage'>
|
|
|
</share-alert>
|
|
|
- <!-- 删除订单弹窗 -->
|
|
|
- <model-alert v-if="isShowDelModal"
|
|
|
- :alertText='alertText'
|
|
|
- :alertType ='alertType'
|
|
|
- @btnConfirm ='handBtnDetele'>
|
|
|
- </model-alert>
|
|
|
- <!-- 取消订单弹窗 -->
|
|
|
- <cancel-alert v-if="isCenceModal"
|
|
|
- :cenceAlertText='cenceAlertText'
|
|
|
- @cenceConfirm ='handCenceConfirm'>
|
|
|
- </cancel-alert>
|
|
|
<!-- 透明模态层 -->
|
|
|
<modal-layer v-if='isModalLayer'></modal-layer>
|
|
|
</view>
|
|
@@ -111,9 +100,16 @@
|
|
|
import modalLayer from "@/components/modal-layer"
|
|
|
import empty from "@/components/empty";
|
|
|
import shareAlert from '@/components/module/modelAlert/shareAlert' //分享弹窗
|
|
|
- import modelAlert from '@/components/module/modelAlert/modelAlert' //删除弹窗
|
|
|
- import cancelAlert from '@/components/module/modelAlert/cancelAlert' //取消弹窗
|
|
|
import authorize from '@/common/config/authorize.js'
|
|
|
+ import {
|
|
|
+ searchOrderInfo,
|
|
|
+ searchOrderHistory,
|
|
|
+ clearOrderHistory,
|
|
|
+ queryOrderList,
|
|
|
+ cancelOrder,
|
|
|
+ deleteOrder,
|
|
|
+ confirmReceipt
|
|
|
+ } from "@/api/order.js"
|
|
|
export default {
|
|
|
components: {
|
|
|
orSearch,
|
|
@@ -122,8 +118,6 @@
|
|
|
orderButton,
|
|
|
empty,
|
|
|
shareAlert,
|
|
|
- modelAlert,
|
|
|
- cancelAlert
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -154,23 +148,10 @@
|
|
|
hasNextPage: false,
|
|
|
pullFlag: true,
|
|
|
navbarHeight:'',
|
|
|
- alertText: '',
|
|
|
- alertType:'',
|
|
|
- cenceAlertText: '确认取消该订单吗?',
|
|
|
nomoreText: '上拉显示更多',
|
|
|
scrollHeight:''
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- let self = this;
|
|
|
- self.$api.getStorage().then((resolve) =>{
|
|
|
- self.userID = resolve.userID
|
|
|
- })
|
|
|
- self.setScrollHeight();
|
|
|
- self.$api.loginStatus().then((resolveData) => {
|
|
|
- self.loginStatus = resolveData;
|
|
|
- });
|
|
|
- },
|
|
|
onLoad() {
|
|
|
this.initGetSerachRecord()
|
|
|
},
|
|
@@ -184,24 +165,19 @@
|
|
|
}
|
|
|
},
|
|
|
initGetSerachRecord(){
|
|
|
- authorize.getCode('weixin').then(wechatcode =>{
|
|
|
- // console.log(wechatcode);
|
|
|
- this.$api.get('/search/history',{organizeID:this.userOrganizeID,code:wechatcode},
|
|
|
- response =>{
|
|
|
- // console.log(response);
|
|
|
- if(response.code == '1'){
|
|
|
- this.serachRecordList = response.data
|
|
|
- if(this.serachRecordList.length>0){
|
|
|
- this.isSearchHistory = true
|
|
|
- }else{
|
|
|
- this.isSearchHistory = false
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000)
|
|
|
- }
|
|
|
+ this.$api.getStorage().then((resolve) =>{
|
|
|
+ this.userID = resolve.userID
|
|
|
+ searchOrderHistory({userId:this.userID}).then(response =>{
|
|
|
+ this.serachRecordList = response.data
|
|
|
+ if(this.serachRecordList.length>0){
|
|
|
+ this.isSearchHistory = true
|
|
|
+ }else{
|
|
|
+ this.isSearchHistory = false
|
|
|
}
|
|
|
- )
|
|
|
- })
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
onShowClose () { //输入框失去焦点时触发
|
|
|
this.inputEmpty(this.searchInputVal)
|
|
@@ -222,26 +198,14 @@
|
|
|
this.isShowClose = true;
|
|
|
this.subMitSearch();
|
|
|
},
|
|
|
- delhistory () { //清空历史记录
|
|
|
- this.alertType = 'delsearch'
|
|
|
- this.alertText ='确定删除全部历史记录?'
|
|
|
- this.isShowDelModal = true;
|
|
|
- },
|
|
|
- confirmDetele() {
|
|
|
- authorize.getCode('weixin').then(wechatcode =>{
|
|
|
- // console.log(wechatcode);
|
|
|
- this.$api.get('/search/deleteOrderRecord',{organizeID:this.userOrganizeID,code:wechatcode},
|
|
|
- response =>{
|
|
|
- // console.log(response);
|
|
|
- if(response.code == '1'){
|
|
|
- this.serachRecordList=[];
|
|
|
- this.isShowDelModal = false;
|
|
|
- this.isSearchHistory = false
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000)
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ confirmDetele () {//清空历史记录
|
|
|
+ this.$util.modal('提示','确定删除历史记录?','确定','取消',true,() =>{
|
|
|
+ clearOrderHistory({userId:this.userID}).then(response =>{
|
|
|
+ this.$util.msg('删除成功',2000,true,'success')
|
|
|
+ this.serachRecordList=[]
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
inputEmpty(val){
|
|
@@ -255,81 +219,67 @@
|
|
|
getOrderDatainit(index,source){
|
|
|
/**
|
|
|
* @订单初始化加载 仅加载第一页码
|
|
|
- * @param:code(微信返回的用户code)
|
|
|
* @param:searchWord(搜索关键词)
|
|
|
- * @param:userID(用户ID)
|
|
|
- * @param:index(页码数)
|
|
|
+ * @param:userId(用户ID)
|
|
|
+ * @param:pageNum(页码数)
|
|
|
* @param:pageSize(每页条数)
|
|
|
* @param:organizeID(全局变量组织ID)
|
|
|
*/
|
|
|
- authorize.getCode('weixin').then(wechatcode =>{
|
|
|
- this.$api.getStorage().then((resolve) =>{
|
|
|
- this.userID = resolve.userID
|
|
|
- let params = {code:wechatcode,searchWord:this.searchInputVal,userID:this.userID,index:1,pageSize:this.pageSize,organizeID:this.userOrganizeID};
|
|
|
- this.$api.lodingGet('/search/order',params,
|
|
|
- response => {
|
|
|
- if(response.code === '1'){
|
|
|
- this.isShowWrapper = true
|
|
|
- this.showSkeleton = true
|
|
|
- const _responseData = response.data.results;
|
|
|
- if(_responseData && _responseData.length > 0){
|
|
|
- let filrerData = _responseData.filter(item=>{
|
|
|
- //添加不同状态下订单的表现形式
|
|
|
- item = Object.assign(item, this.orderStateExp(item.state));
|
|
|
- return item;
|
|
|
- });
|
|
|
- this.orderList =[];
|
|
|
- filrerData.forEach(item=>{
|
|
|
- this.orderList.push(item);
|
|
|
- })
|
|
|
- this.hasNextPage = response.data.hasNextPage;
|
|
|
- if(this.hasNextPage){
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '上拉显示更多'
|
|
|
- }else{
|
|
|
- if(this.orderList.length < 2){
|
|
|
- this.pullUpOn = true
|
|
|
- }else{
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '已至底部'
|
|
|
- }
|
|
|
- }
|
|
|
- this.isShowEmpty = false
|
|
|
- }else{
|
|
|
- this.isShowEmpty = true
|
|
|
- }
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000);
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- getOnReachBottomData(index){//上拉加载
|
|
|
- this.pageNum+=1
|
|
|
- let params = {code:wechatcode,searchWord:this.searchInputVal,userID:this.userID,index:1,pageSize:this.pageSize,organizeID:this.userOrganizeID};
|
|
|
- this.$api.get('/search/order',params,
|
|
|
- response => {
|
|
|
- if(response.code === '1'){
|
|
|
- let resData = response.data.results
|
|
|
- this.hasNextPage = response.data.hasNextPage;
|
|
|
- this.orderList = this.orderList.concat(resData)
|
|
|
- this.pullFlag = false;// 防上拉暴滑
|
|
|
- setTimeout(()=>{this.pullFlag = true;},500)
|
|
|
- if(this.hasNextPage){
|
|
|
- this.pullUpOn = false
|
|
|
- this.nomoreText = '上拉显示更多'
|
|
|
+ let params = {searchWord:this.searchInputVal,userId:this.userID,pageNum:1,pageSize:this.pageSize};
|
|
|
+ searchOrderInfo(params).then(response =>{
|
|
|
+ this.isShowWrapper = true
|
|
|
+ this.showSkeleton = true
|
|
|
+ const _responseData = response.data.results;
|
|
|
+ if(_responseData && _responseData.length > 0){
|
|
|
+ let filrerData = _responseData.filter(item=>{
|
|
|
+ //添加不同状态下订单的表现形式
|
|
|
+ item = Object.assign(item, this.orderStateExp(item.state));
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.orderList =[];
|
|
|
+ filrerData.forEach(item=>{
|
|
|
+ this.orderList.push(item);
|
|
|
+ })
|
|
|
+ this.hasNextPage = response.data.hasNextPage;
|
|
|
+ if(this.hasNextPage){
|
|
|
+ this.pullUpOn = false
|
|
|
+ this.nomoreText = '上拉显示更多'
|
|
|
+ }else{
|
|
|
+ if(this.orderList.length < 2){
|
|
|
+ this.pullUpOn = true
|
|
|
}else{
|
|
|
- this.loadding = false
|
|
|
this.pullUpOn = false
|
|
|
this.nomoreText = '已至底部'
|
|
|
}
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000);
|
|
|
}
|
|
|
+ this.isShowEmpty = false
|
|
|
+ }else{
|
|
|
+ this.isShowEmpty = true
|
|
|
+ }
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getOnReachBottomData(index){//上拉加载
|
|
|
+ this.pageNum+=1
|
|
|
+ let params = {searchWord:this.searchInputVal,userId:this.userID,pageNum:this.pageNum,pageSize:this.pageSize}
|
|
|
+ searchOrderInfo(params).then(response =>{
|
|
|
+ let resData = response.data.results
|
|
|
+ this.hasNextPage = response.data.hasNextPage;
|
|
|
+ this.orderList = this.orderList.concat(resData)
|
|
|
+ this.pullFlag = false;// 防上拉暴滑
|
|
|
+ setTimeout(()=>{this.pullFlag = true;},500)
|
|
|
+ if(this.hasNextPage){
|
|
|
+ this.pullUpOn = false
|
|
|
+ this.nomoreText = '上拉显示更多'
|
|
|
+ }else{
|
|
|
+ this.loadding = false
|
|
|
+ this.pullUpOn = false
|
|
|
+ this.nomoreText = '已至底部'
|
|
|
}
|
|
|
- )
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
},
|
|
|
scrolltolower() {
|
|
|
if(this.hasNextPage){
|
|
@@ -340,32 +290,22 @@
|
|
|
}
|
|
|
},
|
|
|
detail(id) {//订单详情跳转
|
|
|
- console.log(id)
|
|
|
+ // console.log(id)
|
|
|
this.isModalLayer = true;
|
|
|
this.$api.navigateTo(`/pages/user/order/order-details?state=${this.currentTab}&orderID=${id}`)
|
|
|
},
|
|
|
- handBtnDetele(e){
|
|
|
- console.log(e)
|
|
|
- if(e == 'delsearch'){
|
|
|
- this.confirmDetele()
|
|
|
- }else{
|
|
|
- this.handOrderDetele()
|
|
|
- }
|
|
|
- },
|
|
|
handButtonConfirm(data) {//获取点击
|
|
|
- console.log('点击按钮的类型是',data);
|
|
|
+ // console.log('点击按钮的类型是',data);
|
|
|
this.handShowAlert(data)
|
|
|
this.btnoRderID = data.orderId
|
|
|
},
|
|
|
handShowAlert(data) {//执行
|
|
|
switch(data.type){
|
|
|
case 'delete':
|
|
|
- this.isShowDelModal = true;
|
|
|
- this.alertType = 'delorder'
|
|
|
- this.alertText ='确认删除订单吗?'
|
|
|
+ this.handOrderDetele();
|
|
|
break
|
|
|
case 'cancel':
|
|
|
- this.isCenceModal = true;
|
|
|
+ this.handCenceConfirm()
|
|
|
break
|
|
|
case 'query':
|
|
|
this.isModalLayer = true;
|
|
@@ -377,49 +317,43 @@
|
|
|
}
|
|
|
},
|
|
|
handOrderConfirm (id){//确认收货
|
|
|
- this.$api.get('/order/affirm',{orderID:id},
|
|
|
- response => {
|
|
|
- if(response.code === '1'){
|
|
|
- this.$util.msg(response.msg,2000,true,'success');
|
|
|
- this.isShowDelModal = false
|
|
|
- setTimeout(() => {
|
|
|
- this.getOrderDatainit(this.currentTab)
|
|
|
- },2000)
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000);
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ this.$util.modal('提示','是否确认收货','确定','取消',true,() =>{
|
|
|
+ confirmReceipt({orderID:id}).then(response =>{
|
|
|
+ this.$util.msg(response.msg,2000,true,'success');
|
|
|
+ this.initOrderDetaileData()
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- handOrderDetele (){//删除订单
|
|
|
- this.$api.get('/order/delete',{orderID:this.btnoRderID},
|
|
|
- response => {
|
|
|
- if(response.code === '1'){
|
|
|
- this.$util.msg(response.msg,2000,true,'success');
|
|
|
- this.isShowDelModal = false
|
|
|
- setTimeout(() => {
|
|
|
- this.getOrderDatainit(this.currentTab)
|
|
|
- },2000)
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000);
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ handOrderDetele(){//删除订单
|
|
|
+ this.$util.modal('提示','确认删除该订单吗?','确定','取消',true,() =>{
|
|
|
+ deleteOrder({orderID:this.orderID}).then(response =>{
|
|
|
+ this.$util.msg(response.msg,2000,true,'success');
|
|
|
+ setTimeout(() => {
|
|
|
+ if(this.shareType ==='share'){
|
|
|
+ this.$api.switchTabTo('/pages/tabBar/user/user')
|
|
|
+ }else{
|
|
|
+ this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
|
|
|
+ }
|
|
|
+ },500)
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- handCenceConfirm (){//取消订单
|
|
|
- this.$api.get('/order/cancel',{orderID:this.btnoRderID},
|
|
|
- response => {
|
|
|
- if(response.code === '1'){
|
|
|
- this.$util.msg(response.msg,2000,true,'success');
|
|
|
- this.isCenceModal = false
|
|
|
- setTimeout(() => {
|
|
|
- this.getOrderDatainit(this.currentTab)
|
|
|
- },2000)
|
|
|
- }else{
|
|
|
- this.$util.msg(response.msg,2000);
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ handCenceConfirm(){//取消订单
|
|
|
+ this.$util.modal('提示','确认取消该订单吗?','确定','取消',true,() =>{
|
|
|
+ cancelOrder({orderID:this.orderID}).then(response =>{
|
|
|
+ this.$util.msg(response.msg,2000,true,'success');
|
|
|
+ this.initOrderDetaileData()
|
|
|
+ }).catch(response =>{
|
|
|
+ this.$util.msg(response.msg,2000)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handlSearchPath(){
|
|
|
+ this.$api.navigateTo('/pages/search/search-order')
|
|
|
},
|
|
|
onShareAppMessage (res){//分享转发
|
|
|
this.isShareModal = false
|
|
@@ -429,7 +363,7 @@
|
|
|
return {
|
|
|
title: '您有新的分享订单,快来查看吧~',
|
|
|
path: `/pages/user/order/orderShareLogin?orderID=${this.btnoRderID}&userID=${this.userID}`,
|
|
|
- imageUrl:'https://admin-b.caimei365.com/userfiles/1/images/photo/2020/02/%E5%88%86%E4%BA%AB%E7%95%8C%E9%9D%A2a%CC%8A%403x.png'
|
|
|
+ imageUrl:'https://img.caimei365.com/group1/M00/03/8C/Cmis215XHXSAWWkhAAXDP4-6m_c397.png'
|
|
|
}
|
|
|
},
|
|
|
//订单状态文字和颜色
|
|
@@ -472,6 +406,10 @@
|
|
|
},
|
|
|
onPageScroll(e) {
|
|
|
this.scrollTop = e.scrollTop;
|
|
|
+
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ this.setScrollHeight();
|
|
|
}
|
|
|
}
|
|
|
</script>
|