|
@@ -3,55 +3,57 @@
|
|
|
<div>
|
|
|
<div>减少时长的云机</div>
|
|
|
<div>
|
|
|
- <comoros />
|
|
|
+ <comoros :key="transferUserCardKey" :dayTime="countObj.transferMinDay" :transferPhoneList="transferPhoneList" :buyVipType.sync="buyVipType"
|
|
|
+ v-model="params.transferUserCardId" :name.sync="transferUserCardName" @confirm="comorosConfirm" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="transfer-item">
|
|
|
<div>增加时长的云机</div>
|
|
|
<div>
|
|
|
- <comoros />
|
|
|
+ <comoros :key="acceptUserCardKey" :disabledId="params.transferUserCardId"
|
|
|
+ :transferPhoneList="transferPhoneList" :filterType="buyVipType" v-model="params.acceptUserCardId"
|
|
|
+ :name.sync="acceptUserCardName" distinguishBool/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="transfer-item">
|
|
|
<div>转移的时间</div>
|
|
|
<div class="transfer-item-input">
|
|
|
- <van-field v-model="value" placeholder="请输入转移的时间" type="number" />
|
|
|
+ <van-field placeholder="请输入转移的时间" v-model="params.transferTime"
|
|
|
+ @input="params.transferTime = params.transferTime.replace(/\D/g, '')" />
|
|
|
天
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div style="font-size: 12px;font-weight: 400;color: #3B7FFF;line-height: 16px;margin-top: 5px">服务费计算</div>
|
|
|
+ <span style="font-size: 12px;font-weight: 400;color: #3B7FFF;line-height: 16px;margin-top: 5px;"
|
|
|
+ @click="params.transferTime && serviceCount()" :class="{ opacity: !params.transferTime }">{{ countLoading ? '正在计算中...' : '服务费计算'
|
|
|
+ }}</span>
|
|
|
<div class="transfer-tip">
|
|
|
<div>
|
|
|
温馨提示:
|
|
|
</div>
|
|
|
<div class="transfer-tip-content">
|
|
|
- 此功能支持转移云手机时长到其它设备<br />
|
|
|
- 1、合成设备必须是同一个套餐类型<br />
|
|
|
- 2、减少时长的云机:选择转移时间的设备<br />
|
|
|
- 3、增加时长的云机:选择增加时长的设备<br />
|
|
|
- 4、授权云手机,获取云手机,自动续费云手机,计时套餐云手机,特权年卡,激活码,不支持设备合成<br />
|
|
|
- 5、转移天数的设备最少为7天云手机,小于7天的云手机不支持转移时长<br />
|
|
|
- 6、转移扣除天数<br />
|
|
|
- 50 -100天 扣除5%<br />
|
|
|
- 100-200天 扣除4%<br />
|
|
|
- 200-500天 扣除3%<br />
|
|
|
- 其它转移时间 扣除时间按照5%计算<br />
|
|
|
+ <div v-html="html"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="transfer-btn">
|
|
|
- <van-button type="info" block>分配时间</van-button>
|
|
|
+ <van-button type="info" block
|
|
|
+ :disabled="!params.transferUserCardId || !params.acceptUserCardId || !params.transferTime"
|
|
|
+ :loading="allocateLoading" @click="changePopUpType(0)" loading-text="正在分配时间中...">
|
|
|
+ 分配时间
|
|
|
+ </van-button>
|
|
|
</div>
|
|
|
|
|
|
- <van-dialog v-model="visible" :title="false ? '服务费计算' : ''" confirmButtonColor="#3B7FFF" className="dialog" showCancelButton cancelButtonColor="#999999">
|
|
|
+ <van-dialog v-model="visible" :title="clickType ? '服务费计算' : ''" confirmButtonColor="#3B7FFF" className="dialog"
|
|
|
+ showCancelButton cancelButtonColor="#999999" @confirm="!clickType && confirm()"
|
|
|
+ @close="allocateLoading = false">
|
|
|
<div style="padding: 16px;font-weight: 100;">
|
|
|
- <template v-if="false">
|
|
|
+ <template v-if="clickType">
|
|
|
<div style="display: flex; justify-content: space-between;">
|
|
|
<div>转移天数:</div>
|
|
|
- <div style="color: #F9F9F9;">100天</div>
|
|
|
+ <div style="color: #F9F9F9;">{{ params.transferTime }}天</div>
|
|
|
</div>
|
|
|
<div style="display: flex; justify-content: space-between;">
|
|
|
<div>服务费:</div>
|
|
|
- <div style="color: #F9F9F9;">1.5天</div>
|
|
|
+ <div style="color: #F9F9F9;">{{ serviceCharge }}天</div>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
@@ -59,13 +61,13 @@
|
|
|
<template v-else>
|
|
|
<div style="line-height: 30px;">
|
|
|
<div style="text-align: center;font-weight:bold;">
|
|
|
- 确定要将【A设备云机名称】
|
|
|
+ 确定要将【{{ transferUserCardName }}】
|
|
|
</div>
|
|
|
<div style="text-align: center;">
|
|
|
- 时间分配给【A设备云机名称】
|
|
|
+ 时间分配给【{{ acceptUserCardName }}】
|
|
|
</div>
|
|
|
<div style="text-align: center;margin-top: 10px">
|
|
|
- 服务费:1.6天
|
|
|
+ 服务费:{{ serviceCharge }}天
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -75,23 +77,162 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {
|
|
|
+ sha256
|
|
|
+} from 'js-sha256';
|
|
|
+import BigNumber from "bignumber.js";
|
|
|
+import { Toast } from 'vant'
|
|
|
const comoros = () => import('./comoros.vue')
|
|
|
export default {
|
|
|
name: 'tansferDuration',
|
|
|
components: {
|
|
|
comoros
|
|
|
},
|
|
|
+ props: {
|
|
|
+ token: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- value: '',
|
|
|
- visible: true
|
|
|
+ visible: false,// 显示弹窗
|
|
|
+ transferPhoneList: [], // 云机列表
|
|
|
+ buyVipType: '', // 当前选中的云机类型
|
|
|
+ params: {},
|
|
|
+ acceptUserCardKey: +new Date(),
|
|
|
+ transferUserCardKey: +new Date(),
|
|
|
+ acceptUserCardName: '',
|
|
|
+ transferUserCardName: '',
|
|
|
+ // 点击类型 0 是确认转移、1是计算手续费
|
|
|
+ clickType: 0,
|
|
|
+ // 计算loading
|
|
|
+ countLoading: false,
|
|
|
+ // 计算服务费的对象
|
|
|
+ countObj: {},
|
|
|
+ // 服务费
|
|
|
+ serviceCharge: '',
|
|
|
+ // 分配时间loading
|
|
|
+ allocateLoading: false,
|
|
|
+ html: ''
|
|
|
};
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
+ this.init()
|
|
|
+ this.getFeeRatio()
|
|
|
+ this.getRule()
|
|
|
},
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ this.params = {
|
|
|
+ acceptUserCardId: '', // 接受设备ID
|
|
|
+ transferUserCardId: '', // 转移设备ID
|
|
|
+ transferTime: '' // 转移天数
|
|
|
+ }
|
|
|
+ this.acceptUserCardKey = +new Date()
|
|
|
+ this.transferUserCardKey = +new Date()
|
|
|
+ this.buyVipType = ''
|
|
|
+ this.serviceCharge = ''
|
|
|
+ this.getTransferPhoneList()
|
|
|
+ },
|
|
|
+ // 获取云机列表
|
|
|
+ getTransferPhoneList() {
|
|
|
+ this.$axios.$get('resources/v5/time/transfer/getTransferPhoneList', { header: { token: this.token } }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.transferPhoneList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 确认框
|
|
|
+ comorosConfirm() {
|
|
|
+ this.acceptUserCardKey = +new Date()
|
|
|
+ this.params.acceptUserCardId = ''
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取手续费比例
|
|
|
+ getFeeRatio() {
|
|
|
+ this.$axios.$get('resources/v5/time/transfer/getFeeRatio', { headers: { Authorization: this.token } }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ res.data.transferMinDay = res.data.transferMinDay * 24 * 60
|
|
|
+ this.countObj = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 确定提交
|
|
|
+ async confirm() {
|
|
|
+ // 获取服务器时间
|
|
|
+ let requestTime = await this.$axios.$get('pay/v1/order/getSystemTime', { headers: { Authorization: this.token } })
|
|
|
+
|
|
|
+ requestTime = new Date(requestTime.data * 1000).$formatTime()
|
|
|
+ const requestTimeSign = sha256("Register_SZX_2023:" + requestTime)
|
|
|
+ this.$axios.$post('resources/v5/time/transfer/transferDurationOperation', {
|
|
|
+ ...this.params,
|
|
|
+ requestTime
|
|
|
+ }, { headers: { Authorization: this.token, requestTimeSign } }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.init()
|
|
|
+ Toast.success(res.msg)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ Toast.fail(err.message)
|
|
|
+ }).finally(() => {
|
|
|
+ this.allocateLoading = false
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ // 服务费计算
|
|
|
+ serviceCount(bool = true) {
|
|
|
+ if (this.countLoading) return
|
|
|
+ if (bool) this.countLoading = true
|
|
|
+ const arr = this.countObj.list.sort((a, b) => {
|
|
|
+ console.log(a, b)
|
|
|
+ return a.timeConsumingEnd - b.timeConsumingEnd
|
|
|
+ })
|
|
|
+ console.log(arr)
|
|
|
+ let commission = null
|
|
|
+ for (const i of arr) {
|
|
|
+ if (this.params.transferTime <= i.timeConsumingEnd) {
|
|
|
+ commission = i.commission
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!commission) commission = this.countObj.commissionSet
|
|
|
+ this.serviceCharge = +new BigNumber(this.params.transferTime).times(new BigNumber(commission).div(100))
|
|
|
+ this.countLoading = false
|
|
|
+ if (bool) this.changePopUpType(1)
|
|
|
+ },
|
|
|
+
|
|
|
+ changePopUpType(e) {
|
|
|
+ if (!e) {
|
|
|
+ this.serviceCount(false)
|
|
|
+ this.allocateLoading = true
|
|
|
+ }
|
|
|
+ this.visible = true
|
|
|
+ this.clickType = e
|
|
|
+ },
|
|
|
|
|
|
+ // 获取规则
|
|
|
+ getRule() {
|
|
|
+ this.$axios.$get('/public/v4/agreement/content', {
|
|
|
+ params: {
|
|
|
+ agreementCoding: 'YJSBSJZY2024'
|
|
|
+ }, headers: { Authorization: this.token }
|
|
|
+ }).then(res => {
|
|
|
+ const html = res.data.content;
|
|
|
+ const rx = /<body[^>]*>([\s\S]+?)<\/body>/i;
|
|
|
+ let m = rx.exec(html);
|
|
|
+ if (m) {
|
|
|
+ m = m[1]
|
|
|
+ };
|
|
|
+ console.log(m)
|
|
|
+ this.html = m
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -169,4 +310,18 @@ export default {
|
|
|
background: #2C2C2D;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.opacity {
|
|
|
+ opacity: .4;
|
|
|
+}
|
|
|
+
|
|
|
+.transfer-tip-content {
|
|
|
+ ::v-deep ol {
|
|
|
+ list-style-type: decimal;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep ul {
|
|
|
+ list-style-type: disc;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|