From 5d86d49479ca93097759d85de1bf440fd53c3f33 Mon Sep 17 00:00:00 2001
From: wangchenguang <728837162@qq.com>
Date: Fri, 21 Apr 2023 14:56:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apis/modules/parner.js | 2 +-
config/request.js | 4 +-
order/editCourse/editCourse.vue | 19 ++-
order/orderDetail/orderDetail.vue | 254 +++++++++++++++++++++++++++-
order/orders/orders.vue | 2 +-
pages/clientDetail/clientDetail.vue | 10 +-
pages/clients/clients.vue | 2 +-
static/image/edit.png | Bin 0 -> 843 bytes
8 files changed, 276 insertions(+), 17 deletions(-)
create mode 100644 static/image/edit.png
diff --git a/apis/modules/parner.js b/apis/modules/parner.js
index 51ff78a..b6a7e9d 100644
--- a/apis/modules/parner.js
+++ b/apis/modules/parner.js
@@ -39,4 +39,4 @@ export const queryTeamMembers = (data) => {
export const updatePartner = (data) => {
return post('nakadai/nakadai/partnerClassification/update', data)
-}
\ No newline at end of file
+}
diff --git a/config/request.js b/config/request.js
index 6748186..042bc89 100644
--- a/config/request.js
+++ b/config/request.js
@@ -5,9 +5,9 @@
*/
export default {
- baseURL: 'https://huorantech.cn/',
+ // baseURL: 'https://huorantech.cn/',
// baseURL: 'http://192.168.31.151:9000/',
- // baseURL: 'http://121.37.12.51/',
+ baseURL: 'http://121.37.12.51/',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},
diff --git a/order/editCourse/editCourse.vue b/order/editCourse/editCourse.vue
index 6cd791e..731f36d 100644
--- a/order/editCourse/editCourse.vue
+++ b/order/editCourse/editCourse.vue
@@ -18,7 +18,7 @@
产品类型
{{ productTypes.find(e => e.id === item.productType).name }}
-
+
使用期限
{{ units.find(e => e.id === item.options).text }}
@@ -118,7 +118,7 @@
courses: {} , // 上一页缓存的产品
orderRepeat: [],
repeatMsg: '',
- err: ''
+ err: '',
}
},
onShow() {
@@ -163,6 +163,21 @@
courses.data.list.push(e)
})
+ // let selectData= []
+ // let itemIndex = ''
+ // for (let item in courses) {
+ // if(courses[item].list.length) {
+ // const data = courses[item].list.find(options=>{
+ // if(options.id == this.editId) {
+ // itemIndex = item
+ // }
+ // return options.id == this.editId
+ // })
+ // selectData.push(data)
+ // break
+ // }
+ // }
+ // courses[itemIndex].list = selectData
this.courses = courses
try {
uni.removeStorageSync('courses')
diff --git a/order/orderDetail/orderDetail.vue b/order/orderDetail/orderDetail.vue
index 2da3736..6e1743a 100644
--- a/order/orderDetail/orderDetail.vue
+++ b/order/orderDetail/orderDetail.vue
@@ -63,7 +63,8 @@
{{ c.name }}
- -
+
+
-
@@ -78,18 +79,44 @@
+
+ 起始日期
+
+ {{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
+
+
+ {{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}
+
+
+
+
使用期限
- {{ item.startTime + (item.endTime && ' - ' + item.endTime) }}
+
+ {{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}
+
+
+ {{ units.find(e => e.id === item.options).text }}
+
+
+
+
+ 数量
+ 1
+
- 市场价(元)
+ {{ item.authority ? '市场价' : '市场单价' }}
{{ item.marketValue || 0 }}元
结算价
- {{ item.settlementPrice }}元
+ {{ item.settlementPrice }}
+
+
+ 元
+
折扣率
@@ -99,9 +126,13 @@
平台服务费
{{ item.serviceFee }}元
-
- 成交价格
- {{ item.finalPrice }}元
+
+ 成交价
+ {{ item.finalPrice }}
+
+
+ 元
+
@@ -142,11 +173,11 @@
-
+
修改
-
+
续费
@@ -178,6 +209,7 @@
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js'
import { add, update, del, getDetail, renew, ship, miniProgramOrderRecord, bulkShipping } from '@/apis/modules/order.js'
import { teamList, getAllTeam } from '@/apis/modules/parner.js'
+ import { getOrderOtherTime } from '@/apis/modules/order.js'
export default {
data() {
return {
@@ -193,6 +225,7 @@
text: '试用',
value: 2
}],
+
form: {
businessManagerId: '',
businessManagerName: '',
@@ -234,6 +267,18 @@
customerListAll: [],
err: '',
promises: [],
+ orderRepeat:[],
+ units: [{
+ text: '日',
+ id: 0
+ }, {
+ text: '月',
+ id: 1
+ }, {
+ text: '年',
+ id: 2
+ }],
+ unitText: ['日', '月', '年'],
}
},
watch: {
@@ -675,6 +720,158 @@
uni.hideLoading()
})
}
+ },
+ calcDate(row, fromData) {
+ clearTimeout(this.timer)
+ this.timer = setTimeout(() => {
+ const { periodOfUse, options } = row
+ let optionsData = 0
+ if (periodOfUse) {
+ if (options == 1){
+ optionsData = periodOfUse === '12' ? 31536000000 : periodOfUse*30*24*60*60*1000
+ } else if (options == 2){
+ optionsData = periodOfUse*365*24*60*60*1000
+ } else {
+ optionsData = periodOfUse*24*60*60*1000
+ }
+ }
+ 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
+ let endYears = endYear/1000/60/60/24
+ row.remainingPeriod = endYears
+ const unit = row.options // 使用期限单位
+ const useUnit = row.periodOfUse // 使用期限
+ // 计算市场价
+ const price = row.marketPrice // 市场单价
+ // 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12)
+ row.marketValue = (!unit ?
+ price / 365 * useUnit :
+ unit === 1 ?
+ price / 12 * useUnit :
+ price * useUnit).toFixed(2)
+ this.dealSettlePrice(row)
+ // 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存
+ if (!fromData) {
+ const cId = row.dataOrCourseId
+ const date = new Date(row.startTime)
+ const orderRepeat = this.orderRepeat
+ getOrderOtherTime({
+ customerId: this.customerId,
+ id: cId,
+ startTime: this.$util.formatDate(date, 'yyyy-MM-dd'),
+ endTime: row.endTime
+ }).then(res => {
+ orderRepeat.includes(cId) && orderRepeat.splice(orderRepeat.findIndex(e => e === cId), 1)
+ if (res.endTime) {
+ let time = new Date(res.endTime)
+ time = new Date(time.setDate(time.getDate() + 1))
+ row.startTime = this.$util.formatDate(time, 'yyyy-MM-dd')
+ }
+ }).catch(res => {
+ this.repeatMsg = res.message
+ orderRepeat.includes(cId) || orderRepeat.push(cId)
+ })
+ }
+ // 折扣率
+ this.calcDiscount(row)
+ }, 500)
+ },
+ dealSettlePrice(row) {
+ // 如果是试用,结算价和平台服务费都是0
+ if (this.orderType == 2) {
+ row.settlementPrice = 0
+ row.serviceFee = 0
+ } else {
+ const unit = row.options // 使用期限单位
+ const useUnit = row.periodOfUse // 使用期限
+ let sPrice = ''
+ if (row.settlementMethod == 0) {
+ // 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量)
+ const priceUnit = row.settlementPriceUnit
+ sPrice = ((!unit ?
+ priceUnit / 365 * useUnit :
+ unit === 1 ?
+ priceUnit / 12 * useUnit :
+ priceUnit * useUnit) * (row.authority ?
+ 1 :
+ row.accountNum)).toFixed((2))
+ } else {
+ // 比例分成。计算规则:成交价*商务分成比例
+ sPrice = (row.finalPrice * row.businessProportion / 100).toFixed((2))
+ }
+ row.settlementPrice = this.$util.handleNaN(sPrice)
+ // 平台服务费(结算价*10%)
+ console.log('row.settlementPrice =>' ,row.settlementPrice)
+ if (row.settlementPrice) {
+ console.log(2222)
+ row.serviceFee = (row.settlementPrice * 0.1).toFixed(2)
+ }else {
+ console.log(1111111)
+ row.serviceFee = 0
+ }
+ }
+ },
+ calcDiscount(row) {
+ const price = row.authority ? row.finalPrice : row.finalValue
+ const { marketValue } = row
+ // (原价-现价)÷原价 x100%
+ if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%'
+ },
+ selectUnit(item) {
+ const that = this
+ uni.showActionSheet({
+ title: '标题',
+ itemList: that.unitText,
+ success: ({ tapIndex }) => {
+ item.options = tapIndex
+ that.calcDate(item)
+ }
+ })
+ },
+ // 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算)
+ calcFinalValue(row) {
+ clearTimeout(this.timer)
+ this.timer = setTimeout(() => {
+ const { authority, periodOfUse, options, accountNum, finalPrice } = row
+ if (!authority && periodOfUse && accountNum && finalPrice) {
+ row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2)
+ }
+ // 折扣率
+ this.calcDiscount(row)
+ this.dealSettlePrice(row)
+ }, 500)
+ },
+ // 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算)
+ calcFinalPrice(row) {
+ clearTimeout(this.timer)
+ this.timer = setTimeout(() => {
+ const { finalValue, accountNum, periodOfUse, finalPrice } = row
+ if (periodOfUse) {
+ if (accountNum) {
+ // 有成交单价,则成交价=成交单价*账号数*时间
+ if (finalValue) {
+ row.finalPrice = Math.round(finalValue * periodOfUse * accountNum)
+ } else if (!finalValue && finalPrice) {
+ // 有成交价,没有成交单价,则成交单价=成交价/账号数/时间
+ row.finalValue = (finalPrice / periodOfUse / accountNum).toFixed(2)
+ this.calcDiscount(row)
+ }
+ } else if (finalValue && finalPrice && !row.authority) {
+ // 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价
+ row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue)
+ }
+ }
+ this.dealSettlePrice(row)
+ }, 500)
+ },
+ // 结算价修改后计算平台服务费
+ updateServiceFee(options) {
+ options.serviceFee = (options.settlementPrice * 0.1).toFixed(2)
+ console.log('options===>',options)
}
}
}
@@ -715,6 +912,7 @@
.left {
display: inline-flex;
align-items: center;
+ max-width: 480rpx;
}
.course-action {
display: inline-flex;
@@ -865,4 +1063,42 @@
background-color: #007EFF;
}
}
+.unit {
+ display: inline-flex;
+ align-items: center;
+ .icon {
+ width: 28rpx;
+ margin-left: 20rpx;
+ }
+ input {
+ font-size: 28rpx;
+ }
+ text{
+ font-size: 28rpx;
+ }
+}
+.line {
+ .inline {
+ display: flex;
+ align-items: center;
+ font-size: 28rpx;
+ input {
+ text-align: right;
+ margin-right: 10rpx;
+ margin-left: 20rpx;
+ color: #333;
+ }
+ }
+}
+.period{
+ display: inline-block;
+ text-align: right;
+ margin-right: 10rpx;
+ margin-left: 20rpx;
+ color: #333;
+ width: 60%;font-size: 28rpx;
+}
+.defaultBox {
+ font-size: 28rpx;
+}
diff --git a/order/orders/orders.vue b/order/orders/orders.vue
index 98bc04f..d79a6bd 100644
--- a/order/orders/orders.vue
+++ b/order/orders/orders.vue
@@ -51,7 +51,7 @@
-
+
diff --git a/pages/clientDetail/clientDetail.vue b/pages/clientDetail/clientDetail.vue
index 10276a4..71a52c8 100644
--- a/pages/clientDetail/clientDetail.vue
+++ b/pages/clientDetail/clientDetail.vue
@@ -71,7 +71,7 @@
-
+
编辑
@@ -355,4 +355,12 @@
margin-right: 10rpx;
}
}
+.editIcon {
+ width: 50rpx;
+ height: 50rpx;
+ margin-left: 20rpx;
+ image{
+ width: 100%;height: 100%
+ }
+}
diff --git a/pages/clients/clients.vue b/pages/clients/clients.vue
index 9be1218..9b18ceb 100644
--- a/pages/clients/clients.vue
+++ b/pages/clients/clients.vue
@@ -33,7 +33,7 @@
-
+
diff --git a/static/image/edit.png b/static/image/edit.png
new file mode 100644
index 0000000000000000000000000000000000000000..d30776ec3a601428d544b40764c752f68ab54a7a
GIT binary patch
literal 843
zcmV-R1GM~!P)Px&1xZ9fRA@u(m+foQKp4QEC#}Oy1d9lQAc7#GAVNV9WW*+|t>A>&^ow8i-|eL^
zu*G$zml|cDC`B16DhMhFijFF>qNL5qK?ks91opv?ng4nc
zn^7bZ5tsr$X5RB8%&-!P2rxJwiC>6#r_-A@wnskHoGg@kmr6
z7J)*ca44V8uL8gl05muyz5zgu5V9>IAzeUK)x+6rmcifN2f{1y#gll-D
zl&(-pZ%qN*Lec-M97ilVHCm0$s2b6A%3W|l-G
zfoipS!f~860JuI4o-M3t+J%r3>@>Pd2>BdK22@o&naO0<5OHA^{P_0}68DG0;j(Sp
zKVsPf#bWW4qA09vt_8t|k;vt8%dJ*x5CqTu7cL=P*H5$OFaTWTg%_3J0U!4f5~x%v
zXGWvZ8m07#D12NJ+ycd7@vNdKY{M2}fZxdH^YuofF%pSBcL`~lb`B94{N)(n@AdnA
zqu1*>qVQY-<#PGF>$(j7l5BWHY&niow{81R7tmcEB#8Iq-1q2rBWwY7Z*4EZXfic2e;}Ur3x^Au8?Xqv%SX&$dJKj`B?S_8oxlu)oj9p+sX$VZp0!SzfiwdVBXHnL=pS$Z
VWt
literal 0
HcmV?d00001