订单增加处理、编辑、续费等功能

master
yujialong 2 years ago
parent 1cd4b94cfe
commit 801b41325c
  1. 4
      apis/modules/order.js
  2. 4
      config/request.js
  3. 4
      manifest.json
  4. 3
      order/addCourse/addCourse.vue
  5. 18
      order/editCourse/editCourse.vue
  6. 198
      order/orderDetail/orderDetail.vue
  7. 149
      order/orders/orders.vue
  8. 2
      pages.json
  9. 2
      pages/qrcode/qrcode.vue
  10. 11
      pages/teams/teams.vue

@ -33,6 +33,10 @@ export const del = (data) => {
return post('nakadai/nakadai/order/delete', data)
}
export const ship = (data) => {
return post('nakadai/nakadai/orderOther/ship', data)
}
export const miniProgramOrderRecord = (data) => {
return post('nakadai/nakadai/applets/order/miniProgramOrderRecord', data)
}

@ -5,9 +5,9 @@
*/
export default {
baseURL: 'https://huorantech.cn/',
// baseURL: 'https://huorantech.cn/',
// baseURL: 'http://192.168.31.137:9000/',
// baseURL: 'http://121.37.12.51/',
baseURL: 'http://121.37.12.51/',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},

@ -48,9 +48,9 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx88cd6037d54f230a",
"appid" : "wx77a8a2a23138998b",
"setting" : {
"urlCheck" : false,
"urlCheck" : true,
"es6" : true,
"minified" : true
},

@ -235,11 +235,12 @@
productId
}).then(({ orderOthers }) => {
result.map(e => {
const item = orderOthers.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority)
const item = orderOthers.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority == e.authority)
if (item) {
let date = new Date(item.endTime)
date = new Date(date.setDate(date.getDate() + 1))
e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd')
e.renew = 1
}
})
resolve()

