添加loading等

master
yujialong 2 years ago
parent c5b618e5ae
commit d71cd65494
  1. 4
      apis/modules/order.js
  2. 3
      apis/request.js
  3. 4
      config/request.js
  4. 8
      order/addCourse/addCourse.vue
  5. 74
      order/curClient/curClient.vue
  6. 8
      order/orderDetail/orderDetail.vue
  7. 8
      order/ordered/ordered.vue
  8. 1
      order/orders/orders.vue
  9. 8
      pages/clientDetail/clientDetail.vue
  10. 5
      pages/index/index.vue

@ -32,3 +32,7 @@ export const orderList = (data) => {
export const del = (data) => { export const del = (data) => {
return post('nakadai/nakadai/order/delete', data) return post('nakadai/nakadai/order/delete', data)
} }
export const miniProgramOrderRecord = (data) => {
return post('nakadai/nakadai/applets/order/miniProgramOrderRecord', data)
}

@ -14,11 +14,12 @@ const request = options => {
const header = Object.assign({}, config.headers, { const header = Object.assign({}, config.headers, {
token: uni.getStorageSync('token') token: uni.getStorageSync('token')
}) })
const otherUrl = ['generateInvitationCode', 'weChatAppletCallback', 'userBinding', 'getUserRolesPermissionMenu'] const otherUrl = ['getTeamsByAccountId']
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
const { url } = options const { url } = options
uni.request({ uni.request({
header, header,
// url: (otherUrl.map(e => config.baseURL.includes(e)) ? 'http://192.168.31.137:9000/' : config.baseURL) + url,
url: config.baseURL + url, url: config.baseURL + url,
method: options.method || 'GET', // 请求类型,默认为GET method: options.method || 'GET', // 请求类型,默认为GET
data: options.data || {}, // 请求参数,默认空对象 data: options.data || {}, // 请求参数,默认空对象

@ -1,12 +1,12 @@
/** /**
/** /**
* axios 配置文件 * 请求配置文件
* @author yujialong * @author yujialong
*/ */
export default { export default {
// baseURL: 'https://huorantech.cn/', // baseURL: 'https://huorantech.cn/',
// baseURL: 'http://192.168.31.137:9000/', // baseURL: 'http://192.168.31.151:9000/',
baseURL: 'http://121.37.12.51/', baseURL: 'http://121.37.12.51/',
headers: { headers: {
'Content-Type': 'application/json;charset=UTF-8' 'Content-Type': 'application/json;charset=UTF-8'

@ -110,6 +110,9 @@
methods: { methods: {
// //
getList() { getList() {
uni.showLoading({
title: '加载中'
})
AppletsDataProductList({ AppletsDataProductList({
sort: 'desc', sort: 'desc',
keywords: this.keyword, keywords: this.keyword,
@ -144,7 +147,10 @@
const noMore = this.list.length === data.total // const noMore = this.list.length === data.total //
this.status = noMore ? 'noMore' : 'more' // noMore this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1 this.reachBottom = noMore ? -1 : 0 // -1
}).catch(e => {}) uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
}, },
initList() { initList() {
this.page = 1 this.page = 1

@ -33,8 +33,8 @@
<view class="line"> <view class="line">
<text class="name">订单内容</text> <text class="name">订单内容</text>
<view class="val ell-wrap"> <view class="val ell-wrap">
<view :class="{ell: !item.toggle}">{{ item.orderContent }}</view> <view :class="{ell: !item.toggle}">{{ item.productName }}</view>
<view v-if="item.orderContent.length > 14" class="toggle" @click.stop="toggle(item)">{{ item.toggle ? '收起' : '展开' }}</view> <view v-if="item.productName.length > 14" class="toggle" @click.stop="toggle(item)">{{ item.toggle ? '收起' : '展开' }}</view>
</view> </view>
</view> </view>
<view class="line"> <view class="line">
@ -50,6 +50,7 @@
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
</view> </view>
<uni-load-more :status="status" />
</template> </template>
<empty v-else></empty> <empty v-else></empty>
@ -59,7 +60,7 @@
</template> </template>
<script> <script>
import { orderList, del } from '@/apis/modules/order.js' import { miniProgramOrderRecord, del } from '@/apis/modules/order.js'
export default { export default {
data() { data() {
return { return {
@ -86,13 +87,13 @@
], ],
} }
], ],
reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore
filterForm: {}, filterForm: {},
isFilter: 0, // 0->,1->
searchTimer: null, searchTimer: null,
orderStatus: '', orderStatus: '',
keyword: '', keyword: '',
list: [], list: [],
listAll: [],
page: 1, page: 1,
pageSize: 10, pageSize: 10,
delOption: [{ delOption: [{
@ -107,10 +108,18 @@
keyword () { keyword () {
clearTimeout(this.searchTimer) clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => { this.searchTimer = setTimeout(() => {
this.filter() this.initList()
}, 500) }, 500)
} }
}, },
//
onReachBottom() {
if (this.reachBottom >= 0) {
this.reachBottom = 1
this.status = 'loading'
this.getList()
}
},
// //
onPullDownRefresh() { onPullDownRefresh() {
this.getList() this.getList()
@ -123,23 +132,42 @@
const { options } = pages[pages.length - 1] const { options } = pages[pages.length - 1]
this.customerId = options.customerId this.customerId = options.customerId
this.customerName = options.name this.customerName = options.name
this.getList() // this.initList()
}, },
methods: { methods: {
getList() { getList() {
orderList({ uni.showLoading({
cityId: '', title: '加载中'
customerName: this.customerName, })
const team = uni.getStorageSync('team')
miniProgramOrderRecord({
businessManagerId: this.$util.getBmId(),
teamId: team.id,
customerId: this.customerId,
orderStatus: this.orderStatus, orderStatus: this.orderStatus,
orderType: '', isAdmin: +team.isTeam, // (0 1)
pageNo: 1, pageNum: this.page,
pageSize: 10000, pageSize: this.pageSize,
provinceId: '' keywords: this.keyword
}).then(({ orderPage }) => { }).then(({ data }) => {
const { orders } = orderPage const { records } = data
this.list = orders records.map(e => {
this.listAll = orders e.toggle = e.productName.length < 14 // 14
}).catch(e => {}) })
this.list = this.reachBottom > 0 ? [...this.list, ...records] : records
this.page++ // page+1
const noMore = this.list.length === data.total //
this.status = noMore ? 'noMore' : 'more' // noMore
this.reachBottom = noMore ? -1 : 0 // -1
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
},
initList() {
this.page = 1
this.reachBottom = 0
this.getList()
}, },
// //
toggle(item) { toggle(item) {
@ -149,13 +177,7 @@
subFinsh(val) { subFinsh(val) {
const { orderStatus } = val const { orderStatus } = val
this.orderStatus = orderStatus.length ? orderStatus[0] : '' this.orderStatus = orderStatus.length ? orderStatus[0] : ''
this.getList() this.initList()
},
//
filter() {
const list = this.listAll
const { keyword } = this
this.list = list.filter(e => e.orderNumber.includes(keyword) || e.orderContent.includes(keyword))
}, },
// //
toDetail(item) { toDetail(item) {

@ -238,6 +238,9 @@
methods: { methods: {
// //
getInfo() { getInfo() {
uni.showLoading({
title: '加载中'
})
getDetail({ getDetail({
orderId: this.orderId orderId: this.orderId
}).then(({ orderDetails }) => { }).then(({ orderDetails }) => {
@ -247,7 +250,10 @@
this.courses = order.orderOther this.courses = order.orderOther
this.handleProduct(order.orderOther) this.handleProduct(order.orderOther)
this.calcTotal() this.calcTotal()
}).catch(e => {}) uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
}, },
// //
handleProduct(list) { handleProduct(list) {

@ -134,6 +134,9 @@
}, },
methods: { methods: {
getList() { getList() {
uni.showLoading({
title: '加载中'
})
getProductsSubscribedByCustomers({ getProductsSubscribedByCustomers({
customeId: this.customerId customeId: this.customerId
}).then(({ data }) => { }).then(({ data }) => {
@ -193,7 +196,10 @@
}) })
this.list = data this.list = data
this.listAll = data this.listAll = data
}).catch(e => {}) uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
}, },
// //
subFinsh(val) { subFinsh(val) {

@ -103,7 +103,6 @@
} }
], ],
reachBottom: 0, // 0->,1->,-1-> reachBottom: 0, // 0->,1->,-1->
isFilter: 0, // 0->,1->
status: 'more', // more|loading|noMore status: 'more', // more|loading|noMore
searchTimer: null, searchTimer: null,
orderStatus: '', orderStatus: '',

@ -183,6 +183,9 @@
methods: { methods: {
// //
getInfo() { getInfo() {
uni.showLoading({
title: '加载中'
})
queryCustomerDetails({ queryCustomerDetails({
customerId: this.customerId customerId: this.customerId
}).then(({ result }) => { }).then(({ result }) => {
@ -190,7 +193,10 @@
this.form = customer this.form = customer
!this.isDetail && customer.industryClassId && this.getIndustry() !this.isDetail && customer.industryClassId && this.getIndustry()
this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name this.customerType = this.customerTypeList.find(e => e.value === customer.customerType).name
}).catch(e => {}) uni.hideLoading()
}).catch(e => {
uni.hideLoading()
})
}, },
// //
getSchool() { getSchool() {

@ -131,11 +131,12 @@
// //
getAuth() { getAuth() {
uni.getStorageSync('token') && getUserRolesPermissionMenu({ uni.getStorageSync('token') && getUserRolesPermissionMenu({
teamId: this.teamId, teamId: this.list.find(e => e.teamId === this.teamId).partnerClassificationId,
platformId: 4 platformId: 4
}).then(({ permissionMenu }) => { }).then(({ permissionMenu }) => {
uni.hideLoading() uni.hideLoading()
const auth = [] const auth = []
//
const generateAuth = (list, parent) => { const generateAuth = (list, parent) => {
list.map(e => { list.map(e => {
const name = `${parent ? parent + ':' : ''}${e.name}` const name = `${parent ? parent + ':' : ''}${e.name}`
@ -162,7 +163,7 @@
data.map(e => { data.map(e => {
const n = e.partnerClassificationList const n = e.partnerClassificationList
e.id = n.id e.id = n.id
e.teamId = n.isTeam == 1 ? e.partnerClassificationId : n.id e.teamId = e.isTeam == 1 ? e.partnerClassificationId : n.id
e.partnerClassificationName = n.partnerClassificationName e.partnerClassificationName = n.partnerClassificationName
delete e.partnerClassificationList delete e.partnerClassificationList
}) })

Loading…
Cancel
Save