diff --git a/apis/modules/user.js b/apis/modules/user.js index bd40a38..79c5ab8 100644 --- a/apis/modules/user.js +++ b/apis/modules/user.js @@ -25,12 +25,12 @@ export const queryUserInfoDetails = () => { return get('users/users/userAccount/queryUserInfoDetails') } -export const bindPhoneOrEmail = (data) => { - return post('users/users/userAccount/bindPhoneOrEmail', data) +export const updateMyEmail = (data) => { + return post('nakadai/partner-team/updateMyEmail', data) } -export const sendPhoneOrEmailCode = (data) => { - return post('users/users/userAccount/sendPhoneOrEmailCode', data) +export const mailCodeSend = (data) => { + return post('nakadai/partner-team/mailCodeSend', data) } export const changeAccount = account => { diff --git a/apis/request.js b/apis/request.js index b42f7bb..a4f1063 100644 --- a/apis/request.js +++ b/apis/request.js @@ -19,7 +19,7 @@ const request = options => { const { url } = options uni.request({ header, - url: (otherUrl.find(e => url.includes(e)) ? 'http://192.168.31.151:9000/' : config.baseURL) + url, + url: (otherUrl.find(e => url.includes(e)) ? 'http://192.168.31.137:9000/' : config.baseURL) + url, method: options.method || 'GET', // 请求类型,默认为GET data: options.data || {}, // 请求参数,默认空对象 success: ({ data }) => { diff --git a/order/editCourse/editCourse.vue b/order/editCourse/editCourse.vue index 326bb52..47eb894 100644 --- a/order/editCourse/editCourse.vue +++ b/order/editCourse/editCourse.vue @@ -20,7 +20,7 @@ 使用期限 - + {{ units.find(e => e.value === item.options).text }} @@ -40,7 +40,7 @@ 数量 1 - + {{ item.authority ? '市场价' : '市场单价' }} @@ -61,7 +61,7 @@ 成交价 - + @@ -82,6 +82,7 @@ data() { return { customerId: '', + timer: null, units: [{ text: '日', value: 0 @@ -154,7 +155,6 @@ } catch (e) {} }, showUnit(i) { - console.log(333, this.$refs, this.$refs.unit[i].show) this.$refs.unit[i].show() }, // 收缩产品 @@ -173,121 +173,139 @@ }, // 使用期限转换以及计算剩余天数 calcDate(row, fromData) { - 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') + 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 } - }).catch(res => { - this.repeatMsg = res.message - orderRepeat.includes(cId) || orderRepeat.push(cId) - }) - } - // 折扣率 - this.calcDiscount(row) + } + 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) { - 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%) - if (row.settlementPrice) { - row.serviceFee = (row.settlementPrice * 0.1).toFixed(2) - } + console.log(33, row) + clearTimeout(this.timer) + this.timer = setTimeout(() => { + 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%) + if (row.settlementPrice) { + row.serviceFee = (row.settlementPrice * 0.1).toFixed(2) + } + }, 500) }, // 计算折扣率 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%' + clearTimeout(this.timer) + this.timer = setTimeout(() => { + const price = row.authority ? row.finalPrice : row.finalValue + const { marketValue } = row + console.log(66, row) + // (原价-现价)÷原价 x100% + if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%' + }, 500) }, // 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) calcFinalValue(row) { - const { authority, periodOfUse, options, accountNum, finalPrice } = row - if (!authority && periodOfUse && accountNum && finalPrice) { - row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2) - } - // 折扣率 - this.calcDiscount(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) { - 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.calculateDiscount(e, row) - } - } else if (finalValue && finalValue && !row.authority) { - // 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价 - row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue) + 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.calculateDiscount(e, row) + } + } else if (finalValue && finalValue && !row.authority) { + // 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价 + row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue) + } } - } - this.dealSettlePrice(row) + this.dealSettlePrice(row) + }, 500) }, // 确定 submit() { diff --git a/order/orderDetail/orderDetail.vue b/order/orderDetail/orderDetail.vue index d728062..0194905 100644 --- a/order/orderDetail/orderDetail.vue +++ b/order/orderDetail/orderDetail.vue @@ -5,7 +5,7 @@ 商务经理 - {{ $util.getBmName() }} + {{ userName }} 客户名称 @@ -53,7 +53,7 @@