订单:试用默认1月,批量设置期限

master
yujialong 5 months ago
parent 960bd8ec5c
commit d5146fab77
  1. 6
      apis/request.js
  2. 5
      order/addCourse/addCourse.vue
  3. 6
      order/clientDetail/clientDetail.vue
  4. 84
      order/editCourse/editCourse.vue
  5. 83
      order/orderDetail/orderDetail.vue

@ -15,16 +15,16 @@ const request = options => {
method: options.method || 'GET', // 请求类型,默认为GET method: options.method || 'GET', // 请求类型,默认为GET
data: options.data || {}, // 请求参数,默认空对象 data: options.data || {}, // 请求参数,默认空对象
success: ({ data }) => { success: ({ data }) => {
const { status, message } = data const { status, message, code } = data
// 状态判断,根据后台定义并提示 // 状态判断,根据后台定义并提示
if (status === 200) { if (status === 200) {
resolve(data) resolve(data)
} else if (status == 401) { } else if (status == 401 || code === 401) {
if (!logouted) { if (!logouted) {
// 登录过期 // 登录过期
uni.clearStorageSync() uni.clearStorageSync()
uni.showToast({ uni.showToast({
title: message, title: message || '登录过期,请重新登录',
icon: 'none' icon: 'none'
}) })
setTimeout(() => { setTimeout(() => {

@ -213,7 +213,7 @@
dataOrCourseId: e.associatedProduct, // id dataOrCourseId: e.associatedProduct, // id
mallId: e.mallId, mallId: e.mallId,
productName: e.productName, // productName: e.productName, //
periodOfUse: '', // 使 periodOfUse: trial ? 1 : '', // 使
startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), // startTime: this.$util.formatDate(new Date(), 'yyyy-MM-dd'), //
endTime: '', // endTime: '', //
remainingPeriod: '', // remainingPeriod: '', //
@ -227,7 +227,7 @@
isEnable: 0, // 10 isEnable: 0, // 10
ship: 0, // 01 ship: 0, // 01
authority, // 01 authority, // 01
options: 2, options: trial ? 1 : 2,
miniProgramPictureAddress: e.appletIcon || '', // miniProgramPictureAddress: e.appletIcon || '', //
settlementPrice: trial ? 0 : '', // settlementPrice: trial ? 0 : '', //
settlementPriceUnit: e.settlementPrice || 0, // settlementPriceUnit: e.settlementPrice || 0, //
@ -321,6 +321,7 @@
this.handleRenew(4, customerId, list4, result, resolve, reject) this.handleRenew(4, customerId, list4, result, resolve, reject)
})) }))
Promise.all(promises).then(_ => { Promise.all(promises).then(_ => {
console.log(33, result)
uni.setStorageSync('courses', result) // uni.setStorageSync('courses', result) //
uni.redirectTo({ uni.redirectTo({
url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}` url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}`

@ -134,8 +134,8 @@
countries: '中国', countries: '中国',
customerId: '', customerId: '',
customerName: '', customerName: '',
industryClassId: '', industryClassId: 16,
industryId: '', industryId: 83,
provinceId: '', provinceId: '',
provinceName: '', provinceName: '',
account: '', account: '',
@ -169,7 +169,7 @@
this.shopCart = options.shopCart // this.shopCart = options.shopCart //
this.fromOrder = options.order // this.fromOrder = options.order //
options.customerId && this.getInfo() options.customerId ? this.getInfo() : this.getIndustry()
// //
if (!this.isDetail) { if (!this.isDetail) {
this.getSchool() this.getSchool()

@ -2,8 +2,15 @@
<view class="page"> <view class="page">
<template v-for="c in courses"> <template v-for="c in courses">
<view v-if="c.list.length && c.list.filter(e => !e.edited).length" class="block"> <view v-if="c.list.length && c.list.filter(e => !e.edited).length" class="block">
<view class="type-wrap">
<view class="l-title">{{ c.name }}</view> <view class="l-title">{{ c.name }}</view>
<view class="batch">
<input class="deadline" type="number" v-model="c.deadline" placeholder="批量输入" @change="batchDeadlineChange(c)">
<view class="unit" @click="batchUnitChange(c)">{{ units.find(e => e.id === c.unit).text }}</view>
</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> <uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
</view>
<view v-show="!c.shrink"> <view v-show="!c.shrink">
<template v-for="(item, i) in c.list"> <template v-for="(item, i) in c.list">
<view v-if="!item.edited" :key="i"> <view v-if="!item.edited" :key="i">
@ -21,7 +28,7 @@
</view> </view>
<view :class="['line req', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> <view :class="['line req', {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]">
<view class="name">使用期限</view> <view class="name">使用期限</view>
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> <input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="dateChange(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view class="val unit" @click="selectUnit(item)"> <view class="val unit" @click="selectUnit(item)">
<text>{{ units.find(e => e.id === item.options).text }}</text> <text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> <image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
@ -29,7 +36,7 @@
</view> </view>
<view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]"> <view :class="['line req', {err: err === 'startTime' + item.dataOrCourseId + item.authority}]">
<view class="name">起止日期</view> <view class="name">起止日期</view>
<uni-datetime-picker type="date" v-model="item.startTime" :border="false" @change="calcDate(item)"> <uni-datetime-picker type="date" v-model="item.startTime" :border="false" @change="dateChange(item)">
<view :class="['ph', {val: item.startTime}]"> <view :class="['ph', {val: item.startTime}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} {{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view> </view>
@ -130,10 +137,13 @@
courses['list' + this.$util.getOrderType(e.classificationId)] = { courses['list' + this.$util.getOrderType(e.classificationId)] = {
shrink: false, shrink: false,
name: e.classificationName, name: e.classificationName,
deadline: '',
unit: 2,
list: [] list: []
} }
}) })
const { provinceId, cityId } = this const { provinceId, cityId } = this
const isTrial = this.orderType == 2
list.map(async e => { list.map(async e => {
// //
if (provinceId) { if (provinceId) {
@ -146,20 +156,45 @@
customerId: this.customerId, customerId: this.customerId,
productId: [e.mallId] productId: [e.mallId]
}) })
const item = res.orderOthers const item = res.orderOthers
if (item && item.length) { if (item && item.length) {
let date = new Date(item[0].endTime) let date = new Date(item[0].endTime)
date = new Date(date.setDate(date.getDate() + 1)) date = new Date(date.setDate(date.getDate() + 1))
e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd') e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd')
} }
// 1
if (isTrial) {
this.calcDate(e, !e.authority)
}
courses['list' + e.authority].list.push(e) courses['list' + e.authority].list.push(e)
}) })
this.courses = courses this.courses = courses
}).catch(e => {}) }).catch(e => {})
// try {
// uni.removeStorageSync('courses')
// } catch (e) {}
}, },
//
batchDeadlineChange (c) {
c.list.map(e => {
e.periodOfUse = c.deadline
this.calcDate(e, !e.authority)
})
},
//
batchUnitChange(c) {
const that = this
uni.showActionSheet({
title: '标题',
itemList: that.unitText,
success: ({ tapIndex }) => {
c.unit = tapIndex
c.list.map(e => {
e.options = tapIndex
that.calcDate(e, !e.authority)
})
}
})
},
//
selectUnit(item) { selectUnit(item) {
const that = this const that = this
uni.showActionSheet({ uni.showActionSheet({
@ -188,12 +223,15 @@
} }
}) })
}, },
// 使 // 使
calcDate(row, fromData) { dateChange(row, fromData) {
console.log('row=>',row)
console.log('fromData=>',fromData)
clearTimeout(this.timer) clearTimeout(this.timer)
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.calcDate(row, fromData)
}, 500)
},
// 使
calcDate(row, fromData) {
const { periodOfUse, options } = row const { periodOfUse, options } = row
let optionsData = 0 let optionsData = 0
if (periodOfUse) { if (periodOfUse) {
@ -207,7 +245,6 @@
} }
let time = new Date(row.startTime).getTime() let time = new Date(row.startTime).getTime()
let endTime = time + optionsData let endTime = time + optionsData
row.endTime = time + optionsData
let dt = new Date(endTime) let dt = new Date(endTime)
row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate()) row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate())
let endYear = endTime - time let endYear = endTime - time
@ -249,12 +286,10 @@
} }
// //
this.calcDiscount(row) this.calcDiscount(row)
}, 500)
}, },
// //
dealSettlePrice(row) { dealSettlePrice(row) {
// 0 // 0
console.log('dealSettlePrice=>', row, this.orderType)
if (this.orderType != 1) { if (this.orderType != 1) {
row.settlementPrice = 0 row.settlementPrice = 0
row.serviceFee = 0 row.serviceFee = 0
@ -272,7 +307,6 @@
1 : 1 :
row.accountNum)).toFixed((2)) row.accountNum)).toFixed((2))
row.settlementPrice = this.$util.handleNaN(sPrice) row.settlementPrice = this.$util.handleNaN(sPrice)
console.log('dealSettlePrice2=>', row, this.$util.handleNaN(sPrice))
// //
if (row.settlementPrice) { if (row.settlementPrice) {
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2)
@ -396,11 +430,27 @@
.l-title { .l-title {
margin: 0 24rpx; margin: 0 24rpx;
} }
.type-wrap {
display: flex;
justify-content: space-between;
align-items: center;
}
.batch {
display: inline-flex;
align-items: center;
.deadline, .unit {
font-size: 28rpx;
color: #333;
}
.deadline {
width: 130rpx;
}
.unit {
min-width: 80rpx;
text-align: center;
}
} }
.arrow {
position: absolute;
top: 30rpx;
right: 30rpx;
} }
.pro-name { .pro-name {
display: flex; display: flex;

@ -60,8 +60,15 @@
<view id="products"> <view id="products">
<template v-for="c in courseList"> <template v-for="c in courseList">
<view v-if="c.list.length" class="block pro-wrap"> <view v-if="c.list.length" class="block pro-wrap">
<view class="type-wrap">
<view class="l-title">{{ c.name }}</view> <view class="l-title">{{ c.name }}</view>
<view v-if="!isDetail" class="batch">
<input class="deadline" type="number" v-model="c.deadline" placeholder="批量输入" @change="batchDeadlineChange(c)">
<view class="unit" @click="batchUnitChange(c)">{{ units.find(e => e.id === c.unit).text }}</view>
</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> <uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
</view>
<ul class="pro-list" v-show="!c.shrink"> <ul class="pro-list" v-show="!c.shrink">
<li v-for="(item, i) in c.list"> <li v-for="(item, i) in c.list">
<view class="name"> <view class="name">
@ -77,7 +84,7 @@
<view class="line"> <view class="line">
<view class="label">起始日期</view> <view class="label">起始日期</view>
<view v-if="isDetail || isEdit" class="ph">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view> <view v-if="isDetail || isEdit" class="ph">{{ 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)"> <uni-datetime-picker v-else type="date" v-model="item.startTime" :border="false" @change="dateChange(item)">
<view :class="['ph', {val: item.startTime}]"> <view :class="['ph', {val: item.startTime}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} {{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view> </view>
@ -87,7 +94,7 @@
<view class="label">使用期限</view> <view class="label">使用期限</view>
<view v-if="isDetail" class="ph">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view> <view v-if="isDetail" class="ph">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view>
<template v-else> <template v-else>
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> <input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="dateChange(item, !item.authority)" @change="handleErr(item, 'periodOfUse')">
<view class="val unit" @click="selectUnit(item)"> <view class="val unit" @click="selectUnit(item)">
<text>{{ units.find(e => e.id === item.options).text }}</text> <text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> <image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
@ -193,7 +200,7 @@
<script> <script>
import { productCategoryList, delCart } from '@/apis/modules/product.js' import { productCategoryList, delCart } from '@/apis/modules/product.js'
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js' import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js'
import { add, update, getDetail, renew, queryCitySettlementPrice, getOrderOtherTime } from '@/apis/modules/order.js' import { add, getDetail, renew, queryCitySettlementPrice, getOrderOtherTime } from '@/apis/modules/order.js'
import { getPartnerTeamRates } from '@/apis/modules/parner.js' import { getPartnerTeamRates } from '@/apis/modules/parner.js'
export default { export default {
data() { data() {
@ -370,9 +377,12 @@
courses['list' + this.$util.getOrderType(e.classificationId)] = { courses['list' + this.$util.getOrderType(e.classificationId)] = {
shrink: false, shrink: false,
name: e.classificationName, name: e.classificationName,
deadline: '',
unit: 2,
list: [] list: []
} }
}) })
const isTrial = this.form.orderType == 2
// 3push(0-> 1- 2 ) // 3push(0-> 1- 2 )
list.map(e => { list.map(e => {
// //
@ -384,6 +394,13 @@
e.copyInfo = e.shipContent || val.join(';') e.copyInfo = e.shipContent || val.join(';')
e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // != 0 && e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // != 0 &&
// 1
if (isTrial) {
e.periodOfUse = 1
e.options = 1
this.calcDate(e, !e.authority)
}
courses['list' + e.authority].list.push(e) courses['list' + e.authority].list.push(e)
}) })
this.courseList = courses this.courseList = courses
@ -610,11 +627,16 @@
form.purchaseCost = Math.round(purchase) form.purchaseCost = Math.round(purchase)
form.profit = Math.round(profit) form.profit = Math.round(profit)
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2)
console.log(111, this.courseList, this.courses)
}, },
calcDate(row, fromData) { // 使
dateChange(row, fromData) {
clearTimeout(this.timer) clearTimeout(this.timer)
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.calcDate(row, fromData)
}, 500)
},
// 使
calcDate(row, fromData) {
const { periodOfUse, options } = row const { periodOfUse, options } = row
let optionsData = 0 let optionsData = 0
if (periodOfUse) { if (periodOfUse) {
@ -670,7 +692,6 @@
} }
// //
this.calcDiscount(row) this.calcDiscount(row)
}, 500)
}, },
dealSettlePrice(row) { dealSettlePrice(row) {
// 0 // 0
@ -694,7 +715,6 @@
// //
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2)
this.calcAmount() this.calcAmount()
console.log('row.settlementPrice =>' ,row.settlementPrice,row.settlementPriceUnit,sPrice,row)
} }
}, },
calcDiscount(row) { calcDiscount(row) {
@ -703,6 +723,29 @@
// (-)÷ x100% // (-)÷ x100%
if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%' if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%'
}, },
//
batchDeadlineChange (c) {
c.list.map(e => {
e.periodOfUse = c.deadline
this.calcDate(e, !e.authority)
})
},
//
batchUnitChange(c) {
const that = this
uni.showActionSheet({
title: '标题',
itemList: that.unitText,
success: ({ tapIndex }) => {
c.unit = tapIndex
c.list.map(e => {
e.options = tapIndex
that.calcDate(e, !e.authority)
})
}
})
},
//
selectUnit(item) { selectUnit(item) {
const that = this const that = this
uni.showActionSheet({ uni.showActionSheet({
@ -854,6 +897,27 @@
<style scoped lang="scss"> <style scoped lang="scss">
.page { .page {
padding-bottom: 420rpx; padding-bottom: 420rpx;
.type-wrap {
display: flex;
justify-content: space-between;
align-items: center;
}
.batch {
display: inline-flex;
align-items: center;
.deadline, .unit {
font-size: 28rpx;
color: #333;
}
.deadline {
width: 130rpx;
}
.unit {
min-width: 80rpx;
text-align: center;
}
}
} }
.show { .show {
padding-bottom: 280rpx; padding-bottom: 280rpx;
@ -876,11 +940,6 @@
margin: 0 24rpx; margin: 0 24rpx;
} }
} }
.arrow {
position: absolute;
top: 20rpx;
right: 30rpx;
}
.pro-list { .pro-list {
.name { .name {
display: flex; display: flex;

Loading…
Cancel
Save