@ -20,15 +20,17 @@
</view>
<view :class="['line req', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]">
<view class="name">使用期限</view>
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view class="val unit" @click="selectUnit(item)">
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" :disabled="isEdit" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view v-if="isEdit">{{ units.find(e => e.id === item.options).text }}</view>
<view v-else class="val unit" @click="selectUnit(item)">
<text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
</view>
</view>
<view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]">
<view class="name">起止日期</view>
<uni-datetime-picker type="date" v-model="item.startTime" :border="false" @change="calcDate(item)">
<view v-if="isEdit">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view>
<uni-datetime-picker v-else type="date" v-model="item.startTime" :border="false" @change="calcDate(item)">
<view :class="['ph', {val: item.startTime}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view>
@ -58,7 +60,7 @@
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]">
<view class="name">成交价</view>
<view class="inline">
<input type="number" v-model="item.finalPrice" placeholder="请输入" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')">
<input type="number" v-model="item.finalPrice" placeholder="请输入" :disabled="isEdit && !item.authority" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')">
</view>
</view>
@ -78,6 +80,10 @@
export default {
data() {
return {
isAdd: 0, //
isEdit: 0, //
isHandle: 0, //
isRenew: 0, //
orderType: 1,
customerId: '',
timer: null,
@ -117,6 +123,10 @@
const { options } = pages[pages.length - 1]
this.orderType = options.orderType
this.customerId = options.customerId
this.isEdit = options.action === 'edit'
this.isHandle = options.action === 'handle'
this.isRenew = options.action === 'renew'
this.isAdd = options.action === 'add'
this.handleProduct()
},
methods: {

@ -9,7 +9,7 @@
</view>
<view :class="['line req', {err: err === 'customerName'}]">
<view class="name">客户名称</view>
<view v-if="isDetail" class="val">{{ form.customerName }}</view>
<view v-if="orderId" class="val">{{ form.customerName }}</view>
<view v-else :class="['ph', {val: form.customerName}]" @click="customerVisible = true">{{ form.customerName || '请选择客户' }}</view>
</view>
<view class="line">
@ -52,46 +52,55 @@
</view>
</view>
<template v-for="c in courseList">
<template v-for="(c, n) in courseList">
<view v-if="c.list.length" class="block pro-wrap" id="products">
<view class="l-title">{{ c.name }}</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
<ul class="pro-list" v-show="!c.shrink">
<li v-for="(item, i) in c.list" @click.stop="editCourse(c, i)">
<view class="name">
<view class="left">
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image>
{{ item.productName }}
</view>
<image v-if="!isDetail" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image>
</view>
<view class="info">
<view class="line">
<view class="label">使用期限</view>
<view class="val">{{ item.startTime + ' - ' + item.endTime }}</view>
</view>
<view class="line">
<view class="label">市场价</view>
<view class="val">{{ item.marketValue }}</view>
</view>
<view class="line">
<view class="label">结算价</view>
<view class="val">{{ item.settlementPrice }}</view>
</view>
<view class="line">
<view class="label">折扣率</view>
<view class="val">{{ item.discountRate }}</view>
</view>
<view class="line">
<view class="label">平台服务费</view>
<view class="val">{{ item.serviceFee }}</view>
</view>
<view class="line done">
<view class="val">成交价格</view>
<view class="price">{{ item.finalPrice }}</view>
</view>
</view>
</li>
<uni-swipe-action>
<uni-swipe-action-item
v-for="(item, i) in c.list"
:threshold="0"
:right-options="item.ops"
@click="e => productHandle(e, n, i)"
>
<li @click.stop="editCourse(c, i)">
<view class="name">
<view class="left">
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image>
{{ item.productName }}
</view>
<image v-if="!isDetail && !isEdit" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image>
</view>
<view class="info">
<view class="line">
<view class="label">使用期限</view>
<view class="val">{{ item.startTime + ' - ' + item.endTime }}</view>
</view>
<view class="line">
<view class="label">市场价</view>
<view class="val">{{ item.marketValue }}</view>
</view>
<view class="line">
<view class="label">结算价</view>
<view class="val">{{ item.settlementPrice }}</view>
</view>
<view class="line">
<view class="label">折扣率</view>
<view class="val">{{ item.discountRate }}</view>
</view>
<view class="line">
<view class="label">平台服务费</view>
<view class="val">{{ item.serviceFee }}</view>
</view>
<view class="line done">
<view class="val">成交价格</view>
<view class="price">{{ item.finalPrice }}</view>
</view>
</view>
</li>
</uni-swipe-action-item>
</uni-swipe-action>
</ul>
</view>
</template>
@ -137,11 +146,14 @@
<script>
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js'
import { add, update, getDetail } from '@/apis/modules/order.js'
import { add, update, getDetail, renew, ship } from '@/apis/modules/order.js'
export default {
data() {
return {
isDetail: false,
isEdit: 0, //
isHandle: 0, //
isRenew: 0, //
orderId: '',
orderTypes: [{
text: '正式',
@ -186,7 +198,8 @@
searchTimer: null,
customerList: [],
customerListAll: [],
err: ''
err: '',
promises: [],
}
},
watch: {
@ -202,6 +215,9 @@
const { options } = pages[pages.length - 1]
this.orderId = options.orderId
this.isDetail = !!options.show
this.isEdit = options.text === '修改'
this.isHandle = options.text === '处理'
this.isRenew = options.text === '续费'
const store = uni.getStorageSync('courses')
if (this.orderId) {
this.getInfo()
@ -231,9 +247,7 @@
})
}
//
if (!this.isDetail) {
this.getCustomer()
}
this.isDetail || this.getCustomer()
//
uni.setNavigationBarTitle({
title: this.orderId ?
@ -253,12 +267,17 @@
orderId: this.orderId
}).then(({ orderDetails }) => {
const order = orderDetails
this.contract = order.contractInformation
if (!this.isRenew) this.contract = order.contractInformation //
this.form = order.order
this.courses = order.orderOther
this.handleProduct(order.orderOther)
this.calcTotal()
uni.hideLoading()
this.handleRenew(0)
this.handleRenew(1)
this.handleRenew(2)
Promise.all(this.promises).then(_ => {
this.handleProduct(this.courses)
this.calcTotal()
uni.hideLoading()
})
}).catch(e => {
uni.hideLoading()
})
@ -294,6 +313,68 @@
})
this.courseList = courses
},
//
handleRenew(authority) {
const productId = this.courses.filter(e => e.authority == authority).map(e => e.dataOrCourseId)
productId.length && this.promises.push(new Promise((resolve, reject) => {
renew({
authority,
customerId: this.form.customerId,
productId
}).then(({ orderOthers }) => {
const { courses } = this
const now = new Date()
orderOthers.map(e => {
const item = courses.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority)
if (item) {
if (this.isRenew) { //
let date = new Date(e.endTime)
if (now < date) { // +1
date = new Date(date.setDate(date.getDate() + 1))
item.startTime = this.$util.formatDate(date, 'yyyy-MM-dd')
console.log(444, item, now < date,date,e.startTime)
} else { //
item.startTime = this.$util.formatDate(now, 'yyyy-MM-dd')
}
item.endTime = ''
item.periodOfUse = ''
item.marketValue = e.marketValue
} else if (!this.isDetail) { //
item.startTime = e.startTime.split(' ')[0]
item.endTime = e.endTime.split(' ')[0]
}
}
const startTime = new Date(item.startTime)
const endTime = new Date(item.endTime)
// 1: 23
item.status = now < startTime ?
1 :
now > startTime && now < endTime ?
2 :
3
if (item.status === 3) item.isEnable = 0 //
// 1
// 2
// 3
this.$set(item, 'ops', this.isDetail ?
[] :
[{
text: item.status === 1 || this.isHandle || !this.orderId ?
item.ship ? '取消发货' : '发货' :
item.isEnable ? '禁用' : '启用',
style: {
backgroundColor: '#34b3fd'
}
}],
)
})
resolve()
}).catch(e => {
reject()
})
}))
},
//
getCustomer() {
queryCustomer({
@ -354,7 +435,7 @@
if (this.isDetail) return false
uni.setStorageSync('courses', this.courses)
const { customerId, orderType } = this.form
this.$util.to(`../editCourse/editCourse?orderType=${orderType}&customerId=${customerId}`)
this.$util.to(`../editCourse/editCourse?orderType=${orderType}&customerId=${customerId}&action=${this.isEdit ? 'edit' : this.isRenew ? 'renew' : this.isHandle ? 'handle' : !this.orderId ? 'add' : ''}`)
},
//
delCourse(c, i) {
@ -382,6 +463,22 @@
toggle(c) {
c.shrink = !c.shrink
},
//
productHandle(e, n, i) {
const row = this.courseList[n].list[i]
const { text } = e.content
if (text === '发货' || text === '取消发货') {
row.ship = text === '发货' ? 1 : 0
this.isEdit && ship(row).then(res => {}).catch(res => {})
row.ops[0].text = text === '发货' ? '取消发货' : '发货'
console.log(444, row.ops)
} else {
row.isEnable = text === '启用' ? 1 : 0
row.ops[0].text = text === '启用' ? '禁用' : '启用'
}
this.courseList[n].list[i] = row
console.log(111,row, this.courseList)
},
//
calcTotal(out) {
this.handleErr('orderType')
@ -426,7 +523,8 @@
},
//
submit() {
const { form, courses } = this
const { form } = this
const courses = []
if (!form.customerId) {
this.err = 'customerName'
return this.$util.errMsg('请选择客户!')
@ -435,10 +533,14 @@
this.err = 'orderType'
return this.$util.errMsg('请选择订单类型!')
}
for (const i in this.courseList) {
courses.push(...this.courseList[i].list)
}
if (!courses.length) return this.$util.errMsg('请选择课程权限或数据权限后再确认订单!')
courses.map(e => {
e.startTime = this.$util.formatDate(new Date(e.startTime), 'yyyy-MM-dd')
})
if (this.isRenew || courses.some(e => e.renew)) form.orderNature = 2
uni.showLoading({
title: '提交中'
})

@ -15,8 +15,8 @@
<uni-swipe-action-item
v-for="item in list"
:threshold="0"
:right-options="delOption"
@click="del(item)"
:right-options="item.ops"
@click="e => handle(e, item)"
>
<view class="item" @click="toDetail(item)">
<view class="c-name">{{ item.orderNumber }}</view>
@ -47,7 +47,7 @@
</view>
</view>
<view :class="['type', 'type' + item.orderStatus]">
{{ filterData[0].data.find(e => e.value === item.orderStatus).title }}
{{ filterData[1].data.find(e => e.value === item.orderStatus).title }}
</view>
</view>
</view>
@ -60,11 +60,21 @@
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../orderDetail/orderDetail')"></uni-icons>
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
<view class="popup-mask" v-show="schoolVisible" @click="closeSchool"></view>
<view class="popup" v-show="schoolVisible">
<view class="top">请选择学校</view>
<uni-icons class="close" type="closeempty" size="20" @click="closeSchool"></uni-icons>
<uni-search-bar class="search" radius="5" placeholder="请输入学校名称" v-model="keyword" clearButton="auto" cancelButton="none" />
<view class="list">
<view class="item" v-for="item in schoolList" @click="schoolChange(item)">{{ item.schoolName }}</view>
</view>
</view>
</view>
</template>
<script>
import { queryCustomer } from '@/apis/modules/client.js'
import { querySchool, queryCustomer } from '@/apis/modules/client.js'
import { list, del } from '@/apis/modules/order.js'
export default {
data() {
@ -72,6 +82,23 @@
popup: false,
//
filterData: [
{
children: false,//
title: "订单类型",
key: "orderType", //
keyValue: "value", //
isRadio: true, //
data: [
{
title: "正式",
value: 1
},
{
title: "试用",
value: 2
},
],
},
{
children: false,//
title: "订单状态",
@ -105,18 +132,38 @@
reachBottom: 0, // 0->,1->,-1->
status: 'more', // more|loading|noMore
searchTimer: null,
orderType: '',
orderStatus: '',
sort: 'desc',
keyword: '',
list: [],
page: 1,
pageSize: 10,
delOption: [{
text: '删除',
style: {
backgroundColor: '#F56C6C'
}
}],
ops: [
{
text: '处理',
style: {
backgroundColor: '#e08443'
}
},
{
text: '修改',
style: {
backgroundColor: '#46c58b'
}
},
{
text: '续费',
style: {
backgroundColor: '#34b3fd'
}
},
],
schoolVisible: false,
keywordSchool: '',
searchTimerSchool: null,
schoolList: [],
schoolListAll: [],
}
},
watch: {
@ -148,6 +195,7 @@
uni.removeStorageSync('courses')
} catch (e) {}
this.initRole()
this.getSchool()
},
methods: {
//
@ -178,6 +226,7 @@
pageNum: this.page,
pageSize: this.pageSize,
sort: this.sort,
orderType: this.orderType,
orderStatus: this.orderStatus,
type: this.curTab
}
@ -188,7 +237,20 @@
uni.hideLoading()
// list
const list = data.records
const { ops } = this
list.map(e => {
const op = []
if (e.isDel !== 1) {
op.push(ops[e.orderStatus === 1 ? 1 : 0])
e.orderStatus === 1 && op.push(ops[2])
}
op.push({
text: '删除',
style: {
backgroundColor: '#F56C6C'
}
})
e.ops = op
e.toggle = e.orderContent.length < 14 // 14
})
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list
@ -210,8 +272,9 @@
item.toggle = !item.toggle
},
//
subFinsh(val) {
const { orderStatus } = val
subFinsh(e) {
const { orderType, orderStatus } = e
this.orderType = orderType.length ? orderType[0] : ''
this.orderStatus = orderStatus.length ? orderStatus[0] : ''
this.initList()
},
@ -220,6 +283,33 @@
this.sort = this.sort === 'desc' ? 'asc' : 'desc'
this.initList()
},
//
getSchool() {
querySchool({
schoolName: '',
provinceId: '',
cityId: ''
}).then(({ list }) => {
this.schoolListAll = list
this.schoolList = list
}).catch(res => {})
},
//
filterSchool() {
const { keywordSchool } = this
this.schoolList = keywordSchool ?
this.schoolListAll.filter(e => e.schoolName.includes(keywordSchool)) :
this.schoolListAll
},
//
closeSchool() {
this.schoolVisible = false
this.keywordSchool = ''
},
//
schoolChange(school) {
this.closeSchool()
},
// tab
tabChange(tab) {
this.curTab = tab.id
@ -230,22 +320,27 @@
this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`)
},
//
del(e) {
const that = this
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success(res) {
if (res.confirm) {
del({
ids: [e.orderId]
}).then(res => {
that.$util.sucMsg('删除成功')
that.initList()
}).catch(res => {})
handle(e, row) {
const { text } = e.content
if (text === '删除') {
const that = this
uni.showModal({
title: '提示',
content: '确定要删除吗?',
success(res) {
if (res.confirm) {
del({
ids: [row.orderId]
}).then(res => {
that.$util.sucMsg('删除成功')
that.initList()
}).catch(res => {})
}
}
}
})
})
} else {
this.$util.to(`../orderDetail/orderDetail?orderId=${row.orderId}&text=${text}`)
}
},
}
}

@ -180,7 +180,7 @@
"enablePullDownRefresh": false
}
}
]
]
}],
"preloadRule": {
"order/orders/orders": {

@ -45,7 +45,7 @@
const date = new Date(Date.now() + expireTime * 1000) // *1000
this.expireTime = `${date.getFullYear()}-${this.$util.preZero(date.getMonth() + 1)}-${this.$util.preZero(date.getDate())} ${this.$util.preZero(date.getHours())}:${this.$util.preZero(date.getMinutes())}:${this.$util.preZero(date.getMinutes())}`
const team = this.team
this.link = `https://huorantech.cn/#/join?accountId=${team.accountId}&id=${team.teamId}&isTeam=0`
this.link = `https://huorantech.cn/#/join?accountId=${team.accountId}&id=${team.teamId}&isTeam=0&teamName=${team.partnerClassificationName}`
// this.link = `http://192.168.31.125:8086/#/join?accountId=${team.accountId}&id=${team.teamId}&isTeam=0`
}).catch(e => {})
},

@ -1,7 +1,7 @@
<template>
<view>
<uni-card :is-shadow="false" :border="false" is-full spacing="0" margin="20">
<uni-search-bar class="search" radius="30" placeholder="请输入成员名称" clearButton="auto" cancelButton="none" v-model="keyword" />
<uni-search-bar class="search" radius="30" placeholder="请输入团队、合伙人名字" clearButton="auto" cancelButton="none" v-model="keyword" />
</uni-card>
<template v-if="list.length">
@ -18,6 +18,15 @@
<text class="name">加入时间</text>
<text class="val">{{ item.lastLoginTime.split(' ')[0] }}</text>
</view>
<view class="line">
<text class="name">所属区域</text>
</view>
<view class="line">
<text class="name">团队成员</text>
</view>
<view class="line">
<text class="name">邀请人</text>
</view>
</view>
</li>
</ul>

Loading…
Cancel
Save