6.12管理端修改

This commit is contained in:
qiaojiale 2025-06-12 18:41:44 +08:00
parent d1645ab26d
commit 1078410227
42 changed files with 1656 additions and 1188 deletions

View File

@ -5,7 +5,6 @@ const getPartner = '/dealer/get-one' //经销商信息
const getPackageList = '/new-install/packages' //套餐购买列表
const getMasterList = '/master/list' //师傅列表
const createNewOrder = '/new-install/create' //创建新装工单
const phoneSearch = '/customer/phone-search' //搜索客户电话
@ -21,10 +20,18 @@ const getUninstallInfo = '/uninstall/one' //拆除工单详情
const getPartList = '/part_replace/list' //更换工单列表
const getPartInfo = '/part_replace/one' //更换工单详情
const masterSelect = '/master/select' //更换工单详情
const masterSelect = '/master/select' //师傅
const getMasterList = '/master/list' //师傅列表
const createMaster = '/master/create'
const getOrderPairList = '/order-repair/list'
const getOrderPairListInfo = '/order-repair/one'
const assignPartReplaceMaster = '/part_replace/assign' //指派
const apiArr = {
createMaster,
getOrderPairList,
getOrderPairListInfo,
masterSelect,
getproductList,
assignPartReplaceMaster,

View File

@ -5,9 +5,11 @@ const queryPayByWechat = '/wechat/water/query_pay' //查询交易结果
const HsqueryPay = '/lakala/hs-preorder' //预下单
const HsqueryPayByWechat = '/lakala/hs-trade-query' //查询交易结果
const payFail = '/wechat/water/pay-order-fail' //订单支付取消或失败
const PayJs = {
pay,
payFail,
queryPay,
HsqueryPay,
HsqueryPayByWechat,

View File

@ -15,54 +15,54 @@ Page({
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
checked:true,
checked: true,
areaList,
show:false, //弹出层
show: false, //弹出层
name:"",
phone:"",
area:"",
address:"",
message:"",
name: "",
phone: "",
area: "",
address: "",
message: "",
page_num:1,
page_size:10,
flag:false,
PartsList:[],
currentId:[],
currentName:[],
price:0,
page_num: 1,
page_size: 10,
flag: false,
PartsList: [],
currentId: [],
currentName: [],
price: 0,
orderMsg:"",//订单信息
GoodsMsg:"",//商户信息
orderMsg: "",//订单信息
GoodsMsg: "",//商户信息
},
ipt1(e){
ipt1(e) {
let that = this
that.setData({
name:e.detail.value
name: e.detail.value
})
},
ipt2(e){
ipt2(e) {
let that = this
that.setData({
phone:e.detail.value
phone: e.detail.value
})
},
ipt3(e){
ipt3(e) {
let that = this
that.setData({
address:e.detail.value
address: e.detail.value
})
},
ipt4(e){
ipt4(e) {
let that = this
that.setData({
message:e.detail.value
message: e.detail.value
})
},
onChange(e){
onChange(e) {
console.log(e);
let that = this
let PartsList = that.data.PartsList
@ -73,10 +73,10 @@ Page({
currentName = []
PartsList[e.currentTarget.dataset.idx].checked = !PartsList[e.currentTarget.dataset.idx].checked
price = 0
PartsList.forEach(item=>{
if(item.checked){
PartsList.forEach(item => {
if (item.checked) {
// price += item.unit_price
price = util.floatCalculate(price,item.unit_price,'+=')
price = util.floatCalculate(price, item.unit_price, '+=')
currentId.push(item.parts_id)
currentName.push(item.parts_name)
}
@ -89,251 +89,267 @@ Page({
})
},
getPartsByid(){
getPartsByid() {
wx.showLoading({
title: '加载中...',
})
let that = this
util.postUrl(apiArr.getdeviceListByid,{
device_id:Number(wx.getStorageSync('device_id')),
page_num:that.data.page_num,
page_size:that.data.page_size
},res=>{
util.postUrl(apiArr.getdeviceListByid, {
device_id: Number(wx.getStorageSync('device_id')),
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
console.log(res,'resss');
console.log(res, 'resss');
let flag
if(res.rows){
res.rows.forEach(item=>{
if (res.rows) {
res.rows.forEach(item => {
item.checked = false
})
if( res.rows.length == that.data.page_size){
if (res.rows.length == that.data.page_size) {
flag = true
}else{
} else {
flag = false
}
res.rows.forEach(item=>{
res.rows.forEach(item => {
item.parts_icon = util.img_url + item.parts_icon
})
that.setData({
PartsList:that.data.PartsList.concat(res.rows || []),
PartsList: that.data.PartsList.concat(res.rows || []),
flag,
page_size:that.data.page_size + 1
page_size: that.data.page_size + 1
})
}
})
},
createDeriveOrder(){
createDeriveOrder() {
let that = this
if(that.data.currentId.length == 0){
if (that.data.currentId.length == 0) {
wx.showToast({
title: '请选择商品',
icon:"none"
icon: "none"
})
return
}
if(!that.data.name){
if (!that.data.name) {
wx.showToast({
title: '请填写收货人',
icon:"none"
icon: "none"
})
return
}
if(!that.data.phone){
if (!that.data.phone) {
wx.showToast({
title: '请填写收货人电话',
icon:"none"
icon: "none"
})
return
}
if(!util.isPhone(that.data.phone)){
if (!util.isPhone(that.data.phone)) {
wx.showToast({
title: '请填写正确电话',
icon:"none"
icon: "none"
})
return
}
if(!that.data.area){
if (!that.data.area) {
wx.showToast({
title: '请选择所在地区',
icon:"none"
icon: "none"
})
return
}
if(!that.data.address){
if (!that.data.address) {
wx.showToast({
title: '请填写详情地址',
icon:"none"
icon: "none"
})
return
}
let parts_ids = that.data.currentId.join()
util.postUrl(apiArr.createDeviceOrder,{
device_id:Number(wx.getStorageSync('device_id')),
region:that.data.area,
address:that.data.address,
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.area,
address: that.data.address,
parts_ids,
total_price:String(that.data.price),
customer_name:that.data.name,
customer_phone:that.data.phone,
user_id:Number(wx.getStorageSync('userId')),
is_up_door:1
},res=>{
total_price: String(that.data.price),
customer_name: that.data.name,
customer_phone: that.data.phone,
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg:res
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg(){
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg,{
dealer_id:Number(that.data.orderMsg.DealerId),
user_id:Number(wx.getStorageSync('userId')),
shop_id:Number(wx.getStorageSync('shopId')),
},res=>{
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.orderMsg.DealerId),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
GoodsMsg:res
GoodsMsg: res
})
that.pay()
})
},
},
pay(){
pay() {
let that = this
let parts_ids = that.data.currentId.join()
let subject = that.data.currentName.join()
util.postUrl2(PayJs.pay,{
address:that.data.area + that.data.address,
goods_id:parts_ids,
merchant_no:that.data.GoodsMsg.merchant_no,
out_trade_no:that.data.orderMsg.OrderNo,
quantity:1,
remark:that.data.message,
util.postUrl2(PayJs.pay, {
address: that.data.area + that.data.address,
goods_id: parts_ids,
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.orderMsg.OrderNo,
quantity: 1,
remark: that.data.message,
subject,
term_no:that.data.GoodsMsg.term_no,
total_amount:String(that.data.price * 100),
user:String(wx.getStorageSync('userId')),
user_id:wx.getStorageSync('openId')
},res=>{
const {resp_data,msg} = res.data.data
console.log(res,'ssss');
if(msg == '成功'){
term_no: that.data.GoodsMsg.term_no,
total_amount: String(that.data.price * 100),
user: String(wx.getStorageSync('userId')),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
console.log(res, 'ssss');
if (msg == '成功') {
wx.requestPayment({
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){
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()
},
fail(fal){
console.log(fal);
fail(fal) {
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
},
queryPay(){
payFail(e) {
let that = this
util.postUrl2(PayJs.queryPay,{
merchant_no:that.data.GoodsMsg.merchant_no,
term_no:that.data.GoodsMsg.term_no,
out_trade_no:that.data.orderMsg.OrderNo
},res=>{
if(res.statusCode == '200'){
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.OrderId,
type: "3",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.GoodsMsg.merchant_no,
term_no: that.data.GoodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo
}, res => {
if (res.statusCode == '200') {
// wx.requestSubscribeMessage({
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
// })
wx.showToast({
title: '支付成功!',
})
}else{
} else {
wx.showToast({
title: res.msg,
})
}
})
},
},
account(){
account() {
wx.navigateTo({
url: '../payList/payList',
})
},
onClose(e){
onClose(e) {
let that = this
that.setData({
show:false
show: false
})
},
changeShow(){
changeShow() {
let that = this
that.setData({
show:true
show: true
})
},
//选择地区
AreaConfirm(e){
AreaConfirm(e) {
let that = this
let area = ''
if(e.detail.values[0].name == e.detail.values[1].name){
if (e.detail.values[0].name == e.detail.values[1].name) {
area = e.detail.values[1].name + e.detail.values[2].name
}else{
} else {
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
show:false,
show: false,
area
})
},
//取消
cancel(e){
cancel(e) {
let that = this
that.setData({
show:false
show: false
})
},
onShareAppMessage(){
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
}
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that= this
let that = this
that.getPartsByid()
wx.showShareMenu({
withShareTicket: true,
@ -381,7 +397,7 @@ onShareTimeline() {
*/
onReachBottom() {
let that = this
if(that.data.flag){
if (that.data.flag) {
that.getPartsByid()
}
},

View File

@ -214,7 +214,12 @@ Page({
that.queryPay()
},
fail(fal) {
console.log(fal);
console.log(fal.errMsg);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
@ -259,6 +264,17 @@ Page({
})
},
payFail(e){
let that = this
util.postUrl(PayJs.payFail,{
order_id:that.data.orderMsg.order_id,
type:"2",
state:e,
},res=>{
console.log(res);
})
},
changeShow() {
let that = this
that.setData({

View File

@ -58,6 +58,8 @@ Page({
selectPackage: ""
},
changeTab(e) {
console.log(e);
let that = this
@ -172,7 +174,11 @@ Page({
that.queryPay()
},
fail(fal) {
console.log(fal);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
@ -180,6 +186,17 @@ Page({
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.order_id,
type: "2",
state: e,
}, res => {
console.log(res);
})
},
//查询支付结果
queryPay() {
let that = this

View File

@ -1,5 +1,6 @@
let util = require("../../../../../utils/util")
const apiArr = require('../../../../../api/water_filter')
const apiArr2 = require('../../../../../api/partner')
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
Page({
@ -10,8 +11,9 @@ Page({
data: {
option1: [
{ text: '全部', value: 0 },
{ text: '正常', value: 1 },
{ text: '离线', value: 2 },
{ text: '已安装', value: 1 },
{ text: '空闲', value: 2 },
{ text: '已拆机', value: 3 },
],
option2: [
{ text: '全部', value: 0 },
@ -23,8 +25,11 @@ Page({
{ text: '制水故障', value: 6 },
{ text: '关机', value: 7 },
{ text: '已欠费', value: 8 },
{ text: '已还库', value: 9 },
{ text: '在库', value: 9 },
{ text: '激活失败', value: 10 },
],
stateType: {
1: '正常',
2: '报废',
@ -34,7 +39,7 @@ Page({
6: '制水故障',
7: '关机',
8: '已欠费',
9: '已还库',
9: '库',
},
value1: 0,
value2: 'a',
@ -64,7 +69,12 @@ Page({
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
})
},
addWorkOrders() {
console.log(123123);
wx.navigateTo({
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
})
},
// 网络状态选择
headerNetWorkClick(e) {
console.log('e', e);
@ -113,7 +123,7 @@ Page({
if (networkStatus) {
param = {
...param,
network_status: networkStatus
install_status: networkStatus
}
}
if (status) {
@ -123,20 +133,23 @@ Page({
}
}
util.postUrl(apiArr.deviceList, param, res => {
util.postUrl(apiArr2.deviceList, param, res => {
wx.hideLoading()
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
if (res.list && res.list.length == that.data.page_size) {
console.log(123);
flag = true
} else {
console.log(456);
flag = false
}
that.setData({
deviceList: that.data.deviceList.concat(res.rows || []),
deviceList: that.data.deviceList.concat(res.list || []),
total: res.total,
flag,
page_num: that.data.page_num + 1
})
console.log(that.data.flag);
})
},

View File

@ -5,14 +5,14 @@
</view>
<view class="deviceText">设备总数:{{total}}</view>
<view class="deviceIpt">
<input type="text" value="{{searchText}}" bindinput="ipt1" placeholder="设备编码/客户手机/客户姓名/设备地址" placeholder-style="color: #999999;font-size: 24rpx;" />
<input type="text" value="{{searchText}}" bindinput="ipt1" placeholder="设备编码" placeholder-style="color: #999999;font-size: 24rpx;" />
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
</view>
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item title="{{'网络状态'}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item title="{{'安装状态'}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item icon="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deviceList_downIcon.png" title="设备状态" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
@ -20,10 +20,6 @@
<view class="deviceItem_box">
<view class="deviceItem" wx:if="{{deviceList.length != 0}}" wx:for="{{deviceList}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备型号</view>
<view class="deviceItemCon_con">{{item.product_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户姓名</view>
<view class="deviceItemCon_con">{{item.customer_name}}</view>
@ -40,9 +36,16 @@
<view class="deviceItemCon_tit">设备状态</view>
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
<view class="deviceItemCon_con">{{item.address}}</view>
</view>
</view>
@ -54,6 +57,8 @@
</view>
<view class="addBtn" bind:tap="addWorkOrders">新增</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />

View File

@ -95,3 +95,36 @@
font-size: 26rpx;
color: #222222;
}
.addBtn {
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
width: 100rpx;
height: 100rpx;
background: #2583FF;
position: fixed;
right: 55rpx;
bottom: 200rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.addBtn::after {
content: '';
background: rgba(77, 154, 255,.5);
filter: blur(10.899999618530273rpx);
width: 90rpx;
height: 90rpx;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
border-radius: 50%;
overflow: hidden;
z-index: -1;
}

View File

@ -211,12 +211,28 @@ Page({
that.queryPay()
},
fail(fal) {
console.log(fal);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e){
let that = this
util.postUrl(PayJs.payFail,{
order_id:that.data.orderMsg.OrderId,
type:"3",
state:e,
},res=>{
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {

View File

@ -77,8 +77,8 @@
</van-circle>
<view class="cir_msg">
<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 != '2'}}">{{currentFilter.percentageDay}}%</view>
<view class="percentage" wx:if="{{billing_method == '2'}}">{{currentFilter.percentageCapacity}}%</view>
<view class="cir_msg_text">滤芯寿命</view>
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
</view>

View File

@ -17,18 +17,18 @@ Page({
h: app.menu.height, // 胶囊高度
value: '',
name:"",
phone:"",
message:"",
fileList:[],
fileList2:[],
time:"",
name: "",
phone: "",
message: "",
fileList: [],
fileList2: [],
time: "",
equipmentShow: false,
equipmentList: [],
selectEquipment: {}, // 所选设备信息
DoorTimeShow:false,
sucess:false,//是否报修成功
DoorTimeShow: false,
sucess: false,//是否报修成功
minDate: new Date().getTime(),
formatter(type, value) {
if (type === 'year') {
@ -43,47 +43,47 @@ Page({
return value;
},
},
deleteImg(e){
deleteImg(e) {
console.log(e);
let that = this
let fileList = that.data.fileList
let fileList2 = that.data.fileList2
fileList.splice(e.detail.index,1)
fileList2.splice(e.detail.index,1)
fileList.splice(e.detail.index, 1)
fileList2.splice(e.detail.index, 1)
that.setData({
fileList,
fileList2
})
},
ipt1(e){
ipt1(e) {
let that = this
that.setData({
name:e.detail.value
name: e.detail.value
})
},
ipt2(e){
ipt2(e) {
let that = this
that.setData({
phone:e.detail.value
phone: e.detail.value
})
},
ipt3(e){
ipt3(e) {
let that = this
that.setData({
message:e.detail
message: e.detail
})
},
switchShow(){
switchShow() {
let that = this
that.setData({
DoorTimeShow:!that.data.DoorTimeShow
DoorTimeShow: !that.data.DoorTimeShow
})
},
// 取消所选设备信息
headerCancelClick(){
headerCancelClick() {
this.setData({
selectEquipment: {}, // 所选设备信息
equipmentShow: false
@ -91,10 +91,10 @@ Page({
},
// 关闭弹窗
onClose(){
onClose() {
let that = this
that.setData({
DoorTimeShow:false
DoorTimeShow: false
})
},
headerEquipmentPopupClick() {
@ -109,8 +109,8 @@ Page({
})
},
onInput(event){
let that =this
onInput(event) {
let that = this
const date = new Date(event.detail);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零
@ -122,11 +122,11 @@ Page({
console.log(time);
that.setData({
time,
DoorTimeShow:false
DoorTimeShow: false
})
},
afterRead(e){
afterRead(e) {
const { file } = e.detail;
// 验证文件类型
if (file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image') {
@ -140,14 +140,14 @@ Page({
}
return true;
},
beforeRead(e){
beforeRead(e) {
console.log(e);
let that = this
wx.showLoading({
title: '上传中',
mask:true,
mask: true,
})
util.uploadFileUrl(e.detail.file.url,(res)=>{
util.uploadFileUrl(e.detail.file.url, (res) => {
wx.hideLoading()
let datas = JSON.parse(res)
console.log(datas.data);
@ -155,12 +155,12 @@ Page({
let fileList = that.data.fileList
let fileList2 = that.data.fileList2
let obj = {
url:url,
name:'avatar'
url: url,
name: 'avatar'
}
let obj2 = {
url:datas.data.path,
name:'avatar'
url: datas.data.path,
name: 'avatar'
}
fileList.push(obj)
fileList2.push(obj2)
@ -171,48 +171,49 @@ Page({
})
},
submit(){
const {selectEquipment, name, phone, time, message, fileList2} = this.data;
submit() {
const { selectEquipment, name, phone, time, message, fileList2 } = this.data;
let that = this
if (!selectEquipment.device_id) {
wx.showToast({
title: '请选择报修设备',
icon:"none"
icon: "none"
})
return
}
if(!name){
if (!name) {
wx.showToast({
title: '请填写联系人姓名',
icon:"none"
icon: "none"
})
return
}
if(!phone){
if (!phone) {
wx.showToast({
title: '请填写联系人电话',
icon:"none"
icon: "none"
})
return
}
if(!util.isPhone(phone)){
if (!util.isPhone(phone)) {
wx.showToast({
title: '请填写正确电话',
icon:"none"
icon: "none"
})
return
}
if(!time){
if (!time) {
wx.showToast({
title: '请选择上门时间',
icon:"none"
icon: "none"
})
return
}
if(!message){
if (!message) {
wx.showToast({
title: '请填写报修内容',
icon:"none"
icon: "none"
})
return
}
@ -220,17 +221,40 @@ Page({
title: '提交中...',
mask: true,
})
let that = this
util.postUrl(apiArr.repair,{
wx.getSetting({
withSubscriptions: true,
success: (res) => {
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
const itemSettings = res.subscriptionsSetting.itemSettings || {};
const tmplMap = {
'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA': '订单重新指派提醒',
'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24': '欠费通知',
'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg': '新订单提醒'
};
// 收集未订阅的模板ID
const unsubscribedTmplIds = [];
Object.keys(tmplMap).forEach(tmplId => {
if (itemSettings[tmplId] !== 'accept') {
unsubscribedTmplIds.push(tmplId);
}
});
if (unsubscribedTmplIds.length > 0) {
// 逐个订阅未订阅的消息
wx.requestSubscribeMessage({
tmplIds: unsubscribedTmplIds,
success: (res) => {
util.postUrl(apiArr.repair, {
appointment_time: time,
customer_name: name,
customer_phone: phone,
device_id: selectEquipment.device_id,
fault_desc: message,
fault_imgs: fileList2.length !== 0 ? fileList2[0].url : '',
user_id:Number(wx.getStorageSync('userId'))
},res=>{
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
@ -239,11 +263,91 @@ Page({
})
return;
}
this.setData({
that.setData({
sucess: true
})
})
},
fail: (err) => {
util.postUrl(apiArr.repair, {
appointment_time: time,
customer_name: name,
customer_phone: phone,
device_id: selectEquipment.device_id,
fault_desc: message,
fault_imgs: fileList2.length !== 0 ? fileList2[0].url : '',
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
title: '提交失败',
icon: 'none'
})
return;
}
that.setData({
sucess: true
})
})
}
});
}else{
util.postUrl(apiArr.repair, {
appointment_time: time,
customer_name: name,
customer_phone: phone,
device_id: selectEquipment.device_id,
fault_desc: message,
fault_imgs: fileList2.length !== 0 ? fileList2[0].url : '',
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
title: '提交失败',
icon: 'none'
})
return;
}
that.setData({
sucess: true
})
})
}
}
},
fail:()=>{
util.postUrl(apiArr.repair, {
appointment_time: time,
customer_name: name,
customer_phone: phone,
device_id: selectEquipment.device_id,
fault_desc: message,
fault_imgs: fileList2.length !== 0 ? fileList2[0].url : '',
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
title: '提交失败',
icon: 'none'
})
return;
}
that.setData({
sucess: true
})
})
}
});
},
/**
@ -260,17 +364,17 @@ Page({
init() {
wx.showLoading({
title: '加载中...',
mask:true
mask: true
})
postUrl(apiArr.BXDeviceList, {
page_num: 1,
page_size: 50, //TODO: 临时写一次获取50个后续优化
user_id:Number(wx.getStorageSync('userId'))
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading()
if(res.msg == '操作成功'){
if(res.rows){
res.rows.forEach(item=>{
if (res.msg == '操作成功') {
if (res.rows) {
res.rows.forEach(item => {
item.product_icon = util.img_url + item.product_icon
})
this.setData({
@ -283,11 +387,11 @@ Page({
headerSelectClick(e) {
console.log('e',e);
console.log('e', e);
this.setData({
selectEquipment: e.currentTarget.dataset.item,
name:e.currentTarget.dataset.item.customer_name,
phone:e.currentTarget.dataset.item.customer_phone,
name: e.currentTarget.dataset.item.customer_name,
phone: e.currentTarget.dataset.item.customer_phone,
equipmentShow: false
})
},
@ -352,18 +456,18 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
}
},
},
})

View File

@ -1,5 +1,6 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let apiArr2 = require('../../../../api/partner')
// packages/WaterPurifier/pages/upKeep/upKeep.js
Page({
@ -128,7 +129,7 @@ Page({
}
};
util.postUrl4(apiArr.OrderList,param,res=>{
util.postUrl4(apiArr2.getOrderPairList,param,res=>{
console.log('rererererererere', res);
wx.hideLoading()
let flag = false

View File

@ -34,9 +34,15 @@
<view class="device-field">
<label class="field-label">设备状态:</label>
<text class="field-value" wx:if="{{item.status == 1}}">在用</text>
<text class="field-value" wx:if="{{item.status == 2}}">已拆机</text>
<text class="field-value" wx:if="{{item.status == 3}}">已报废</text>
<text class="field-value" wx:if="{{item.status == 4}}">已在库</text>
<text class="field-value" wx:if="{{item.status == 2}}">待启用</text>
<text class="field-value" wx:if="{{item.status == 3}}">关机</text>
<text class="field-value" wx:if="{{item.status == 4}}">已拆机</text>
<text class="field-value" wx:if="{{item.status == 5}}">漏水</text>
<text class="field-value" wx:if="{{item.status == 6}}">制水故障</text>
<text class="field-value" wx:if="{{item.status == 7}}">报废</text>
<text class="field-value" wx:if="{{item.status == 8}}">已欠费</text>
<text class="field-value" wx:if="{{item.status == 9}}">在库</text>
<text class="field-value" wx:if="{{item.status == 10}}">激活失败</text>
</view>

View File

@ -55,25 +55,40 @@ Page({
show:false
})
},
formatPercentage(value) {
return Math.max(0, Number((value || 0).toFixed(0)));
},
getInfo() {
let that = this
console.log(that, 'ssss');
util.postUrl(apiArr.masterDeviceInfo, {
device_id: that.data.id
}, res => {
res.product_icon = util.img_url + res.product_icon
res.difDay = that.getDaysBetweenDates(res.install_time) //服务天数
res.remainDay = that.getDaysBetweenDates2(res.expiration_duration) //剩余天数
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.parts) {
res.parts.forEach(item => {
item.difDay = that.getDaysBetweenDates(item.start_time)
item.percentageDay = Math.round(
((item.available_days - item.difDay) / item.available_days) * 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
);
item.percentageCapacity = (item.threshold_volume / item.available_volume ) * 100 //容量百分比
})
}
res.today = Number(res.today).toFixed(2)
res.yesterday = Number(res.yesterday).toFixed(2)
that.setData({
currentDevice: res
})

View File

@ -61,11 +61,15 @@
<view class="device-state">
<block wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 6}}">
<image wx:if="{{currentDevice.sevice_status != 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff">{{currentDevice.sevice_status == '1'?'开机':'关机'}}</text>
</block>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon4.png" mode="" class="wifi-icon" />
@ -77,16 +81,34 @@
<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">
<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>
</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 />

View File

@ -4,6 +4,7 @@ let apiArr = require('../../../api/water_filter')
Page({
data: {
newOrderTotal: 200,
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
@ -148,6 +149,7 @@ Page({
that.setData({
NewOrderList: that.data.NewOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
newOrderTotal: res.total,
flag
})
} else {

View File

@ -43,10 +43,10 @@
<view class="order-field">
<text class="label">订单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待分配</text>
<text class="value " wx:if="{{item.status == '2'}}">安装</text>
<text class="value " wx:if="{{item.status == '3'}}">已安装</text>
<text class="value " wx:if="{{item.status == '4'}}">已取消</text>
<text class="value " wx:if="{{item.status == '5'}}">待激活</text>
<text class="value " wx:if="{{item.status == '2'}}">安装</text>
<text class="value " wx:if="{{item.status == '3'}}">待激活</text>
<text class="value " wx:if="{{item.status == '4'}}">已安装</text>
<text class="value " wx:if="{{item.status == '5'}}">忽略</text>
</view>
</view>
@ -91,10 +91,10 @@
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待维修</text>
<text class="value " wx:if="{{item.status == '2'}}">待分配</text>
<text class="value " wx:if="{{item.status == '3'}}">完成</text>
<text class="value " wx:if="{{item.status == '4'}}">已撤销</text>
<text class="value " wx:if="{{item.status == '1'}}">待指派</text>
<text class="value " wx:if="{{item.status == '2'}}">待维修</text>
<text class="value " wx:if="{{item.status == '3'}}">维修完成</text>
<text class="value " wx:if="{{item.status == '4'}}">已取消</text>
</view>
</view>
@ -198,7 +198,8 @@
<view class="order-field">
<text class="label">状态:</text>
<text class="value" wx:if="{{item.status == 2}}">已指派</text>
<text class="value" wx:if="{{item.status == 1}}">待指派</text>
<text class="value" wx:if="{{item.status == 2}}">待拆机</text>
<text class="value" wx:if="{{item.status == 3}}">待操作 </text>
<text class="value" wx:if="{{item.status == 4}}">巳完成</text>
</view>

View File

@ -126,9 +126,6 @@ Page({
imgList = ''
newArr = []
}
that.setData({
newOrderDesc: res,
imgList: newArr,
@ -136,8 +133,7 @@ Page({
newOrderDateAppointment:res.remaining_days
})
if (res.status == 3 ) {
if (res.status == 5 ) {
that.getDeriveInfo()
let imgList2 = ''
let imgList = []
@ -232,7 +228,7 @@ Page({
if (res.confirm) {
util.postUrl(apiArr.completeNewOrder, {
install_id: Number(that.data.id),
status: 5,
status: 3,
install_desc: that.data.msg,
install_imgs: that.data.imgList2.join(','),
install_time: util.getCurrentTime(),

View File

@ -37,8 +37,10 @@
<view class="info-item">
<text class="label">订单状态:</text>
<text class="value " wx:if="{{newOrderDesc.status == '1'}}">待分配</text>
<text class="value " wx:if="{{newOrderDesc.status == '2'}}">待安装</text>
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">已安装</text>
<text class="value " wx:if="{{newOrderDesc.status == '2'}}">安装中</text>
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">待激活</text>
<text class="value " wx:if="{{newOrderDesc.status == '4'}}">已安装</text>
<text class="value " wx:if="{{newOrderDesc.status == '5'}}">忽略</text>
</view>
<view class="info-item" wx:if="{{newOrderDesc.product_icon}}">
<text class="label">产品图片:</text>
@ -65,7 +67,7 @@
</view>
<view class="info-item item2">
<text class="label">设备编码:</text>
<text class="label">设备编码:{{newOrderDesc.device_code}}</text>
<view class="value value2" wx:if="{{!deviceCode}}">
<view class="btn" bind:tap="scanQrcode" wx:if="{{newOrderDesc.status == '2'}}">去扫码</view>
</view>
@ -76,7 +78,7 @@
</view>
</view>
<view class="info-item" wx:if="{{newOrderDesc.status == 5}}">
<view class="info-item" wx:if="{{newOrderDesc.status == 3}}">
<text class="label">剩余天数:</text>
<input class="value" type="number" bindinput="changeNewAppointment" placeholder="请输入剩余天数" value="{{newOrderDateAppointment}}" />
</view>
@ -136,16 +138,17 @@
<view class="info-item">
<text class="label">订单状态:</text>
<text class="value " wx:if="{{repairOrderDesc.status == '1'}}">待分配</text>
<text class="value " wx:if="{{repairOrderDesc.status == '2'}}">待分配</text>
<text class="value " wx:if="{{repairOrderDesc.status == '3'}}">维修</text>
<text class="value " wx:if="{{repairOrderDesc.status == '4'}}">已撤销</text>
<text class="value " wx:if="{{repairOrderDesc.status == '1'}}">待指派</text>
<text class="value " wx:if="{{repairOrderDesc.status == '2'}}">待维修</text>
<text class="value " wx:if="{{repairOrderDesc.status == '3'}}">维修完成</text>
<text class="value " wx:if="{{repairOrderDesc.status == '4'}}">已取消</text>
</view>
<view class="info-item">
<text class="label">工单来源:</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 1}}">微信</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 2}}">线下</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 1}}">系统</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 2}}">微信</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 3}}">后台</text>
</view>
<view class="info-item">
@ -192,7 +195,10 @@
<view class="section-title">工单信息</view>
<view class="info-item">
<text class="label">配件名称:</text>
<text class="value">{{partOrderDesc.parts_name || '暂无数据'}}</text>
<text class="value">
<text wx:for="{{partOrderDesc.parts_list}}" wx:key="index">{{item.parts_name}}</text>
</text>
<!-- <text class="value">{{partOrderDesc.parts_name || '暂无数据'}}</text> -->
</view>
<view class="info-item">
@ -217,8 +223,9 @@
<view class="info-item">
<text class="label">工单来源:</text>
<text class="value " wx:if="{{partOrderDesc.order_source == '1'}}">微信</text>
<text class="value " wx:if="{{partOrderDesc.order_source == '2'}}">线下</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 1}}">系统</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 2}}">微信</text>
<text class="value" wx:if="{{repairOrderDesc.order_source == 3}}">后台</text>
</view>
@ -324,6 +331,7 @@
</view>
</view>
<view class="section" wx:if="{{type == 3}}">
<view class="section-title">拆除说明</view>
<view class="info-item">
@ -360,7 +368,7 @@
<view class="complete-btn-container" wx:if="{{type == 0 && !dis1 }}">
<button class="complete-btn cancel-btn" bindtap="cancelNewOrder">撤销</button>
<button class="complete-btn" bindtap="completeNewOrder" wx:if="{{(newOrderDesc.status == 2 || newOrderDesc.status == 1)}}">完成</button>
<button class="complete-btn " bindtap="jihuoItem" wx:if="{{newOrderDesc.status == 5}}">激活</button>
<button class="complete-btn " bindtap="jihuoItem" wx:if="{{newOrderDesc.status == 3}}">激活</button>
</view>
<view class="complete-btn-container" wx:if="{{type == 1 && !dis2 }}">

View File

@ -12,15 +12,17 @@ Page({
statusType: {
1: '待分配',
2: '安装中',
3: '已安装',
4: '已撤销',
3: '待激活',
4: '已安装',
5: '忽略',
},
option1: [
{ text: '全部', value: 0 },
{ text: '待分配', value: 1 },
{ text: '安装中', value: 2 },
{ text: '已安装', value: 3 },
{ text: '已撤销', value: 4 },
{ text: '待激活', value: 3 },
{ text: '已安装', value: 4 },
{ text: '忽略', value: 5 },
],
option2: [
{ text: '渠道', value: 'a' },
@ -234,9 +236,11 @@ Page({
that.setData({
page_num:1,
flag:false,
deviceList:[]
})
setTimeout(()=>{
that.setData({
deviceList:[]
})
that.getNewOrderList()
},1500)
})

View File

@ -10,14 +10,12 @@
<view class="orderList" wx:if="{{deviceList.length != 0}}">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.install_id}}">
<view class="orderItem_tit">工单号:{{item.install_no}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item" wx:if="{{item.status == 3 || item.status == 4 || item.status == 5}}">
<view class="orderItem_Item_tit">设备号</view>
<view class="orderItem_Item_con">{{item.device_id}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户型号</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
@ -42,9 +40,10 @@
<view class="state state3" catch:tap="headerOkClick" wx:if="{{item.status === 3}}">完成</view>
</view>
</view>
</view>
<view class="addBtn" bind:tap="addWorkOrder">新增</view>
</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />

View File

@ -3,6 +3,7 @@ import { areaList } from '../../data/index';
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let apiArr2 = require('../../../../api/partner')
// packages/partner/pages/creatMaster/creatMaster.js
Page({
@ -65,6 +66,8 @@ Page({
},
getPhoncreateMastereByUser(){
let that = this
wx.showLoading({
title: '创建中...',
@ -128,10 +131,10 @@ Page({
let avatar
if(that.data.fileList2.length != 0){
avatar = that.data.fileList2[0].url
avatar = that.data.fileList2[0].url.path
}
util.postUrl(apiArr.createMaster,{
util.postUrl(apiArr2.createMaster,{
address:that.data.address,
avatar,
name:that.data.name,

View File

@ -23,41 +23,98 @@ Page({
password: e.detail.value
})
},
accountLogin(){
let that=this
accountLogin() {
let that = this
wx.showLoading({
title: '登录中...',
mask:true
mask: true
})
util.postUrl(apiArr.login,{
account:that.data.account,
password:that.data.password
},res=>{
wx.getSetting({
withSubscriptions: true,
success: (res) => {
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
const itemSettings = res.subscriptionsSetting.itemSettings || {};
const tmplMap = {
're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44': '新注册用户提醒',
'2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU': '订单续费通知',
};
// 收集未订阅的模板ID
const unsubscribedTmplIds = [];
Object.keys(tmplMap).forEach(tmplId => {
if (itemSettings[tmplId] !== 'accept') {
unsubscribedTmplIds.push(tmplId);
}
});
if (unsubscribedTmplIds.length > 0) {
// 逐个订阅未订阅的消息
wx.requestSubscribeMessage({
tmplIds: unsubscribedTmplIds,
success: (res) => {
util.postUrl(apiArr.login, {
account: that.data.account,
password: that.data.password
}, res => {
wx.hideLoading()
if(res.msg == '操作成功'){
if (res.msg == '操作成功') {
wx.setStorageSync('atoken', res.token)
that.getInfo()
}
})
},
fail: (err) => {
util.postUrl(apiArr.login, {
account: that.data.account,
password: that.data.password
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
wx.setStorageSync('atoken', res.token)
that.getInfo()
}
})
}
});
}else{
util.postUrl(apiArr.login, {
account: that.data.account,
password: that.data.password
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
wx.setStorageSync('atoken', res.token)
that.getInfo()
}
})
}
}
},
});
getInfo(){
},
getInfo() {
let that = this
util.postUrl4(apiArr.loginInfo,{},res=>{
util.postUrl4(apiArr.loginInfo, {}, res => {
console.log(res);
wx.showToast({
title: '登录成功!',
})
wx.setStorageSync('admin', res.data)
setTimeout(()=>{
setTimeout(() => {
wx.navigateTo({
url: '/packages/partner/pages/partner',
})
},1500)
}, 1500)
})
},
tohome(){
tohome() {
wx.redirectTo({
url: '/pages/chooseEntrance/chooseEntrance',
})

View File

@ -49,7 +49,8 @@ Page({
flag = false
}
res.rows.forEach(item=>{
item.avatar = util.img_url + item.avatar
// item.avatar = util.img_url + item.avatar
item.avatar = item.avatar.startsWith('http')?item.avatar: util.img_url + item.avatar
})
that.setData({

View File

@ -1,5 +1,6 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let apiArr2 = require('../../../../api/partner')
// packages/partner/pages/orderDesc/orderDesc.js
Page({
@ -12,8 +13,9 @@ Page({
statusType: {
1: '待分配',
2: '安装中',
3: '已安装',
4: '已撤销'
3: '待激活',
4: '已安装',
5: '忽略',
},
Info:{}
},
@ -26,7 +28,7 @@ Page({
install_id:Number(that.data.install_id)
}
if (this.data.type === 'repair') {
url = apiArr.repairOrderOne;
url = apiArr2.getOrderPairListInfo;
param = {
repair_id: Number(that.data.install_id)
}
@ -40,7 +42,7 @@ Page({
headerPicClick() {
wx.previewImage({
urls: [this.data.Info.fault_imgs]
urls: [ util.img_url + this.data.Info.fault_imgs]
})
},

View File

@ -33,7 +33,7 @@
<view class="pic_view">
<!-- <image class="label_pic" src="/packages/equipment/_assets/Group_824.png" mode=""/>
<image class="label_pic" src="/packages/equipment/_assets/Group_824.png" mode=""/> -->
<image class="label_pic" bindtap='headerPicClick' src="{{Info.fault_imgs}}" mode=""/>
<image class="label_pic" bindtap='headerPicClick' src="{{ util.img_url + Info.fault_imgs}}" mode=""/>
</view>
</view>
</view>
@ -112,5 +112,4 @@
</view>
</view>
<Footer></Footer>

View File

@ -19,8 +19,8 @@
<view class="item">
<text class="label">来源</text>
<text class="label_desc wx_name" wx:if="{{Info.order_source == 1}}">系统</text>
<text class="label_desc wx_name" wx:if="{{Info.order_source == 2}}">小程序</text>
<text class="label_desc wx_name" wx:if="{{Info.order_source != 1 && Info.order_source != 2}}">其他</text>
<text class="label_desc wx_name" wx:if="{{Info.order_source == 2}}">微信</text>
<text class="label_desc wx_name" wx:if="{{Info.order_source == 3}}">后台</text>
</view>
<view class="item">
<text class="label">区域</text>
@ -54,5 +54,4 @@
</view>
</view>
<Footer></Footer>

View File

@ -1,38 +1,62 @@
Page({
data: {
subscribeList: [
{ id: 1, name: '订单付款通知', subscribed: false, },
{ id: 2, name: '订单续费通知', subscribed: false },
{ id: 3, name: '欠费通知', subscribed: false },
{ id: 4, name: '新注册用户提醒', subscribed: false },
{ id: 5, name: '工单状态通知', subscribed: false },
{ id: 6, name: '工单完成通知', subscribed: false },
{ id: 7, name: '工单派工通知', subscribed: false },
{ id: 8, name: '设备告警通知', subscribed: false },
{ id: 9, name: '订单重新指派提醒', subscribed: false },
{ id: 10, name: '新订单提醒', subscribed: false },
{ id: 11, name: '设备故障通知', subscribed: false },
{ id: 1, name: '订单付款通知', status: 'unsubscribed' },
{ id: 2, name: '订单续费通知', status: 'unsubscribed' },
{ id: 3, name: '欠费通知', status: 'unsubscribed' },
{ id: 4, name: '新注册用户提醒', status: 'unsubscribed' },
{ id: 5, name: '工单状态通知', status: 'unsubscribed' },
{ id: 6, name: '工单完成通知', status: 'unsubscribed' },
{ id: 7, name: '工单派工通知', status: 'unsubscribed' },
{ id: 8, name: '设备告警通知', status: 'unsubscribed' },
{ id: 9, name: '订单重新指派提醒', status: 'unsubscribed' },
{ id: 10, name: '新订单提醒', status: 'unsubscribed' },
{ id: 11, name: '设备故障通知', status: 'unsubscribed' },
]
},
onLoad() {
// 从缓存加载用户订阅状态
const savedSubs = wx.getStorageSync('subscribeSettings') || {};
const tmplIds = {
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0',
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU',
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24',
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44',
5: '_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4',
6: 'CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384',
7: 'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4',
8: 'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo',
9: 'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA',
10: 'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg',
11: 'VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s' // 促销活动通知模板ID
};
wx.getSetting({
withSubscriptions: true,
success: (res) => {
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
const itemSettings = res.subscriptionsSetting.itemSettings || {};
this.setData({
subscribeList: this.data.subscribeList.map(item => ({
...item,
subscribed: savedSubs[item.id] || false
status: itemSettings[tmplIds[item.id]] === 'accept' ? 'subscribed' :
itemSettings[tmplIds[item.id]] === 'reject' ? 'rejected' : 'unsubscribed'
}))
});
}
}
});
},
toggleSubscribe(e) {
handleSubscribe(e) {
const { id } = e.currentTarget.dataset;
const newValue = e.detail.value;
const item = this.data.subscribeList.find(item => item.id === id);
// 检查是否之前被拒绝过
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
if (newValue && rejected[id]) {
if (item.status === 'subscribed') {
return; // 已订阅的不做处理
}
// 如果是已拒绝状态,提示用户去设置开启权限
if (item.status === 'rejected') {
wx.showModal({
title: '提示',
content: '您之前拒绝了订阅,需要前往设置重新开启',
@ -42,70 +66,7 @@ Page({
wx.openSetting({
success: (res) => {
if (res.authSetting['scope.subscribeMessage']) {
// 用户开启了订阅权限立即更新UI状态为开启
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? { ...item, subscribed: true } : item
)
});
// 清除拒绝记录
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
delete rejected[id];
wx.setStorageSync('rejectedSubscriptions', rejected);
// 保存订阅状态
this.saveSubscribeStatus(id, true);
// 主动触发订阅请求
this.requestSubscribeMessage(id, true);
} else {
// 恢复开关状态
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? { ...item, subscribed: false } : item
)
});
}
}
});
} else {
// 恢复开关状态
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? { ...item, subscribed: false } : item
)
});
}
}
});
return;
}
// 立即更新UI状态为点击后的值临时状态
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? { ...item, subscribed: newValue } : item
)
});
// 发送订阅请求
this.requestSubscribeMessage(id, newValue);
},
// 替换 toggleSubscribe 方法
handleSubscribe(e) {
const { id } = e.currentTarget.dataset;
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
if (rejected[id]) {
wx.showModal({
title: '提示',
content: '您之前拒绝了订阅,请点击确定前往设置页面开启订阅权限',
success: (res) => {
if (res.confirm) {
wx.openSetting({
success: (res) => {
// 这里只需要检查用户是否打开了总开关
if (res.authSetting['scope.subscribeMessage']) {
// 重新尝试订阅
// 用户开启了权限,重新尝试订阅
this.requestSubscribeMessage(id);
}
}
@ -114,23 +75,23 @@ Page({
}
});
} else {
// 未订阅状态直接触发订阅
this.requestSubscribeMessage(id);
}
},
// 修改 requestSubscribeMessage 方法
requestSubscribeMessage(id) {
const tmplIds = {
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0', // 滤芯更换提醒模板ID
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU', // 设备异常提醒模板ID
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24', // 水质检测报告模板ID
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44', // 服务到期提醒模板ID
5: '_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4', // 服务到期提醒模板ID
6: 'CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384', // 服务到期提醒模板ID
7: 'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4', // 服务到期提醒模板ID
8: 'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo', // 服务到期提醒模板ID
9: 'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA', // 服务到期提醒模板ID
10: 'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg', // 服务到期提醒模板ID
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0',
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU',
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24',
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44',
5: '_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4',
6: 'CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384',
7: 'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4',
8: 'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo',
9: 'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA',
10: 'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg',
11: 'VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s' // 促销活动通知模板ID
};
@ -138,39 +99,24 @@ Page({
tmplIds: [tmplIds[id]],
success: (res) => {
if (res[tmplIds[id]] === 'accept') {
// 清除拒绝记录
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
delete rejected[id];
wx.setStorageSync('rejectedSubscriptions', rejected);
// 保存订阅状态
this.saveSubscribeStatus(id, true);
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? {...item, status: 'subscribed'} : item
)
});
wx.showToast({ title: '订阅成功' });
} else {
// 记录拒绝状态
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
rejected[id] = true;
wx.setStorageSync('rejectedSubscriptions', rejected);
wx.showToast({
title: '订阅被拒绝',
icon: 'none'
this.setData({
subscribeList: this.data.subscribeList.map(item =>
item.id === id ? {...item, status: 'rejected'} : item
)
});
wx.showToast({ title: '订阅被拒绝', icon: 'none' });
}
},
fail: (err) => {
wx.showToast({
title: '订阅失败',
icon: 'none'
});
wx.showToast({ title: '订阅失败', icon: 'none' });
}
});
},
// saveSubscribeStatus 方法保持不变
saveSubscribeStatus(id, subscribed) {
// 只更新缓存不更新UI
const settings = wx.getStorageSync('subscribeSettings') || {};
settings[id] = subscribed;
wx.setStorageSync('subscribeSettings', settings);
}
});

View File

@ -1,7 +1,14 @@
<!--pages/SubscribeMessage/SubscribeMessage.wxml-->
<view class="container">
<view class="subscribe-item" wx:for="{{subscribeList}}" wx:key="id" bindtap="handleSubscribe" data-id="{{item.id}}">
<text class="item-name">{{item.name}}</text>
<text class="item-action">订阅</text>
<text>{{item.name}}</text>
<view class="status-container">
<view class="status-text {{item.status}}">
{{item.status === 'subscribed' ? '已订阅' :
item.status === 'rejected' ? '已拒绝' : '未订阅'}}
</view>
<view class="action-text" wx:if="{{item.status !== 'subscribed'}}">去订阅</view>
</view>
</view>
</view>

View File

@ -10,6 +10,36 @@
border-bottom: 1rpx solid #f5f5f5;
}
.status-container {
display: flex;
align-items: center;
}
.status-text {
font-size: 26rpx;
margin-right: 15rpx;
white-space: nowrap;
}
.status-text.subscribed {
color: #07c160;
}
.status-text.rejected {
color: #ee0a24;
}
.status-text.unsubscribed {
color: #576b95;
}
.action-text {
font-size: 26rpx;
/* color: #576b95; */
white-space: nowrap;
}
.item-name {
font-size: 32rpx;
color: #333;

View File

@ -107,7 +107,7 @@ Page({
if (accountInfo.miniProgram.version) {
version = accountInfo.miniProgram.version
} else {
version = '1.0.17'
version = '1.0.19'
}
wx.setStorageSync('version', version)

View File

@ -8,7 +8,10 @@
height: 100vh;
padding-top: 300rpx;
}
page{
box-sizing: border-box;
height: 100vh;
}
.title {
font-size: 36rpx;
font-weight: bold;

View File

@ -301,27 +301,7 @@ Page({
that.setData({
GoodsMsg: res
})
that.pay()
// wx.requestPayment({
// timeStamp: String(res.time_stamp),
// nonceStr: String(res.nonce_str),
// package: String(res.package),
// signType: String(res.sign_type),
// paySign: String(res.pay_sign),
// success(res3) {
// console.log(res3);
// that.queryPay()
// },
// fail(fal) {
// console.log(fal);
// }
// })
})
},
@ -354,37 +334,79 @@ Page({
that.queryPay()
},
fail(fal) {
console.log(fal);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.GoodsMsg.id,
type: "1",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
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
}, res => {
if (res.statusCode == '200') {
// wx.requestSubscribeMessage({
// tmplIds:['pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg'],
// success(res){
// console.log(res);
// },
// fail(err){
// console.log(err);
// }
// })
wx.showToast({
title: '支付成功!',
})
that.getUserInfo()
wx.getSetting({
withSubscriptions: true,
success: (res) => {
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
const itemSettings = res.subscriptionsSetting.itemSettings || {};
const tmplMap = {
'_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4': '工单状态通知',
'VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s': '设备故障通知',
'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo': '设备告警通知'
};
const unsubscribedTmplIds = [];
Object.keys(tmplMap).forEach(tmplId => {
if (itemSettings[tmplId] !== 'accept') {
unsubscribedTmplIds.push(tmplId);
}
});
if (unsubscribedTmplIds.length > 0) {
wx.requestSubscribeMessage({
tmplIds: unsubscribedTmplIds,
success: (res) => {
console.log('订阅成功', res);
that.getUserInfo();
},
fail: (err) => {
console.error('订阅失败', err);
that.getUserInfo();
}
});
} else {
that.getUserInfo();
}
}
},
fail: () => {
that.getUserInfo();
}
});
} else {
wx.showToast({
title: res.msg,

View File

@ -68,7 +68,9 @@
<text class="label">详细说明</text>
<view class="value">
<!-- <input type="text" value="{{selectedDeposit.desc}}" placeholder-style="font-size: 26rpx;color:#999" disabled /> -->
<textarea auto-height value="{{selectedDeposit.desc}}" disabled />
<!-- <textarea auto-height value="{{selectedDeposit.desc}}" disabled /> -->
<rich-text nodes="{{selectedDeposit.desc}}"/>
</view>
</view>

View File

@ -11,9 +11,9 @@ Page({
loginType: 'account', // 默认手机登录
password: "",
account: "",
type:""
type: ""
},
navigateToAgreement(){
navigateToAgreement() {
wx.navigateTo({
url: '../Agreement/Agreement',
})
@ -44,10 +44,74 @@ Page({
}
that.setData({
loginType,
type:options.type
type: options.type
})
},
accountLogin() {
let that = this
wx.showLoading({
title: '登录中...',
mask: true
})
let version = wx.getStorageSync('version')
if(version){
wx.login({
success: (res) => {
postUrl3(apiArr.accountLogin, {
phone: that.data.account,
code:res.code,
pass: that.data.password,
version
}, version, res2 => {
wx.hideLoading()
wx.hideLoading()
if (res2.token) {
wx.setStorageSync('ctoken', res2.token);
wx.setStorageSync('loginMaster', 1);
wx.setStorageSync('is_deal', res2.is_deal);
wx.setStorageSync('is_dev', res2.is_dev);
wx.setStorageSync('is_shop', res2.is_shop);
postUrl(apiArr.loginInfo, {}, ress => {
if (ress.error) return;
// 保存userId 后续接口使用
wx.setStorageSync('userId', ress.user_id);
wx.setStorageSync('openId', ress.open_id);
wx.setStorageSync('shopId', ress.wshop_id);
wx.setStorageSync('mshopId', ress.mshop_id);
wx.setStorageSync('dealer_id', ress.dealer_id);
this.setData({
isLogin: true,
})
}, res.token)
wx.showToast({
title: '登录成功',
icon: 'success',
mask: true,
duration: 2000,
success: () => {
console.log(wx.getStorageSync('is_dev'),'isdev');
if(wx.getStorageSync('is_dev') == '0' || wx.getStorageSync('is_dev') == '1'){
wx.navigateTo({
url: '/pages/deposit/deposit',
})
}else{
setTimeout(() => {
this.tohome();
}, 2000)
}
}
});
}else{
}
})
},
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -137,50 +201,6 @@ Page({
},
getPermission() {
let that = this
wx.requestSubscribeMessage({
tmplIds: ["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0", "2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU", "eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24"],
success(res){
console.log(res,'sucs');
},
fail(err){
console.log(err,'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["re34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44", "_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4", "CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384"],
success(res){
console.log(res,'sucs');
},
fail(err){
console.log(err,'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4", "T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo", "q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA"],
success(res){
console.log(res,'sucs');
},
fail(err){
console.log(err,'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg", "VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s"],
success(res){
console.log(res,'sucs');
},
fail(err){
console.log(err,'err');
}
})
},
getPhoneNumber(event) {
let that = this
const { isLogin } = this.data;
@ -191,17 +211,10 @@ Page({
mask: true
});
postUrl(apiArr.loginGetPhone, {
code: event.detail.code
}, res => {
if (isLogin) {
console.log(res);
wx.setStorageSync('phone', res.phone);
wx.hideLoading();
wx.showToast({
@ -210,9 +223,10 @@ Page({
mask: true,
duration: 2000,
success: () => {
this.tohome();
that.tohome();
}
});
} else {
wx.hideLoading();
wx.showToast({
@ -239,78 +253,17 @@ Page({
}
},
accountLogin() {
let that = this
wx.showLoading({
title: '登录中...',
mask: true
})
let version = wx.getStorageSync('version')
if(version){
postUrl3(apiArr.accountLogin, {
phone: that.data.account,
pass: that.data.password,
version
}, version, res => {
wx.hideLoading()
wx.hideLoading()
if (res.token) {
wx.setStorageSync('ctoken', res.token);
wx.setStorageSync('loginMaster', 1);
wx.setStorageSync('is_deal', res.is_deal);
wx.setStorageSync('is_dev', res.is_dev);
wx.setStorageSync('is_shop', res.is_shop);
postUrl(apiArr.loginInfo, {}, ress => {
if (ress.error) return;
// 保存userId 后续接口使用
wx.setStorageSync('userId', ress.user_id);
wx.setStorageSync('openId', ress.open_id);
wx.setStorageSync('shopId', ress.wshop_id);
wx.setStorageSync('mshopId', ress.mshop_id);
wx.setStorageSync('dealer_id', ress.dealer_id);
this.setData({
isLogin: true,
})
}, res.token)
wx.showToast({
title: '登录成功',
icon: 'success',
mask: true,
duration: 2000,
success: () => {
console.log(wx.getStorageSync('is_dev'),'isdev');
if(wx.getStorageSync('is_dev') == '0' || wx.getStorageSync('is_dev') == '1'){
wx.navigateTo({
url: '/pages/deposit/deposit',
})
}else{
setTimeout(() => {
this.tohome();
}, 2000)
}
}
});
}else{
}
})
}
},
// 返回主页
tohome: function () {
let that= this
let that = this
wx.redirectTo({
url: '/pages/water_filter/water_filter'
});
},
backHomes(){
backHomes() {
wx.redirectTo({
url: '/pages/chooseEntrance/chooseEntrance',
})

View File

@ -11,8 +11,9 @@ Page({
statusType: {
1: '待分配',
2: '安装中',
3: '已安装',
4: '已撤销',
3: '待激活',
4: '已安装',
5: '忽略',
},
value1: 0,

View File

@ -47,8 +47,10 @@
<view class="info-item">
<text class="label">订单状态:</text>
<text class="value " wx:if="{{newOrderDesc.status == '1'}}">待分配</text>
<text class="value " wx:if="{{newOrderDesc.status == '2'}}">待分配</text>
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">已安装</text>
<text class="value " wx:if="{{newOrderDesc.status == '2'}}">安装中</text>
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">待激活</text>
<text class="value " wx:if="{{newOrderDesc.status == '4'}}">已安装</text>
<text class="value " wx:if="{{newOrderDesc.status == '5'}}">忽视</text>
</view>
<view class="info-item">

View File

@ -26,7 +26,7 @@
.label {
color: #666;
font-size: 28rpx;
width: 160rpx;
width: 210rpx;
}
.value {

View File

@ -88,17 +88,31 @@ Page({
chartData: {
xAxis: [],
series: []
}
},
back(){
nav_list: [
{
url: "/pages/water_filter/water_filter",
nav_name: "设备",
photo: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/deviceIcon.png"
},
{
url: "/pages/info/info",
nav_name: "我的",
photo: "https://zhsq.hshuishang.com/attachs/navigation/2024/12/23/6768c0b16ce89.png"
},
],
foot_width: '50%',
},
back() {
wx.redirectTo({
url: '/pages/chooseEntrance/chooseEntrance',
})
},
scanOrder() {
let that= this
let that = this
util.postUrl(apiArr.scanOrder, { open_id: wx.getStorageSync('openId') }, res => {
console.log(res,'数据返回');
console.log(res, '数据返回');
if (res.id) {
if (wx.canIUse('requestMerchantTransfer')) {
wx.requestMerchantTransfer({
@ -106,7 +120,7 @@ Page({
appId: res.app_id,
package: res.package_info,
success: (ress) => {
console.log(res,'成功');
console.log(res, '成功');
that.queryOrder(res.id)
wx.showToast({
title: '支付成功!',
@ -114,7 +128,7 @@ Page({
})
},
fail: (res) => {
console.log(res,'失败');
console.log(res, '失败');
wx.showToast({
title: '支付失败',
icon: "none"
@ -138,47 +152,47 @@ Page({
let that = this
wx.requestSubscribeMessage({
tmplIds: ["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0", "2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU", "eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24"],
success(res){
console.log(res,'sucs');
success(res) {
console.log(res, 'sucs');
},
fail(err){
console.log(err,'err');
fail(err) {
console.log(err, 'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["re34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44", "_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4", "CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384"],
success(res){
console.log(res,'sucs');
success(res) {
console.log(res, 'sucs');
},
fail(err){
console.log(err,'err');
fail(err) {
console.log(err, 'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4", "T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo", "q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA"],
success(res){
console.log(res,'sucs');
success(res) {
console.log(res, 'sucs');
},
fail(err){
console.log(err,'err');
fail(err) {
console.log(err, 'err');
}
})
wx.requestSubscribeMessage({
tmplIds: ["pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg", "VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s"],
success(res){
console.log(res,'sucs');
success(res) {
console.log(res, 'sucs');
},
fail(err){
console.log(err,'err');
fail(err) {
console.log(err, 'err');
}
})
},
queryOrder(data){
queryOrder(data) {
let that = this
util.postUrl(api.queryOrder,{id:data},res=>{
util.postUrl(api.queryOrder, { id: data }, res => {
console.log(res);
})
},
@ -186,7 +200,7 @@ Page({
replay(e) {
wx.showLoading({
title: '重置中...',
mask:true
mask: true
})
util.postUrl(apiArr.resetFilter, {
device_id: e.currentTarget.dataset.item.device_id,
@ -429,6 +443,63 @@ Page({
})
},
jumps(e) {
console.log(e);
if (e.currentTarget.dataset.idx == '1') {
wx.getSetting({
withSubscriptions: true,
success: (res) => {
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
const itemSettings = res.subscriptionsSetting.itemSettings || {};
const tmplMap = {
'5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0': '工单完成通知',
'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4': '工单派工通知',
'5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0': '订单付款通知'
};
const unsubscribedTmplIds = [];
Object.keys(tmplMap).forEach(tmplId => {
if (itemSettings[tmplId] !== 'accept') {
unsubscribedTmplIds.push(tmplId);
}
});
if (unsubscribedTmplIds.length > 0) {
wx.requestSubscribeMessage({
tmplIds: unsubscribedTmplIds,
success: (res) => {
console.log('订阅成功', res);
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
fail: (err) => {
console.error('订阅失败', err);
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
}
});
} else {
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
}
}
},
fail: () => {
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
}
});
} else {
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
}
},
base64({ url, type }) {
return new Promise((resolve, reject) => {
wx.getFileSystemManager().readFile({
@ -551,10 +622,8 @@ Page({
let that = this
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
wx.hideLoading()
// res.expiration_duration = '2025-06-01 08:06:42'
res.remainDay = Math.max(0,that.getDaysBetweenDates2(res.expiration_duration)) //剩余天数
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 {
@ -578,7 +647,7 @@ Page({
}
res.today = Number(res.today).toFixed(2)
res.yesterday = Number(res.yesterday).toFixed(2)
console.log(res.difDay,'ressss');
that.setData({
currentDevice: res
})

View File

@ -109,7 +109,12 @@
<image wx:if="{{currentDevice.sevice_status != 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff">{{currentDevice.sevice_status == '1'?'开机':'关机'}}</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
@ -253,4 +258,15 @@
</view>
<clientFooter />
<!-- <clientFooter /> -->
<view class="foot-fixed">
<block wx:for="{{nav_list}}" wx:key="unique">
<!-- <view>{{item.photo}}</view> -->
<view id="navIndex" bind:tap="jumps" data-idx="{{index}}" data-url="{{item.url}}" style="width:{{foot_width}}" class="foot-item">
<view class="foot-icon" style="background: url({{item.photo}}) center center no-repeat; background-size: contain;"></view>
<text class="foot-label" id="navIndexLabel">{{item.nav_name}}</text>
</view>
</block>
</view>

View File

@ -2,6 +2,41 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "用户新装工单列表",
"pathName": "pages/newOrderList/newOrderList",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "安装的设备",
"pathName": "pages/newOrderListDesc/index",
"query": "id=351",
"launchMode": "default",
"scene": null
},
{
"name": "pages/water_filter/water_filter",
"pathName": "pages/water_filter/water_filter",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "packages/master/deviceInfo/index",
"pathName": "packages/master/deviceInfo/index",
"query": "id=446",
"launchMode": "default",
"scene": null
},
{
"name": "packages/user/transactionRecord/index",
"pathName": "packages/user/transactionRecord/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "pages/deposit/deposit",
"pathName": "pages/deposit/deposit",
@ -447,7 +482,7 @@
}
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "3.8.1",
"libVersion": "3.8.7",
"projectname": "ui",
"setting": {
"compileHotReLoad": true,

View File

@ -26,6 +26,32 @@ const getGuid = function () {
return uuid;
}
const goLogin = () => {
var pages = getCurrentPages() //获取加载的页面
var currentPage = pages[pages.length - 1] //获取当前页面的对象
var urlthis = currentPage.route //当前页面url
console.log('urlthisurlthis', urlthis);
let JumpUrl = '/pages/login/login';
if (urlthis.includes('packages/master')) {
JumpUrl = '/pages/MasterLogin/MasterLogin';
} else if (urlthis.includes('packages/partner')) {
JumpUrl = '/packages/partner/pages/login/login';
}
wx.showModal({
title: '提示',
content: '请登录后查看',
confirmText: "去登陆",
complete: (res) => {
if (res.cancel) {}
if (res.confirm) {
wx.reLaunch({
url: JumpUrl,
})
}
}
})
}
const formatTimeForChart = date => {
const year = date.getFullYear()
@ -252,23 +278,28 @@ const postUrl = function (url, data, successfn, token) {
console.log('successddd', f);
// TODO: 待验证是否可做判断依据
// 调用成功返回200 等其他情况则表示接口失败
if (f.statusCode == 401) {
wx.showModal({
title: '提示',
content: '请登录后查看',
confirmText: "去登陆",
complete: (res) => {
if (res.cancel) {
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
console.log('走到这?')
goLogin();
// wx.showModal({
// title: '提示',
// content: '请登录后查看',
// confirmText: "去登陆",
// complete: (res) => {
// if (res.cancel) {
}
// }
if (res.confirm) {
wx.navigateTo({
url: '/pages/login/login',
})
}
}
})
// if (res.confirm) {
// wx.reLaunch({
// url: JumpUrl,
// // url: '/pages/login/login',
// })
// }
// }
// })
return
}
if (f.data && f.statusCode === 200) {
@ -432,7 +463,9 @@ const postUrl3 = function (url, data, version, successfn, token) {
console.log('successddd', f);
// TODO: 待验证是否可做判断依据
// 调用成功返回200 等其他情况则表示接口失败
if (f.statusCode == 401) {
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
goLogin();
return;
wx.showModal({
title: '提示',
content: '请登录后查看',
@ -442,9 +475,12 @@ const postUrl3 = function (url, data, version, successfn, token) {
}
if (res.confirm) {
wx.navigateTo({
wx.reLaunch({
url: '/pages/login/login',
})
// wx.navigateTo({
// url: '/pages/MasterLogin/MasterLogin',
// })
}
}
})
@ -527,7 +563,9 @@ const postUrl4 = function (url, data, successfn, token) {
console.log('successddd', f);
// TODO: 待验证是否可做判断依据
// 调用成功返回200 等其他情况则表示接口失败
if (f.statusCode == 401) {
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
goLogin();
return;
wx.showModal({
title: '提示',
content: '请登录后查看',
@ -537,7 +575,7 @@ const postUrl4 = function (url, data, successfn, token) {
}
if (res.confirm) {
wx.navigateTo({
wx.reLaunch({
url: '/pages/login/login',
})
}