增添续费时选择旧套餐
This commit is contained in:
parent
3ca6a20434
commit
fbd0b4d2f8
|
|
@ -13,8 +13,8 @@ export function getDeviceTypes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备id获取租赁套餐列表
|
* 根据设备类型id获取租赁套餐列表
|
||||||
* @param {string} typeId - 设备ids
|
* @param {string} typeId - 设备类型id
|
||||||
* @returns {Promise} 返回租赁套餐列表数据
|
* @returns {Promise} 返回租赁套餐列表数据
|
||||||
*/
|
*/
|
||||||
export function getPeriodPackagesByTypeId(typeId) {
|
export function getPeriodPackagesByTypeId(typeId) {
|
||||||
|
|
@ -28,6 +28,22 @@ export function getPeriodPackagesByTypeId(typeId) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id获取租赁套餐列表
|
||||||
|
* @param {string} devId - 设备id
|
||||||
|
* @returns {Promise} 返回租赁套餐列表数据
|
||||||
|
*/
|
||||||
|
export function getPeriodPackagesByDevId(devId) {
|
||||||
|
return request({
|
||||||
|
url: '/app/suit/listByDevId',
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
devId: devId,
|
||||||
|
},
|
||||||
|
loadingText: '加载套餐中...',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据套餐ids获取租赁套餐列表
|
* 根据套餐ids获取租赁套餐列表
|
||||||
* @param {string} suitIds - 套餐ids
|
* @param {string} suitIds - 套餐ids
|
||||||
|
|
@ -84,12 +100,6 @@ export function renewDevice(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/app/order/renew',
|
url: '/app/order/renew',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data,
|
||||||
suitId: data.suitId,
|
|
||||||
appId: data.appId,
|
|
||||||
payAmount: data.payAmount,
|
|
||||||
channelId: data.channelId,
|
|
||||||
devId: data.devId,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 套餐列表 -->
|
<!-- 套餐列表 -->
|
||||||
<view v-else-if="packageList.length > 0" class="package-list">
|
<view v-else-if="reconstructionPackageList.length > 0" class="package-list">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in packageList"
|
v-for="(item, index) in reconstructionPackageList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ active: selectedPackage && selectedPackage.id === item.id }"
|
:class="{ active: selectedPackage && selectedPackage.id === item.id }"
|
||||||
class="package-item"
|
class="package-item"
|
||||||
|
|
@ -87,8 +87,8 @@ export default {
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
packageList: {
|
packageList: {
|
||||||
type: Array,
|
type: Object,
|
||||||
default: () => [],
|
default: null,
|
||||||
},
|
},
|
||||||
loading: {
|
loading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
@ -108,6 +108,20 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
reconstructionPackageList() {
|
||||||
|
console.log('@@@', this.packageList)
|
||||||
|
let list = this.packageList.list
|
||||||
|
let oldItem = {
|
||||||
|
amount: this.packageList.lastSuitAmount,
|
||||||
|
name: this.packageList.lastSuitName + '(原套餐)',
|
||||||
|
id: this.packageList.lastSuitId + 'a',
|
||||||
|
}
|
||||||
|
list = [oldItem, ...list]
|
||||||
|
console.log('<UNK>', list)
|
||||||
|
return list
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 处理遮罩层点击
|
// 处理遮罩层点击
|
||||||
handleOverlayClick() {
|
handleOverlayClick() {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,12 @@ import RenewModal from '../../components/renew-modal/renew-modal.vue'
|
||||||
import { getNewAnnouncement } from '../../api/article/article.js'
|
import { getNewAnnouncement } from '../../api/article/article.js'
|
||||||
import { getBannerList } from '../../api/banner/banner.js'
|
import { getBannerList } from '../../api/banner/banner.js'
|
||||||
import { getDeviceList } from '../../api/device/device.js'
|
import { getDeviceList } from '../../api/device/device.js'
|
||||||
import { renewDevice, getPeriodPackages, getPeriodPackagesByTypeId } from '../../api/lease/lease.js'
|
import {
|
||||||
|
renewDevice,
|
||||||
|
getPeriodPackages,
|
||||||
|
getPeriodPackagesByTypeId,
|
||||||
|
getPeriodPackagesByDevId,
|
||||||
|
} from '../../api/lease/lease.js'
|
||||||
import { getIsRealName } from '../../api'
|
import { getIsRealName } from '../../api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -70,7 +75,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
shihasExecuted: uni.getStorageSync('hasExecutedGoToRealName') || false,
|
hasExecuted: uni.getStorageSync('hasExecutedGoToRealName') || false,
|
||||||
|
|
||||||
// 基础配置
|
// 基础配置
|
||||||
isRealName: false,
|
isRealName: false,
|
||||||
|
|
@ -101,6 +106,7 @@ export default {
|
||||||
packageList: [],
|
packageList: [],
|
||||||
packageLoading: false,
|
packageLoading: false,
|
||||||
selectedPackage: null,
|
selectedPackage: null,
|
||||||
|
renewData: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -308,8 +314,9 @@ export default {
|
||||||
this.packageLoading = true
|
this.packageLoading = true
|
||||||
|
|
||||||
// 根据设备ID查询套餐
|
// 根据设备ID查询套餐
|
||||||
await this.fetchPackageList(this.selectedDevice.originalData.typeId)
|
console.log('设备信息originalData', this.selectedDevice.originalData)
|
||||||
console.log('设备类型id', this.selectedDevice.originalData.typeId)
|
await this.fetchPackageList(this.selectedDevice.originalData.id)
|
||||||
|
console.log('设备id', this.selectedDevice.originalData.id)
|
||||||
this.showRenewModal = true
|
this.showRenewModal = true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('打开续费弹窗失败:', error)
|
console.error('打开续费弹窗失败:', error)
|
||||||
|
|
@ -325,7 +332,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
console.log('设备类型ID:', deviceId)
|
console.log('设备类型ID:', deviceId)
|
||||||
|
|
||||||
const response = await getPeriodPackagesByTypeId(deviceId)
|
const response = await getPeriodPackagesByDevId(deviceId)
|
||||||
|
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.packageList = response.data || []
|
this.packageList = response.data || []
|
||||||
|
|
@ -369,20 +376,37 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const renewData = {
|
if (this.selectedPackage.id && this.selectedPackage.id.endsWith('a')) {
|
||||||
|
this.renewData = {
|
||||||
|
payAmount: this.packageList.lastSuitAmount,
|
||||||
|
lastSuitDay: this.packageList.lastSuitDay,
|
||||||
|
lastSuitId: this.packageList.lastSuitId,
|
||||||
|
lastSuitName: this.packageList.lastSuitName,
|
||||||
|
// suitId: this.selectedPackage.id,
|
||||||
|
isLastSuit: true,
|
||||||
|
appId: '1', // 应用ID,根据实际情况调整
|
||||||
|
// payAmount: this.selectedPackage.price || this.selectedPackage.amount,
|
||||||
|
channelId: '3', // 渠道ID,根据实际情况调整
|
||||||
|
devId: this.selectedDevice.id,
|
||||||
|
}
|
||||||
|
console.log('ID以a结尾')
|
||||||
|
} else {
|
||||||
|
this.renewData = {
|
||||||
suitId: this.selectedPackage.id,
|
suitId: this.selectedPackage.id,
|
||||||
appId: '1', // 应用ID,根据实际情况调整
|
appId: '1', // 应用ID,根据实际情况调整
|
||||||
payAmount: this.selectedPackage.price || this.selectedPackage.amount,
|
payAmount: this.selectedPackage.price || this.selectedPackage.amount,
|
||||||
channelId: '3', // 渠道ID,根据实际情况调整
|
channelId: '3', // 渠道ID,根据实际情况调整
|
||||||
devId: this.selectedDevice.id,
|
devId: this.selectedDevice.id,
|
||||||
}
|
}
|
||||||
|
console.log('ID不以a结尾')
|
||||||
|
}
|
||||||
|
|
||||||
console.log('续费数据:', renewData)
|
console.log('续费数据:', this.renewData)
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在生成续费订单',
|
title: '生成续费订单中',
|
||||||
mask: 'true',
|
mask: 'true',
|
||||||
})
|
})
|
||||||
const response = await renewDevice(renewData)
|
const response = await renewDevice(this.renewData)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
const data = response.data
|
const data = response.data
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const ENV_CONFIG = {
|
||||||
// 正式版
|
// 正式版
|
||||||
// baseUrl: 'https://chu.chuangtewl.com/prod-api',
|
// baseUrl: 'https://chu.chuangtewl.com/prod-api',
|
||||||
// baseUrl: 'http://192.168.2.21:4601',
|
// baseUrl: 'http://192.168.2.21:4601',
|
||||||
baseUrl: 'http://192.168.2.21:4601',
|
baseUrl: 'https://chu.chuangtewl.com/prod-api',
|
||||||
appId: 1,
|
appId: 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user