订单:试用默认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
data: options.data || {}, // 请求参数,默认空对象
success: ({ data }) => {
const { status, message } = data
const { status, message, code } = data
// 状态判断,根据后台定义并提示
if (status === 200) {
resolve(data)
} else if (status == 401) {
} else if (status == 401 || code === 401) {
if (!logouted) {
// 登录过期
uni.clearStorageSync()
uni.showToast({
title: message,
title: message || '登录过期,请重新登录',
icon: 'none'
})
setTimeout(() => {

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

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

@ -2,8 +2,15 @@
<view class="page">
<template v-for="c in courses">
<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="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>
</view>
<view v-show="!c.shrink">
<template v-for="(item, i) in c.list">
<view v-if="!item.edited" :key="i">
@ -21,7 +28,7 @@
</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')">
<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)">
<text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
@ -29,7 +36,7 @@
</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)">
<uni-datetime-picker type="date" v-model="item.startTime" :border="false" @change="dateChange(item)">
<view :class="['ph', {val: item.startTime}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view>
@ -130,10 +137,13 @@
courses['list' + this.$util.getOrderType(e.classificationId)] = {
shrink: false,
name: e.classificationName,
deadline: '',
unit: 2,
list: []
}
})
const { provinceId, cityId } = this
const isTrial = this.orderType == 2
list.map(async e => {
//
if (provinceId) {
@ -146,20 +156,45 @@
customerId: this.customerId,
productId: [e.mallId]
})
const item = res.orderOthers
if (item && item.length) {
let date = new Date(item[0].endTime)
date = new Date(date.setDate(date.getDate() + 1))
e.startTime = this.$util.formatDate(date, 'yyyy-MM-dd')
}
// 1
if (isTrial) {
this.calcDate(e, !e.authority)
}
courses['list' + e.authority].list.push(e)
})
this.courses = courses
}).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) {
const that = this
uni.showActionSheet({
@ -188,12 +223,15 @@
}
})
},
// 使
calcDate(row, fromData) {
console.log('row=>',row)
console.log('fromData=>',fromData)
// 使
dateChange(row, fromData) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.calcDate(row, fromData)
}, 500)
},
// 使
calcDate(row, fromData) {
const { periodOfUse, options } = row
let optionsData = 0
if (periodOfUse) {
@ -207,7 +245,6 @@
}
let time = new Date(row.startTime).getTime()
let endTime = time + optionsData
row.endTime = time + optionsData
let dt = new Date(endTime)
row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate())
let endYear = endTime - time
@ -249,12 +286,10 @@
}
//
this.calcDiscount(row)
}, 500)
},
//
dealSettlePrice(row) {
// 0
console.log('dealSettlePrice=>', row, this.orderType)
if (this.orderType != 1) {
row.settlementPrice = 0
row.serviceFee = 0
@ -272,7 +307,6 @@
1 :
row.accountNum)).toFixed((2))
row.settlementPrice = this.$util.handleNaN(sPrice)
console.log('dealSettlePrice2=>', row, this.$util.handleNaN(sPrice))
//
if (row.settlementPrice) {
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2)
@ -396,11 +430,27 @@
.l-title {
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 {
display: flex;

@ -60,8 +60,15 @@
<view id="products">
<template v-for="c in courseList">
<view v-if="c.list.length" class="block pro-wrap">
<view class="type-wrap">
<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>
</view>
<ul class="pro-list" v-show="!c.shrink">
<li v-for="(item, i) in c.list">
<view class="name">
@ -77,7 +84,7 @@
<view class="line">
<view class="label">起始日期</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}]">
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
</view>
@ -87,7 +94,7 @@
<view class="label">使用期限</view>
<view v-if="isDetail" class="ph">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view>
<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)">
<text>{{ units.find(e => e.id === item.options).text }}</text>
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image>
@ -193,7 +200,7 @@
<script>
import { productCategoryList, delCart } from '@/apis/modules/product.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'
export default {
data() {
@ -370,9 +377,12 @@
courses['list' + this.$util.getOrderType(e.classificationId)] = {
shrink: false,
name: e.classificationName,
deadline: '',
unit: 2,
list: []
}
})
const isTrial = this.form.orderType == 2
// 3push(0-> 1- 2 )
list.map(e => {
//
@ -384,6 +394,13 @@
e.copyInfo = e.shipContent || val.join(';')
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)
})
this.courseList = courses
@ -610,11 +627,16 @@
form.purchaseCost = Math.round(purchase)
form.profit = Math.round(profit)
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2)
console.log(111, this.courseList, this.courses)
},
calcDate(row, fromData) {
// 使
dateChange(row, fromData) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.calcDate(row, fromData)
}, 500)
},
// 使
calcDate(row, fromData) {
const { periodOfUse, options } = row
let optionsData = 0
if (periodOfUse) {
@ -670,7 +692,6 @@
}
//
this.calcDiscount(row)
}, 500)
},
dealSettlePrice(row) {
// 0
@ -694,7 +715,6 @@
//
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2)
this.calcAmount()
console.log('row.settlementPrice =>' ,row.settlementPrice,row.settlementPriceUnit,sPrice,row)
}
},
calcDiscount(row) {
@ -703,6 +723,29 @@
// (-)÷ x100%
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) {
const that = this
uni.showActionSheet({
@ -854,6 +897,27 @@
<style scoped lang="scss">
.page {
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 {
padding-bottom: 280rpx;
@ -876,11 +940,6 @@
margin: 0 24rpx;
}
}
.arrow {
position: absolute;
top: 20rpx;
right: 30rpx;
}
.pro-list {
.name {
display: flex;

Loading…
Cancel
Save