修改到期问题
This commit is contained in:
parent
2b53798b0d
commit
d1645ab26d
@ -24,23 +24,23 @@ Page({
|
||||
},
|
||||
reset() {
|
||||
let that = this
|
||||
util.postUrl(apiArr.resetFilter, {
|
||||
util.postUrl4(apiArr.resetFilter, {
|
||||
device_id: that.data.currentFilter.device_id,
|
||||
part_id: that.data.currentFilter.id,
|
||||
}, res => {
|
||||
console.log(res);
|
||||
if (res.msg == '操作成功') {
|
||||
wx.showToast({
|
||||
title: '重置成功!',
|
||||
icon: "none"
|
||||
})
|
||||
that.getfilterList()
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.msg,
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
console.log(res, 'asdasd');
|
||||
// if (res.data.msg == '操作成功') {
|
||||
wx.showToast({
|
||||
title: '重置成功!',
|
||||
icon: "none"
|
||||
})
|
||||
that.getfilterList()
|
||||
// } else {
|
||||
// wx.showToast({
|
||||
// title: res.data.msg,
|
||||
// icon: "none"
|
||||
// })
|
||||
// }
|
||||
})
|
||||
},
|
||||
getDaysBetweenDates(inputDate) {
|
||||
@ -80,10 +80,9 @@ Page({
|
||||
item.percentageDay = that.formatPercentage(
|
||||
(remainingDays / (item.available_days || 1)) * 100
|
||||
);
|
||||
|
||||
// 计算剩余容量百分比
|
||||
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({
|
||||
@ -114,7 +113,7 @@ Page({
|
||||
util.postUrl(apiArr.createDeviceOrder, {
|
||||
device_id: Number(wx.getStorageSync('device_id')),
|
||||
region: that.data.currentDevice.region,
|
||||
address: e.address,
|
||||
address: that.data.currentDevice.address,
|
||||
parts_ids: String(e.parts_id),
|
||||
total_price: e.unit_price,
|
||||
remark: "",
|
||||
@ -195,8 +194,8 @@ Page({
|
||||
remark: that.data.message,
|
||||
subject: that.data.currentFilter.parts_name,
|
||||
term_no: that.data.GoodsMsg.term_no,
|
||||
// total_amount: String(that.data.currentFilter.unit_price * 100),
|
||||
total_amount: String(1),
|
||||
total_amount: String(that.data.currentFilter.unit_price * 100),
|
||||
// total_amount: String(1),
|
||||
user: String(wx.getStorageSync('userId')),
|
||||
user_id: wx.getStorageSync('openId')
|
||||
}, res => {
|
||||
@ -236,7 +235,7 @@ Page({
|
||||
})
|
||||
|
||||
that.setData({
|
||||
show:false
|
||||
show: false
|
||||
})
|
||||
// wx.requestSubscribeMessage({
|
||||
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
|
||||
|
||||
@ -28,16 +28,20 @@
|
||||
<view class="filter_Item_Info_msg">
|
||||
<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" />
|
||||
{{item.percentageDay}}%
|
||||
</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="hide"></view>
|
||||
|
||||
<view class="filter_Item_Info_descText">
|
||||
剩余可用{{item.remaining_days}}天
|
||||
剩余可用{{item.available_days}}天
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 2}}">
|
||||
@ -48,13 +52,12 @@
|
||||
</view>
|
||||
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 3}}">
|
||||
<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>
|
||||
|
||||
@ -68,14 +71,14 @@
|
||||
<van-popup show="{{ show }}" bind:close="onClose" round close-on-click-overlay>
|
||||
<view class="popView">
|
||||
<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 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>
|
||||
|
||||
<view class="cir_msg">
|
||||
<view class="percentage" wx:if="{{billing_method == 1}}">{{currentFilter.percentageDay}}%</view>
|
||||
<view class="percentage" wx:if="{{billing_method != 1}}">{{currentFilter.percentageCapacity}}%</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="cir_msg_text">滤芯寿命</view>
|
||||
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
|
||||
</view>
|
||||
@ -84,7 +87,7 @@
|
||||
|
||||
<view class="pop_Tit">{{currentFilter.parts_name}}</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>
|
||||
</van-popup>
|
||||
@ -157,9 +157,10 @@
|
||||
|
||||
.popView {
|
||||
width: 499rpx;
|
||||
height: 580rpx;
|
||||
/* height: 580rpx; */
|
||||
background: #FFFFFF;
|
||||
overflow: hidden;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.pop_cir {
|
||||
|
||||
@ -107,7 +107,7 @@ Page({
|
||||
if (accountInfo.miniProgram.version) {
|
||||
version = accountInfo.miniProgram.version
|
||||
} else {
|
||||
version = '1.0.16'
|
||||
version = '1.0.17'
|
||||
}
|
||||
|
||||
wx.setStorageSync('version', version)
|
||||
|
||||
@ -235,7 +235,7 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
handlePay() {
|
||||
@ -303,7 +303,7 @@ Page({
|
||||
})
|
||||
|
||||
that.pay()
|
||||
|
||||
|
||||
// wx.requestPayment({
|
||||
// timeStamp: String(res.time_stamp),
|
||||
// nonceStr: String(res.nonce_str),
|
||||
@ -329,25 +329,27 @@ Page({
|
||||
let that = this
|
||||
|
||||
util.postUrl2(PayJs.HsqueryPay, {
|
||||
// total_amount: String(that.data.packageList.suggested_price * 100),
|
||||
total_amount:String(1),
|
||||
total_amount: String(that.data.selectedDeposit.price * 100),
|
||||
// total_amount: String(1),
|
||||
subject: that.data.depositName,
|
||||
out_trade_no:that.data.GoodsMsg.order_no,
|
||||
remark:'',
|
||||
out_trade_no: that.data.GoodsMsg.order_no,
|
||||
remark: '',
|
||||
user_id: wx.getStorageSync('openId'),
|
||||
goods_id:that.data.GoodsMsg.id,
|
||||
quantity:"1",
|
||||
address:that.data.area + that.data.address,
|
||||
user:String(wx.getStorageSync('userId'))
|
||||
goods_id: that.data.GoodsMsg.id,
|
||||
quantity: "1",
|
||||
address: that.data.area + that.data.address,
|
||||
user: String(wx.getStorageSync('userId'))
|
||||
}, res => {
|
||||
const { resp_data, msg } = res.data.data
|
||||
console.log(msg);
|
||||
console.log(resp_data);
|
||||
if (msg == '成功') {
|
||||
wx.requestPayment({
|
||||
timeStamp: String(res.acc_resp_fields.time_stamp),
|
||||
nonceStr: String(res.acc_resp_fields.nonce_str),
|
||||
package: String(res.acc_resp_fields.package),
|
||||
signType: String(res.acc_resp_fields.sign_type),
|
||||
paySign: String(res.acc_resp_fields.pay_sign),
|
||||
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
|
||||
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
|
||||
package: String(resp_data.acc_resp_fields.package),
|
||||
signType: String(resp_data.acc_resp_fields.sign_type),
|
||||
paySign: String(resp_data.acc_resp_fields.pay_sign),
|
||||
success(res) {
|
||||
that.queryPay()
|
||||
},
|
||||
@ -361,8 +363,8 @@ Page({
|
||||
},
|
||||
queryPay() {
|
||||
let that = this
|
||||
util.postUrl2(PayJs.queryPayByWechat, {
|
||||
order_no: that.data.GoodsMsg.order_no
|
||||
util.postUrl2(PayJs.HsqueryPayByWechat, {
|
||||
out_trade_no: that.data.GoodsMsg.order_no
|
||||
// merchant_no: that.data.GoodsMsg.merchant_no,
|
||||
// term_no: that.data.GoodsMsg.term_no,
|
||||
// out_trade_no: that.data.GoodsMsg.order_no
|
||||
|
||||
@ -495,9 +495,8 @@ Page({
|
||||
if (item.is_first == 1) {
|
||||
currentDevice = item
|
||||
currentDeviceId = item.device_id
|
||||
wx.setStorageSync('device_id', item.device_id),
|
||||
wx.setStorageSync('currentDevice', item)
|
||||
wx.setStorageSync('billing_method', item.billing_method)
|
||||
wx.setStorageSync('device_id', item.device_id)
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -541,6 +540,9 @@ Page({
|
||||
url: '/packages/master/order/index',
|
||||
})
|
||||
},
|
||||
formatPercentage(value) {
|
||||
return Math.max(0, Number((value || 0).toFixed(0)));
|
||||
},
|
||||
getInfo(e) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
@ -549,33 +551,47 @@ Page({
|
||||
let that = this
|
||||
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
|
||||
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) {
|
||||
res.device_part.forEach(item => {
|
||||
item.difDay = that.getDaysBetweenDates(item.start_time)
|
||||
item.percentageDay = Math.max(0, Math.round(
|
||||
((item.available_days - item.difDay) / item.available_days) * 100
|
||||
));
|
||||
item.percentageCapacity = Math.max(0, (item.threshold_volume / item.available_volume) * 100) //容量百分比
|
||||
const remainingDays = Math.max(0, (item.available_days || 0) - (item.difDay || 0));
|
||||
|
||||
item.percentageDay = that.formatPercentage(
|
||||
(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.yesterday = Number(res.yesterday).toFixed(2)
|
||||
console.log(res.difDay,'ressss');
|
||||
that.setData({
|
||||
currentDevice: res
|
||||
})
|
||||
that.getDeriveInfo()
|
||||
|
||||
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) {
|
||||
|
||||
} else {
|
||||
if (res.device_net.length == 0) {
|
||||
console.log(123);
|
||||
} else {
|
||||
let Xarr = [];
|
||||
let Yarr = [];
|
||||
|
||||
@ -122,19 +122,39 @@
|
||||
<view class="device-id text-size">
|
||||
编号:{{currentDevice.device_code}}
|
||||
</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>
|
||||
</view>
|
||||
|
||||
<view class="service-day text-size text-color" wx:if="{{currentDevice.remainDay}}">
|
||||
剩余天数
|
||||
<span class="day-num2">{{ currentDevice.remainDay}}</span>
|
||||
<span class="day text-size">天</span>
|
||||
<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 class="service-day text-size text-color" wx:if="{{!currentDevice.remainDay}}">
|
||||
<span class="day text-size">已欠费</span>
|
||||
|
||||
<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 text-size">天</span>
|
||||
</view>
|
||||
|
||||
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
|
||||
<span class="day text-size">已欠费</span>
|
||||
</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>
|
||||
<van-divider />
|
||||
@ -143,7 +163,7 @@
|
||||
<!-- 无合伙人 师傅 -->
|
||||
<view class="equi-contral equi-contral2">
|
||||
<view class="equi-contral-right">
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -233,4 +253,4 @@
|
||||
</view>
|
||||
|
||||
|
||||
<clientFooter />
|
||||
<clientFooter />
|
||||
@ -5,11 +5,11 @@ const app = getApp()
|
||||
// const server_url = "https://huishang.magicany.cc/api/v1";
|
||||
// const img_url = "https://huishang.magicany.cc";
|
||||
|
||||
// const server_url = "https://api.hshuishang.com/api/v1";
|
||||
// const img_url = "https://api.hshuishang.com";
|
||||
const server_url = "https://api.hshuishang.com/api/v1";
|
||||
const img_url = "https://api.hshuishang.com";
|
||||
|
||||
const server_url = "https://test.hshuishang.com/api/v1";
|
||||
const img_url = "https://test.hshuishang.com";
|
||||
// const server_url = "https://test.hshuishang.com/api/v1";
|
||||
// const img_url = "https://test.hshuishang.com";
|
||||
// https://api.hshuishang.com
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user