修改到期问题
This commit is contained in:
parent
2b53798b0d
commit
d1645ab26d
@ -24,23 +24,23 @@ Page({
|
|||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl(apiArr.resetFilter, {
|
util.postUrl4(apiArr.resetFilter, {
|
||||||
device_id: that.data.currentFilter.device_id,
|
device_id: that.data.currentFilter.device_id,
|
||||||
part_id: that.data.currentFilter.id,
|
part_id: that.data.currentFilter.id,
|
||||||
}, res => {
|
}, res => {
|
||||||
console.log(res);
|
console.log(res, 'asdasd');
|
||||||
if (res.msg == '操作成功') {
|
// if (res.data.msg == '操作成功') {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '重置成功!',
|
title: '重置成功!',
|
||||||
icon: "none"
|
icon: "none"
|
||||||
})
|
})
|
||||||
that.getfilterList()
|
that.getfilterList()
|
||||||
} else {
|
// } else {
|
||||||
wx.showToast({
|
// wx.showToast({
|
||||||
title: res.msg,
|
// title: res.data.msg,
|
||||||
icon: "none"
|
// icon: "none"
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDaysBetweenDates(inputDate) {
|
getDaysBetweenDates(inputDate) {
|
||||||
@ -80,10 +80,9 @@ Page({
|
|||||||
item.percentageDay = that.formatPercentage(
|
item.percentageDay = that.formatPercentage(
|
||||||
(remainingDays / (item.available_days || 1)) * 100
|
(remainingDays / (item.available_days || 1)) * 100
|
||||||
);
|
);
|
||||||
|
|
||||||
// 计算剩余容量百分比
|
// 计算剩余容量百分比
|
||||||
item.percentageCapacity = that.formatPercentage(
|
item.percentageCapacity = that.formatPercentage(
|
||||||
((item.threshold_volume || 0) / (item.available_volume || 1)) * 100
|
(1 - (item.threshold_volume || 0) / (item.available_volume || 1)) * 100
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
that.setData({
|
that.setData({
|
||||||
@ -114,7 +113,7 @@ Page({
|
|||||||
util.postUrl(apiArr.createDeviceOrder, {
|
util.postUrl(apiArr.createDeviceOrder, {
|
||||||
device_id: Number(wx.getStorageSync('device_id')),
|
device_id: Number(wx.getStorageSync('device_id')),
|
||||||
region: that.data.currentDevice.region,
|
region: that.data.currentDevice.region,
|
||||||
address: e.address,
|
address: that.data.currentDevice.address,
|
||||||
parts_ids: String(e.parts_id),
|
parts_ids: String(e.parts_id),
|
||||||
total_price: e.unit_price,
|
total_price: e.unit_price,
|
||||||
remark: "",
|
remark: "",
|
||||||
@ -195,8 +194,8 @@ Page({
|
|||||||
remark: that.data.message,
|
remark: that.data.message,
|
||||||
subject: that.data.currentFilter.parts_name,
|
subject: that.data.currentFilter.parts_name,
|
||||||
term_no: that.data.GoodsMsg.term_no,
|
term_no: that.data.GoodsMsg.term_no,
|
||||||
// total_amount: String(that.data.currentFilter.unit_price * 100),
|
total_amount: String(that.data.currentFilter.unit_price * 100),
|
||||||
total_amount: String(1),
|
// total_amount: String(1),
|
||||||
user: String(wx.getStorageSync('userId')),
|
user: String(wx.getStorageSync('userId')),
|
||||||
user_id: wx.getStorageSync('openId')
|
user_id: wx.getStorageSync('openId')
|
||||||
}, res => {
|
}, res => {
|
||||||
|
|||||||
@ -28,16 +28,20 @@
|
|||||||
<view class="filter_Item_Info_msg">
|
<view class="filter_Item_Info_msg">
|
||||||
<view class="filter_Item_Info_name">{{item.parts_name}}</view>
|
<view class="filter_Item_Info_name">{{item.parts_name}}</view>
|
||||||
|
|
||||||
<view style="display: flex;align-items: center;width: 100%;">
|
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method != 2}}">
|
||||||
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
|
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
|
||||||
{{item.percentageDay}}%
|
{{item.percentageDay}}%
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method == 2}}">
|
||||||
|
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
|
||||||
|
{{item.percentageCapacity}}%
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 1}}">
|
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 1}}">
|
||||||
<view class="hide"></view>
|
<view class="hide"></view>
|
||||||
|
|
||||||
<view class="filter_Item_Info_descText">
|
<view class="filter_Item_Info_descText">
|
||||||
剩余可用{{item.remaining_days}}天
|
剩余可用{{item.available_days}}天
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 2}}">
|
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 2}}">
|
||||||
@ -48,9 +52,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 3}}">
|
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 3}}">
|
||||||
<view class="payBtn" catch:tap="pay3" data-item="{{item}}">购买</view>
|
<view class="payBtn" catch:tap="pay3" data-item="{{item}}">购买</view>
|
||||||
<view class="filter_Item_Info_descText">剩余可用{{item.remaining_days}}天</view>
|
<view class="filter_Item_Info_descText">剩余可用{{item.available_days}}天</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -68,14 +71,14 @@
|
|||||||
<van-popup show="{{ show }}" bind:close="onClose" round close-on-click-overlay>
|
<van-popup show="{{ show }}" bind:close="onClose" round close-on-click-overlay>
|
||||||
<view class="popView">
|
<view class="popView">
|
||||||
<view class="pop_cir">
|
<view class="pop_cir">
|
||||||
<van-circle wx:if="{{billing_method == 1}}" value="{{currentFilter.percentageDay}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
|
<van-circle wx:if="{{billing_method != 2}}" value="{{currentFilter.percentageDay}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
|
||||||
</van-circle>
|
</van-circle>
|
||||||
<van-circle wx:if="{{billing_method != 1}}" value="{{currentFilter.percentageCapacity}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
|
<van-circle wx:if="{{billing_method == 2}}" value="{{currentFilter.percentageCapacity}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
|
||||||
</van-circle>
|
</van-circle>
|
||||||
|
|
||||||
<view class="cir_msg">
|
<view class="cir_msg">
|
||||||
<view class="percentage" wx:if="{{billing_method == 1}}">{{currentFilter.percentageDay}}%</view>
|
<view class="percentage" wx:if="{{billing_method != 2}}">{{currentFilter.percentageDay}}%</view>
|
||||||
<view class="percentage" wx:if="{{billing_method != 1}}">{{currentFilter.percentageCapacity}}%</view>
|
<view class="percentage" wx:if="{{billing_method == 1}}">{{currentFilter.percentageCapacity}}%</view>
|
||||||
<view class="cir_msg_text">滤芯寿命</view>
|
<view class="cir_msg_text">滤芯寿命</view>
|
||||||
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
|
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
|
||||||
</view>
|
</view>
|
||||||
@ -84,7 +87,7 @@
|
|||||||
|
|
||||||
<view class="pop_Tit">{{currentFilter.parts_name}}</view>
|
<view class="pop_Tit">{{currentFilter.parts_name}}</view>
|
||||||
<view class="pop_msg">{{currentFilter.introduce}}</view>
|
<view class="pop_msg">{{currentFilter.introduce}}</view>
|
||||||
<view class="pop_btn" bind:tap="pay2" wx:if="{{currentFilter.status != 2}}">购买</view>
|
<!-- <view class="pop_btn" bind:tap="pay2" wx:if="{{currentFilter.status != 2}}">购买</view> -->
|
||||||
<view class="pop_btn" bind:tap="reset" wx:if="{{currentFilter.status == 2}}">重置</view>
|
<view class="pop_btn" bind:tap="reset" wx:if="{{currentFilter.status == 2}}">重置</view>
|
||||||
</view>
|
</view>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
@ -157,9 +157,10 @@
|
|||||||
|
|
||||||
.popView {
|
.popView {
|
||||||
width: 499rpx;
|
width: 499rpx;
|
||||||
height: 580rpx;
|
/* height: 580rpx; */
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
padding-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pop_cir {
|
.pop_cir {
|
||||||
|
|||||||
@ -107,7 +107,7 @@ Page({
|
|||||||
if (accountInfo.miniProgram.version) {
|
if (accountInfo.miniProgram.version) {
|
||||||
version = accountInfo.miniProgram.version
|
version = accountInfo.miniProgram.version
|
||||||
} else {
|
} else {
|
||||||
version = '1.0.16'
|
version = '1.0.17'
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.setStorageSync('version', version)
|
wx.setStorageSync('version', version)
|
||||||
|
|||||||
@ -329,8 +329,8 @@ Page({
|
|||||||
let that = this
|
let that = this
|
||||||
|
|
||||||
util.postUrl2(PayJs.HsqueryPay, {
|
util.postUrl2(PayJs.HsqueryPay, {
|
||||||
// total_amount: String(that.data.packageList.suggested_price * 100),
|
total_amount: String(that.data.selectedDeposit.price * 100),
|
||||||
total_amount:String(1),
|
// total_amount: String(1),
|
||||||
subject: that.data.depositName,
|
subject: that.data.depositName,
|
||||||
out_trade_no: that.data.GoodsMsg.order_no,
|
out_trade_no: that.data.GoodsMsg.order_no,
|
||||||
remark: '',
|
remark: '',
|
||||||
@ -341,13 +341,15 @@ Page({
|
|||||||
user: String(wx.getStorageSync('userId'))
|
user: String(wx.getStorageSync('userId'))
|
||||||
}, res => {
|
}, res => {
|
||||||
const { resp_data, msg } = res.data.data
|
const { resp_data, msg } = res.data.data
|
||||||
|
console.log(msg);
|
||||||
|
console.log(resp_data);
|
||||||
if (msg == '成功') {
|
if (msg == '成功') {
|
||||||
wx.requestPayment({
|
wx.requestPayment({
|
||||||
timeStamp: String(res.acc_resp_fields.time_stamp),
|
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
|
||||||
nonceStr: String(res.acc_resp_fields.nonce_str),
|
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
|
||||||
package: String(res.acc_resp_fields.package),
|
package: String(resp_data.acc_resp_fields.package),
|
||||||
signType: String(res.acc_resp_fields.sign_type),
|
signType: String(resp_data.acc_resp_fields.sign_type),
|
||||||
paySign: String(res.acc_resp_fields.pay_sign),
|
paySign: String(resp_data.acc_resp_fields.pay_sign),
|
||||||
success(res) {
|
success(res) {
|
||||||
that.queryPay()
|
that.queryPay()
|
||||||
},
|
},
|
||||||
@ -361,8 +363,8 @@ Page({
|
|||||||
},
|
},
|
||||||
queryPay() {
|
queryPay() {
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl2(PayJs.queryPayByWechat, {
|
util.postUrl2(PayJs.HsqueryPayByWechat, {
|
||||||
order_no: that.data.GoodsMsg.order_no
|
out_trade_no: that.data.GoodsMsg.order_no
|
||||||
// merchant_no: that.data.GoodsMsg.merchant_no,
|
// merchant_no: that.data.GoodsMsg.merchant_no,
|
||||||
// term_no: that.data.GoodsMsg.term_no,
|
// term_no: that.data.GoodsMsg.term_no,
|
||||||
// out_trade_no: that.data.GoodsMsg.order_no
|
// out_trade_no: that.data.GoodsMsg.order_no
|
||||||
|
|||||||
@ -495,9 +495,8 @@ Page({
|
|||||||
if (item.is_first == 1) {
|
if (item.is_first == 1) {
|
||||||
currentDevice = item
|
currentDevice = item
|
||||||
currentDeviceId = item.device_id
|
currentDeviceId = item.device_id
|
||||||
wx.setStorageSync('device_id', item.device_id),
|
wx.setStorageSync('device_id', item.device_id)
|
||||||
wx.setStorageSync('currentDevice', item)
|
|
||||||
wx.setStorageSync('billing_method', item.billing_method)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -541,6 +540,9 @@ Page({
|
|||||||
url: '/packages/master/order/index',
|
url: '/packages/master/order/index',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
formatPercentage(value) {
|
||||||
|
return Math.max(0, Number((value || 0).toFixed(0)));
|
||||||
|
},
|
||||||
getInfo(e) {
|
getInfo(e) {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
@ -549,20 +551,34 @@ Page({
|
|||||||
let that = this
|
let that = this
|
||||||
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
|
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
res.difDay = that.getDaysBetweenDates(res.install_time) //服务天数
|
|
||||||
res.remainDay = that.getDaysBetweenDates2(res.expiration_duration) //剩余天数
|
// res.expiration_duration = '2025-06-01 08:06:42'
|
||||||
|
|
||||||
|
res.remainDay = Math.max(0,that.getDaysBetweenDates2(res.expiration_duration)) //剩余天数
|
||||||
|
if (res.expiration_duration) {
|
||||||
|
res.difDay = Math.max(0, that.getDaysBetweenDates(res.install_time)) //服务天数,确保不小于0
|
||||||
|
} else {
|
||||||
|
const installDate = new Date(res.install_time)
|
||||||
|
const expireDate = new Date(res.expiration_duration)
|
||||||
|
res.difDay = Math.max(0, Math.floor((expireDate - installDate) / (1000 * 60 * 60 * 24))) //确保不小于0
|
||||||
|
}
|
||||||
|
|
||||||
if (res.device_part) {
|
if (res.device_part) {
|
||||||
res.device_part.forEach(item => {
|
res.device_part.forEach(item => {
|
||||||
item.difDay = that.getDaysBetweenDates(item.start_time)
|
item.difDay = that.getDaysBetweenDates(item.start_time)
|
||||||
item.percentageDay = Math.max(0, Math.round(
|
const remainingDays = Math.max(0, (item.available_days || 0) - (item.difDay || 0));
|
||||||
((item.available_days - item.difDay) / item.available_days) * 100
|
|
||||||
));
|
item.percentageDay = that.formatPercentage(
|
||||||
item.percentageCapacity = Math.max(0, (item.threshold_volume / item.available_volume) * 100) //容量百分比
|
(remainingDays / (item.available_days || 1)) * 100
|
||||||
|
);
|
||||||
|
item.percentageCapacity = that.formatPercentage(
|
||||||
|
(1 - (item.threshold_volume || 0) / (item.available_volume || 1)) * 100
|
||||||
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
res.today = Number(res.today).toFixed(2)
|
res.today = Number(res.today).toFixed(2)
|
||||||
res.yesterday = Number(res.yesterday).toFixed(2)
|
res.yesterday = Number(res.yesterday).toFixed(2)
|
||||||
|
console.log(res.difDay,'ressss');
|
||||||
that.setData({
|
that.setData({
|
||||||
currentDevice: res
|
currentDevice: res
|
||||||
})
|
})
|
||||||
@ -570,12 +586,12 @@ Page({
|
|||||||
|
|
||||||
wx.setStorageSync('device_id', res.device_id),
|
wx.setStorageSync('device_id', res.device_id),
|
||||||
wx.setStorageSync('currentDevice', res)
|
wx.setStorageSync('currentDevice', res)
|
||||||
|
wx.setStorageSync('billing_method', res.billing_method)
|
||||||
|
|
||||||
if (!res.device_net) {
|
if (!res.device_net) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (res.device_net.length == 0) {
|
if (res.device_net.length == 0) {
|
||||||
console.log(123);
|
|
||||||
} else {
|
} else {
|
||||||
let Xarr = [];
|
let Xarr = [];
|
||||||
let Yarr = [];
|
let Yarr = [];
|
||||||
|
|||||||
@ -122,20 +122,40 @@
|
|||||||
<view class="device-id text-size">
|
<view class="device-id text-size">
|
||||||
编号:{{currentDevice.device_code}}
|
编号:{{currentDevice.device_code}}
|
||||||
</view>
|
</view>
|
||||||
<view class="service-day text-size text-color">
|
|
||||||
|
|
||||||
|
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
|
||||||
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
|
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="service-day text-size text-color" wx:if="{{currentDevice.remainDay}}">
|
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
|
||||||
|
已服务<span class="day-num">0</span><span class="day text-size">天</span>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view wx:if="{{currentDevice.expiration_duration}}">
|
||||||
|
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
|
||||||
剩余天数
|
剩余天数
|
||||||
<span class="day-num2">{{ currentDevice.remainDay}}</span>
|
<span class="day-num2">{{ currentDevice.remainDay}}</span>
|
||||||
<span class="day text-size">天</span>
|
<span class="day text-size">天</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="service-day text-size text-color" wx:if="{{!currentDevice.remainDay}}">
|
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
|
||||||
<span class="day text-size">已欠费</span>
|
<span class="day text-size">已欠费</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view wx:if="{{!currentDevice.expiration_duration}}">
|
||||||
|
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
|
||||||
|
剩余天数
|
||||||
|
<span class="day-num2">0</span>
|
||||||
|
<span class="day text-size">天</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<van-divider />
|
<van-divider />
|
||||||
<!-- 购买滤芯和报修记录 -->
|
<!-- 购买滤芯和报修记录 -->
|
||||||
|
|||||||
@ -5,11 +5,11 @@ const app = getApp()
|
|||||||
// const server_url = "https://huishang.magicany.cc/api/v1";
|
// const server_url = "https://huishang.magicany.cc/api/v1";
|
||||||
// const img_url = "https://huishang.magicany.cc";
|
// const img_url = "https://huishang.magicany.cc";
|
||||||
|
|
||||||
// const server_url = "https://api.hshuishang.com/api/v1";
|
const server_url = "https://api.hshuishang.com/api/v1";
|
||||||
// const img_url = "https://api.hshuishang.com";
|
const img_url = "https://api.hshuishang.com";
|
||||||
|
|
||||||
const server_url = "https://test.hshuishang.com/api/v1";
|
// const server_url = "https://test.hshuishang.com/api/v1";
|
||||||
const img_url = "https://test.hshuishang.com";
|
// const img_url = "https://test.hshuishang.com";
|
||||||
// https://api.hshuishang.com
|
// https://api.hshuishang.com
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user