diff --git a/packages/WaterPurifier/pages/filter/filter.js b/packages/WaterPurifier/pages/filter/filter.js
index d29114d..2a07909 100644
--- a/packages/WaterPurifier/pages/filter/filter.js
+++ b/packages/WaterPurifier/pages/filter/filter.js
@@ -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"]
diff --git a/packages/WaterPurifier/pages/filter/filter.wxml b/packages/WaterPurifier/pages/filter/filter.wxml
index dbf1c1b..8251bb6 100644
--- a/packages/WaterPurifier/pages/filter/filter.wxml
+++ b/packages/WaterPurifier/pages/filter/filter.wxml
@@ -28,16 +28,20 @@
{{item.parts_name}}
-
+
{{item.percentageDay}}%
+
+
+ {{item.percentageCapacity}}%
+
+
-
- 剩余可用{{item.remaining_days}}天
+ 剩余可用{{item.available_days}}天
@@ -48,13 +52,12 @@
购买
- 剩余可用{{item.remaining_days}}天
+ 剩余可用{{item.available_days}}天
-
-
+
@@ -68,14 +71,14 @@
-
+
-
+
- {{currentFilter.percentageDay}}%
- {{currentFilter.percentageCapacity}}%
+ {{currentFilter.percentageDay}}%
+ {{currentFilter.percentageCapacity}}%
滤芯寿命
{{currentFilter.available_days}}天
@@ -84,7 +87,7 @@
{{currentFilter.parts_name}}
{{currentFilter.introduce}}
- 购买
+
重置
\ No newline at end of file
diff --git a/packages/WaterPurifier/pages/filter/filter.wxss b/packages/WaterPurifier/pages/filter/filter.wxss
index e045a32..f5d49df 100644
--- a/packages/WaterPurifier/pages/filter/filter.wxss
+++ b/packages/WaterPurifier/pages/filter/filter.wxss
@@ -157,9 +157,10 @@
.popView {
width: 499rpx;
- height: 580rpx;
+ /* height: 580rpx; */
background: #FFFFFF;
overflow: hidden;
+ padding-bottom: 40rpx;
}
.pop_cir {
diff --git a/pages/chooseEntrance/chooseEntrance.js b/pages/chooseEntrance/chooseEntrance.js
index 462ede0..de48727 100644
--- a/pages/chooseEntrance/chooseEntrance.js
+++ b/pages/chooseEntrance/chooseEntrance.js
@@ -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)
diff --git a/pages/deposit/deposit.js b/pages/deposit/deposit.js
index b3ef646..c4a1a36 100644
--- a/pages/deposit/deposit.js
+++ b/pages/deposit/deposit.js
@@ -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
diff --git a/pages/water_filter/water_filter.js b/pages/water_filter/water_filter.js
index f31e611..daf487b 100644
--- a/pages/water_filter/water_filter.js
+++ b/pages/water_filter/water_filter.js
@@ -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 = [];
diff --git a/pages/water_filter/water_filter.wxml b/pages/water_filter/water_filter.wxml
index 104ef68..1faf24e 100644
--- a/pages/water_filter/water_filter.wxml
+++ b/pages/water_filter/water_filter.wxml
@@ -122,19 +122,39 @@
编号:{{currentDevice.device_code}}
-
+
+
+
已服务{{currentDevice.difDay}}天
-
- 剩余天数
- {{ currentDevice.remainDay}}
- 天
+
+ 已服务0天
-
- 已欠费
+
+
+
+ 剩余天数
+ {{ currentDevice.remainDay}}
+ 天
+
+
+
+ 已欠费
+
+
+
+
+ 剩余天数
+ 0
+ 天
+
+
+
+
+
@@ -143,7 +163,7 @@
-
+
@@ -233,4 +253,4 @@
-
+
\ No newline at end of file
diff --git a/utils/util.js b/utils/util.js
index 1a0020f..84eea69 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -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