6.12管理端修改
This commit is contained in:
parent
d1645ab26d
commit
1078410227
@ -5,7 +5,6 @@ const getPartner = '/dealer/get-one' //经销商信息
|
|||||||
|
|
||||||
const getPackageList = '/new-install/packages' //套餐购买列表
|
const getPackageList = '/new-install/packages' //套餐购买列表
|
||||||
|
|
||||||
const getMasterList = '/master/list' //师傅列表
|
|
||||||
|
|
||||||
const createNewOrder = '/new-install/create' //创建新装工单
|
const createNewOrder = '/new-install/create' //创建新装工单
|
||||||
const phoneSearch = '/customer/phone-search' //搜索客户电话
|
const phoneSearch = '/customer/phone-search' //搜索客户电话
|
||||||
@ -21,10 +20,18 @@ const getUninstallInfo = '/uninstall/one' //拆除工单详情
|
|||||||
const getPartList = '/part_replace/list' //更换工单列表
|
const getPartList = '/part_replace/list' //更换工单列表
|
||||||
const getPartInfo = '/part_replace/one' //更换工单详情
|
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 assignPartReplaceMaster = '/part_replace/assign' //指派
|
||||||
const apiArr = {
|
const apiArr = {
|
||||||
|
createMaster,
|
||||||
|
getOrderPairList,
|
||||||
|
getOrderPairListInfo,
|
||||||
masterSelect,
|
masterSelect,
|
||||||
getproductList,
|
getproductList,
|
||||||
assignPartReplaceMaster,
|
assignPartReplaceMaster,
|
||||||
|
|||||||
@ -5,9 +5,11 @@ const queryPayByWechat = '/wechat/water/query_pay' //查询交易结果
|
|||||||
|
|
||||||
const HsqueryPay = '/lakala/hs-preorder' //预下单
|
const HsqueryPay = '/lakala/hs-preorder' //预下单
|
||||||
const HsqueryPayByWechat = '/lakala/hs-trade-query' //查询交易结果
|
const HsqueryPayByWechat = '/lakala/hs-trade-query' //查询交易结果
|
||||||
|
const payFail = '/wechat/water/pay-order-fail' //订单支付取消或失败
|
||||||
|
|
||||||
const PayJs = {
|
const PayJs = {
|
||||||
pay,
|
pay,
|
||||||
|
payFail,
|
||||||
queryPay,
|
queryPay,
|
||||||
HsqueryPay,
|
HsqueryPay,
|
||||||
HsqueryPayByWechat,
|
HsqueryPayByWechat,
|
||||||
|
|||||||
@ -7,389 +7,405 @@ import { areaList } from '../../data/index';
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
s: app.system.statusBarHeight, // 状态栏高度
|
s: app.system.statusBarHeight, // 状态栏高度
|
||||||
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
||||||
t: app.menu.top, // 胶囊局顶部距离
|
t: app.menu.top, // 胶囊局顶部距离
|
||||||
h: app.menu.height, // 胶囊高度
|
h: app.menu.height, // 胶囊高度
|
||||||
checked:true,
|
checked: true,
|
||||||
areaList,
|
areaList,
|
||||||
show:false, //弹出层
|
show: false, //弹出层
|
||||||
|
|
||||||
name:"",
|
name: "",
|
||||||
phone:"",
|
phone: "",
|
||||||
area:"",
|
area: "",
|
||||||
address:"",
|
address: "",
|
||||||
message:"",
|
message: "",
|
||||||
|
|
||||||
page_num:1,
|
page_num: 1,
|
||||||
page_size:10,
|
page_size: 10,
|
||||||
flag:false,
|
flag: false,
|
||||||
PartsList:[],
|
PartsList: [],
|
||||||
currentId:[],
|
currentId: [],
|
||||||
currentName:[],
|
currentName: [],
|
||||||
price:0,
|
price: 0,
|
||||||
|
|
||||||
orderMsg:"",//订单信息
|
orderMsg: "",//订单信息
|
||||||
GoodsMsg:"",//商户信息
|
GoodsMsg: "",//商户信息
|
||||||
},
|
},
|
||||||
|
|
||||||
ipt1(e){
|
ipt1(e) {
|
||||||
let that = this
|
let that = this
|
||||||
that.setData({
|
|
||||||
name:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ipt2(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
phone:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ipt3(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
address:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ipt4(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
message:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onChange(e){
|
|
||||||
console.log(e);
|
|
||||||
let that = this
|
|
||||||
let PartsList = that.data.PartsList
|
|
||||||
let currentId = that.data.currentId
|
|
||||||
let currentName = that.data.currentName
|
|
||||||
let price = that.data.price
|
|
||||||
currentId = []
|
|
||||||
currentName = []
|
|
||||||
PartsList[e.currentTarget.dataset.idx].checked = !PartsList[e.currentTarget.dataset.idx].checked
|
|
||||||
price = 0
|
|
||||||
PartsList.forEach(item=>{
|
|
||||||
if(item.checked){
|
|
||||||
// price += item.unit_price
|
|
||||||
price = util.floatCalculate(price,item.unit_price,'+=')
|
|
||||||
currentId.push(item.parts_id)
|
|
||||||
currentName.push(item.parts_name)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
that.setData({
|
|
||||||
PartsList,
|
|
||||||
currentId,
|
|
||||||
currentName,
|
|
||||||
price
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
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=>{
|
|
||||||
wx.hideLoading()
|
|
||||||
console.log(res,'resss');
|
|
||||||
let flag
|
|
||||||
if(res.rows){
|
|
||||||
res.rows.forEach(item=>{
|
|
||||||
item.checked = false
|
|
||||||
})
|
|
||||||
if( res.rows.length == that.data.page_size){
|
|
||||||
flag = true
|
|
||||||
}else{
|
|
||||||
flag = false
|
|
||||||
}
|
|
||||||
res.rows.forEach(item=>{
|
|
||||||
item.parts_icon = util.img_url + item.parts_icon
|
|
||||||
})
|
|
||||||
that.setData({
|
|
||||||
PartsList:that.data.PartsList.concat(res.rows || []),
|
|
||||||
flag,
|
|
||||||
page_size:that.data.page_size + 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
createDeriveOrder(){
|
|
||||||
let that = this
|
|
||||||
if(that.data.currentId.length == 0){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请选择商品',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!that.data.name){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写收货人',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!that.data.phone){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写收货人电话',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!util.isPhone(that.data.phone)){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写正确电话',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(!that.data.area){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请选择所在地区',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!that.data.address){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写详情地址',
|
|
||||||
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,
|
|
||||||
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=>{
|
|
||||||
that.setData({
|
|
||||||
orderMsg:res
|
|
||||||
})
|
|
||||||
that.getGoodsMsg()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
//获取商户id
|
|
||||||
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=>{
|
|
||||||
that.setData({
|
that.setData({
|
||||||
GoodsMsg:res
|
name: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ipt2(e) {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
phone: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ipt3(e) {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
address: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
ipt4(e) {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
message: e.detail.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(e) {
|
||||||
|
console.log(e);
|
||||||
|
let that = this
|
||||||
|
let PartsList = that.data.PartsList
|
||||||
|
let currentId = that.data.currentId
|
||||||
|
let currentName = that.data.currentName
|
||||||
|
let price = that.data.price
|
||||||
|
currentId = []
|
||||||
|
currentName = []
|
||||||
|
PartsList[e.currentTarget.dataset.idx].checked = !PartsList[e.currentTarget.dataset.idx].checked
|
||||||
|
price = 0
|
||||||
|
PartsList.forEach(item => {
|
||||||
|
if (item.checked) {
|
||||||
|
// price += item.unit_price
|
||||||
|
price = util.floatCalculate(price, item.unit_price, '+=')
|
||||||
|
currentId.push(item.parts_id)
|
||||||
|
currentName.push(item.parts_name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.setData({
|
||||||
|
PartsList,
|
||||||
|
currentId,
|
||||||
|
currentName,
|
||||||
|
price
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(res, 'resss');
|
||||||
|
let flag
|
||||||
|
if (res.rows) {
|
||||||
|
res.rows.forEach(item => {
|
||||||
|
item.checked = false
|
||||||
|
})
|
||||||
|
if (res.rows.length == that.data.page_size) {
|
||||||
|
flag = true
|
||||||
|
} else {
|
||||||
|
flag = false
|
||||||
|
}
|
||||||
|
res.rows.forEach(item => {
|
||||||
|
item.parts_icon = util.img_url + item.parts_icon
|
||||||
|
})
|
||||||
|
that.setData({
|
||||||
|
PartsList: that.data.PartsList.concat(res.rows || []),
|
||||||
|
flag,
|
||||||
|
page_size: that.data.page_size + 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
createDeriveOrder() {
|
||||||
|
let that = this
|
||||||
|
if (that.data.currentId.length == 0) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请选择商品',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!that.data.name) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写收货人',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!that.data.phone) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写收货人电话',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!util.isPhone(that.data.phone)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写正确电话',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!that.data.area) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请选择所在地区',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!that.data.address) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写详情地址',
|
||||||
|
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,
|
||||||
|
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 => {
|
||||||
|
that.setData({
|
||||||
|
orderMsg: res
|
||||||
|
})
|
||||||
|
that.getGoodsMsg()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取商户id
|
||||||
|
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 => {
|
||||||
|
that.setData({
|
||||||
|
GoodsMsg: res
|
||||||
|
})
|
||||||
|
|
||||||
|
that.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,
|
||||||
|
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 == '成功') {
|
||||||
|
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) {
|
||||||
|
that.queryPay()
|
||||||
|
},
|
||||||
|
fail(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, {
|
||||||
|
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 {
|
||||||
|
wx.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
account() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../payList/payList',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onClose(e) {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
show: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
changeShow() {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
show: true
|
||||||
})
|
})
|
||||||
|
|
||||||
that.pay()
|
},
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
pay(){
|
//选择地区
|
||||||
let that = this
|
AreaConfirm(e) {
|
||||||
|
let that = this
|
||||||
let parts_ids = that.data.currentId.join()
|
let area = ''
|
||||||
let subject = that.data.currentName.join()
|
if (e.detail.values[0].name == e.detail.values[1].name) {
|
||||||
|
area = e.detail.values[1].name + e.detail.values[2].name
|
||||||
util.postUrl2(PayJs.pay,{
|
} else {
|
||||||
address:that.data.area + that.data.address,
|
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
|
||||||
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 == '成功'){
|
|
||||||
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){
|
|
||||||
that.queryPay()
|
|
||||||
},
|
|
||||||
fail(fal){
|
|
||||||
console.log(fal);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
queryPay(){
|
that.setData({
|
||||||
let that = this
|
show: false,
|
||||||
util.postUrl2(PayJs.queryPay,{
|
area
|
||||||
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({
|
cancel(e) {
|
||||||
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
|
let that = this
|
||||||
// })
|
that.setData({
|
||||||
wx.showToast({
|
show: false
|
||||||
title: '支付成功!',
|
})
|
||||||
})
|
},
|
||||||
}else{
|
onShareAppMessage() {
|
||||||
wx.showToast({
|
return {
|
||||||
title: res.msg,
|
title: '人人爱净水', // 分享卡片标题(必填)
|
||||||
})
|
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
|
||||||
|
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4)
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
},
|
onShareTimeline() {
|
||||||
|
return {
|
||||||
|
title: '人人爱净水', // 自定义标题
|
||||||
account(){
|
query: '', // 自定义页面路径中的参数
|
||||||
wx.navigateTo({
|
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
|
||||||
url: '../payList/payList',
|
}
|
||||||
})
|
},
|
||||||
},
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
onClose(e){
|
*/
|
||||||
let that = this
|
onLoad(options) {
|
||||||
that.setData({
|
let that = this
|
||||||
show:false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
changeShow(){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
show:true
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
//选择地区
|
|
||||||
AreaConfirm(e){
|
|
||||||
let that = this
|
|
||||||
let area = ''
|
|
||||||
if(e.detail.values[0].name == e.detail.values[1].name){
|
|
||||||
area = e.detail.values[1].name + e.detail.values[2].name
|
|
||||||
}else{
|
|
||||||
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
|
|
||||||
}
|
|
||||||
|
|
||||||
that.setData({
|
|
||||||
show:false,
|
|
||||||
area
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
//取消
|
|
||||||
cancel(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
show:false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onShareAppMessage(){
|
|
||||||
return {
|
|
||||||
title: '人人爱净水', // 分享卡片标题(必填)
|
|
||||||
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
|
|
||||||
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onShareTimeline() {
|
|
||||||
return {
|
|
||||||
title: '人人爱净水', // 自定义标题
|
|
||||||
query: '', // 自定义页面路径中的参数
|
|
||||||
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面加载
|
|
||||||
*/
|
|
||||||
onLoad(options) {
|
|
||||||
let that= this
|
|
||||||
that.getPartsByid()
|
|
||||||
wx.showShareMenu({
|
|
||||||
withShareTicket: true,
|
|
||||||
menus: ['shareAppMessage', 'shareTimeline']
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
|
||||||
*/
|
|
||||||
onReady() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面显示
|
|
||||||
*/
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面隐藏
|
|
||||||
*/
|
|
||||||
onHide() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面卸载
|
|
||||||
*/
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
|
||||||
*/
|
|
||||||
onPullDownRefresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
let that = this
|
|
||||||
if(that.data.flag){
|
|
||||||
that.getPartsByid()
|
that.getPartsByid()
|
||||||
|
wx.showShareMenu({
|
||||||
|
withShareTicket: true,
|
||||||
|
menus: ['shareAppMessage', 'shareTimeline']
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
let that = this
|
||||||
|
if (that.data.flag) {
|
||||||
|
that.getPartsByid()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户点击右上角分享
|
|
||||||
*/
|
|
||||||
onShareAppMessage() {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
@ -214,7 +214,12 @@ Page({
|
|||||||
that.queryPay()
|
that.queryPay()
|
||||||
},
|
},
|
||||||
fail(fal) {
|
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() {
|
changeShow() {
|
||||||
let that = this
|
let that = this
|
||||||
that.setData({
|
that.setData({
|
||||||
|
|||||||
@ -58,6 +58,8 @@ Page({
|
|||||||
selectPackage: ""
|
selectPackage: ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
changeTab(e) {
|
changeTab(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
let that = this
|
let that = this
|
||||||
@ -172,7 +174,11 @@ Page({
|
|||||||
that.queryPay()
|
that.queryPay()
|
||||||
},
|
},
|
||||||
fail(fal) {
|
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() {
|
queryPay() {
|
||||||
let that = this
|
let that = this
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
let util = require("../../../../../utils/util")
|
let util = require("../../../../../utils/util")
|
||||||
const apiArr = require('../../../../../api/water_filter')
|
const apiArr = require('../../../../../api/water_filter')
|
||||||
|
const apiArr2 = require('../../../../../api/partner')
|
||||||
|
|
||||||
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
|
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
|
||||||
Page({
|
Page({
|
||||||
@ -10,8 +11,9 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
option1: [
|
option1: [
|
||||||
{ text: '全部', value: 0 },
|
{ text: '全部', value: 0 },
|
||||||
{ text: '正常', value: 1 },
|
{ text: '已安装', value: 1 },
|
||||||
{ text: '离线', value: 2 },
|
{ text: '空闲', value: 2 },
|
||||||
|
{ text: '已拆机', value: 3 },
|
||||||
],
|
],
|
||||||
option2: [
|
option2: [
|
||||||
{ text: '全部', value: 0 },
|
{ text: '全部', value: 0 },
|
||||||
@ -23,8 +25,11 @@ Page({
|
|||||||
{ text: '制水故障', value: 6 },
|
{ text: '制水故障', value: 6 },
|
||||||
{ text: '关机', value: 7 },
|
{ text: '关机', value: 7 },
|
||||||
{ text: '已欠费', value: 8 },
|
{ text: '已欠费', value: 8 },
|
||||||
{ text: '已还库', value: 9 },
|
{ text: '在库', value: 9 },
|
||||||
|
{ text: '激活失败', value: 10 },
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
stateType: {
|
stateType: {
|
||||||
1: '正常',
|
1: '正常',
|
||||||
2: '报废',
|
2: '报废',
|
||||||
@ -34,7 +39,7 @@ Page({
|
|||||||
6: '制水故障',
|
6: '制水故障',
|
||||||
7: '关机',
|
7: '关机',
|
||||||
8: '已欠费',
|
8: '已欠费',
|
||||||
9: '已还库',
|
9: '在库',
|
||||||
},
|
},
|
||||||
value1: 0,
|
value1: 0,
|
||||||
value2: 'a',
|
value2: 'a',
|
||||||
@ -64,7 +69,12 @@ Page({
|
|||||||
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
|
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
addWorkOrders() {
|
||||||
|
console.log(123123);
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
|
||||||
|
})
|
||||||
|
},
|
||||||
// 网络状态选择
|
// 网络状态选择
|
||||||
headerNetWorkClick(e) {
|
headerNetWorkClick(e) {
|
||||||
console.log('e', e);
|
console.log('e', e);
|
||||||
@ -113,7 +123,7 @@ Page({
|
|||||||
if (networkStatus) {
|
if (networkStatus) {
|
||||||
param = {
|
param = {
|
||||||
...param,
|
...param,
|
||||||
network_status: networkStatus
|
install_status: networkStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status) {
|
if (status) {
|
||||||
@ -123,20 +133,23 @@ Page({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
util.postUrl(apiArr.deviceList, param, res => {
|
util.postUrl(apiArr2.deviceList, param, res => {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
let flag = false
|
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
|
flag = true
|
||||||
} else {
|
} else {
|
||||||
|
console.log(456);
|
||||||
flag = false
|
flag = false
|
||||||
}
|
}
|
||||||
that.setData({
|
that.setData({
|
||||||
deviceList: that.data.deviceList.concat(res.rows || []),
|
deviceList: that.data.deviceList.concat(res.list || []),
|
||||||
total: res.total,
|
total: res.total,
|
||||||
flag,
|
flag,
|
||||||
page_num: that.data.page_num + 1
|
page_num: that.data.page_num + 1
|
||||||
})
|
})
|
||||||
|
console.log(that.data.flag);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="deviceText">设备总数:{{total}}</view>
|
<view class="deviceText">设备总数:{{total}}</view>
|
||||||
<view class="deviceIpt">
|
<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" />
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="dropBox">
|
<view class="dropBox">
|
||||||
<van-dropdown-menu>
|
<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-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>
|
</van-dropdown-menu>
|
||||||
</view>
|
</view>
|
||||||
@ -20,10 +20,6 @@
|
|||||||
<view class="deviceItem_box">
|
<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" 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="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">
|
||||||
<view class="deviceItemCon_tit">客户姓名</view>
|
<view class="deviceItemCon_tit">客户姓名</view>
|
||||||
<view class="deviceItemCon_con">{{item.customer_name}}</view>
|
<view class="deviceItemCon_con">{{item.customer_name}}</view>
|
||||||
@ -40,9 +36,16 @@
|
|||||||
<view class="deviceItemCon_tit">设备状态</view>
|
<view class="deviceItemCon_tit">设备状态</view>
|
||||||
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
|
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
|
||||||
</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">
|
||||||
<view class="deviceItemCon_tit">设备地址</view>
|
<view class="deviceItemCon_tit">设备地址</view>
|
||||||
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
|
<view class="deviceItemCon_con">{{item.address}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -54,6 +57,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="addBtn" bind:tap="addWorkOrders">新增</view>
|
||||||
|
|
||||||
<cover-view style="position: fixed;">
|
<cover-view style="position: fixed;">
|
||||||
<import src="/pages/public/footer.wxml" />
|
<import src="/pages/public/footer.wxml" />
|
||||||
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
|
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
|
||||||
|
|||||||
@ -94,4 +94,37 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #222222;
|
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;
|
||||||
}
|
}
|
||||||
@ -211,12 +211,28 @@ Page({
|
|||||||
that.queryPay()
|
that.queryPay()
|
||||||
},
|
},
|
||||||
fail(fal) {
|
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() {
|
queryPay() {
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl2(PayJs.queryPay, {
|
util.postUrl2(PayJs.queryPay, {
|
||||||
|
|||||||
@ -77,8 +77,8 @@
|
|||||||
</van-circle>
|
</van-circle>
|
||||||
|
|
||||||
<view class="cir_msg">
|
<view class="cir_msg">
|
||||||
<view class="percentage" wx:if="{{billing_method != 2}}">{{currentFilter.percentageDay}}%</view>
|
<view class="percentage" wx:if="{{billing_method != '2'}}">{{currentFilter.percentageDay}}%</view>
|
||||||
<view class="percentage" wx:if="{{billing_method == 1}}">{{currentFilter.percentageCapacity}}%</view>
|
<view class="percentage" wx:if="{{billing_method == '2'}}">{{currentFilter.percentageCapacity}}%</view>
|
||||||
<view class="cir_msg_text">滤芯寿命</view>
|
<view class="cir_msg_text">滤芯寿命</view>
|
||||||
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
|
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -3,367 +3,471 @@ const { postUrl } = require("~/utils/util");
|
|||||||
const util = require("~/utils/util");
|
const util = require("~/utils/util");
|
||||||
|
|
||||||
// pages/water_filter/repair/repair.js
|
// pages/water_filter/repair/repair.js
|
||||||
const app = getApp()
|
const app = getApp()
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
s: app.system.statusBarHeight, // 状态栏高度
|
s: app.system.statusBarHeight, // 状态栏高度
|
||||||
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
||||||
t: app.menu.top, // 胶囊局顶部距离
|
t: app.menu.top, // 胶囊局顶部距离
|
||||||
h: app.menu.height, // 胶囊高度
|
h: app.menu.height, // 胶囊高度
|
||||||
value: '',
|
value: '',
|
||||||
|
|
||||||
name:"",
|
name: "",
|
||||||
phone:"",
|
phone: "",
|
||||||
message:"",
|
message: "",
|
||||||
fileList:[],
|
fileList: [],
|
||||||
fileList2:[],
|
fileList2: [],
|
||||||
time:"",
|
time: "",
|
||||||
|
|
||||||
equipmentShow: false,
|
equipmentShow: false,
|
||||||
equipmentList: [],
|
equipmentList: [],
|
||||||
selectEquipment: {}, // 所选设备信息
|
selectEquipment: {}, // 所选设备信息
|
||||||
DoorTimeShow:false,
|
DoorTimeShow: false,
|
||||||
sucess:false,//是否报修成功
|
sucess: false,//是否报修成功
|
||||||
minDate: new Date().getTime(),
|
minDate: new Date().getTime(),
|
||||||
formatter(type, value) {
|
formatter(type, value) {
|
||||||
if (type === 'year') {
|
if (type === 'year') {
|
||||||
return `${value}年`;
|
return `${value}年`;
|
||||||
}
|
}
|
||||||
if (type === 'month') {
|
if (type === 'month') {
|
||||||
return `${value}月`;
|
return `${value}月`;
|
||||||
}
|
}
|
||||||
if (type === 'day') {
|
if (type === 'day') {
|
||||||
return `${value}日`;
|
return `${value}日`;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
deleteImg(e) {
|
||||||
deleteImg(e){
|
console.log(e);
|
||||||
console.log(e);
|
let that = this
|
||||||
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)
|
|
||||||
that.setData({
|
|
||||||
fileList,
|
|
||||||
fileList2
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
ipt1(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
name:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ipt2(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
phone:e.detail.value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ipt3(e){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
message:e.detail
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
switchShow(){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
DoorTimeShow:!that.data.DoorTimeShow
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 取消所选设备信息
|
|
||||||
headerCancelClick(){
|
|
||||||
this.setData({
|
|
||||||
selectEquipment: {}, // 所选设备信息
|
|
||||||
equipmentShow: false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 关闭弹窗
|
|
||||||
onClose(){
|
|
||||||
let that = this
|
|
||||||
that.setData({
|
|
||||||
DoorTimeShow:false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
headerEquipmentPopupClick() {
|
|
||||||
this.setData({
|
|
||||||
equipmentShow: true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onClosePopup() {
|
|
||||||
this.setData({
|
|
||||||
equipmentShow: false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onInput(event){
|
|
||||||
let that =this
|
|
||||||
const date = new Date(event.detail);
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零
|
|
||||||
const day = String(date.getDate()).padStart(2, '0'); // 日期补零
|
|
||||||
const hours = String(date.getHours()).padStart(2, '0'); // 小时补零
|
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0'); // 分钟补零
|
|
||||||
|
|
||||||
const time = `${year}-${month}-${day} ${hours}:${minutes}`;
|
|
||||||
console.log(time);
|
|
||||||
that.setData({
|
|
||||||
time,
|
|
||||||
DoorTimeShow:false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
afterRead(e){
|
|
||||||
const { file } = e.detail;
|
|
||||||
// 验证文件类型
|
|
||||||
if (file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image') {
|
|
||||||
wx.showToast({ title: '只能上传 JPG/PNG 格式的图片', icon: 'none' });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 验证文件大小
|
|
||||||
if (file.size > 5 * 1024 * 1024) {
|
|
||||||
wx.showToast({ title: '图片大小不能超过 5MB', icon: 'none' });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
beforeRead(e){
|
|
||||||
console.log(e);
|
|
||||||
let that = this
|
|
||||||
wx.showLoading({
|
|
||||||
title: '上传中',
|
|
||||||
mask:true,
|
|
||||||
})
|
|
||||||
util.uploadFileUrl(e.detail.file.url,(res)=>{
|
|
||||||
wx.hideLoading()
|
|
||||||
let datas = JSON.parse(res)
|
|
||||||
console.log(datas.data);
|
|
||||||
let url = util.img_url + datas.data.path
|
|
||||||
let fileList = that.data.fileList
|
let fileList = that.data.fileList
|
||||||
let fileList2 = that.data.fileList2
|
let fileList2 = that.data.fileList2
|
||||||
let obj = {
|
fileList.splice(e.detail.index, 1)
|
||||||
url:url,
|
fileList2.splice(e.detail.index, 1)
|
||||||
name:'avatar'
|
|
||||||
}
|
|
||||||
let obj2 = {
|
|
||||||
url:datas.data.path,
|
|
||||||
name:'avatar'
|
|
||||||
}
|
|
||||||
fileList.push(obj)
|
|
||||||
fileList2.push(obj2)
|
|
||||||
that.setData({
|
that.setData({
|
||||||
fileList,
|
fileList,
|
||||||
fileList2
|
fileList2
|
||||||
})
|
})
|
||||||
})
|
},
|
||||||
},
|
|
||||||
|
|
||||||
submit(){
|
ipt1(e) {
|
||||||
const {selectEquipment, name, phone, time, message, fileList2} = this.data;
|
let that = this
|
||||||
|
that.setData({
|
||||||
if (!selectEquipment.device_id) {
|
name: e.detail.value
|
||||||
wx.showToast({
|
|
||||||
title: '请选择报修设备',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!name){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写联系人姓名',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!phone){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写联系人电话',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!util.isPhone(phone)){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写正确电话',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!time){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请选择上门时间',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if(!message){
|
|
||||||
wx.showToast({
|
|
||||||
title: '请填写报修内容',
|
|
||||||
icon:"none"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
wx.showLoading({
|
|
||||||
title: '提交中...',
|
|
||||||
mask: true,
|
|
||||||
})
|
|
||||||
let that = this
|
|
||||||
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;
|
},
|
||||||
}
|
ipt2(e) {
|
||||||
this.setData({
|
let that = this
|
||||||
sucess: true
|
that.setData({
|
||||||
})
|
phone: e.detail.value
|
||||||
|
})
|
||||||
})
|
},
|
||||||
},
|
ipt3(e) {
|
||||||
|
let that = this
|
||||||
|
that.setData({
|
||||||
|
message: e.detail
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
switchShow() {
|
||||||
* 生命周期函数--监听页面加载
|
let that = this
|
||||||
*/
|
that.setData({
|
||||||
onLoad(options) {
|
DoorTimeShow: !that.data.DoorTimeShow
|
||||||
this.init();
|
})
|
||||||
wx.showShareMenu({
|
},
|
||||||
withShareTicket: true,
|
|
||||||
menus: ['shareAppMessage', 'shareTimeline']
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
init() {
|
// 取消所选设备信息
|
||||||
wx.showLoading({
|
headerCancelClick() {
|
||||||
title: '加载中...',
|
this.setData({
|
||||||
mask:true
|
selectEquipment: {}, // 所选设备信息
|
||||||
})
|
equipmentShow: false
|
||||||
postUrl(apiArr.BXDeviceList, {
|
})
|
||||||
page_num: 1,
|
},
|
||||||
page_size: 50, //TODO: 临时写一次获取50个,后续优化
|
|
||||||
user_id:Number(wx.getStorageSync('userId'))
|
// 关闭弹窗
|
||||||
}, res => {
|
onClose() {
|
||||||
wx.hideLoading()
|
let that = this
|
||||||
if(res.msg == '操作成功'){
|
that.setData({
|
||||||
if(res.rows){
|
DoorTimeShow: false
|
||||||
res.rows.forEach(item=>{
|
})
|
||||||
item.product_icon = util.img_url + item.product_icon
|
},
|
||||||
})
|
headerEquipmentPopupClick() {
|
||||||
this.setData({
|
this.setData({
|
||||||
equipmentList: res.rows || []
|
equipmentShow: true
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
|
||||||
})
|
onClosePopup() {
|
||||||
},
|
this.setData({
|
||||||
|
equipmentShow: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onInput(event) {
|
||||||
|
let that = this
|
||||||
|
const date = new Date(event.detail);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份补零
|
||||||
|
const day = String(date.getDate()).padStart(2, '0'); // 日期补零
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0'); // 小时补零
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0'); // 分钟补零
|
||||||
|
|
||||||
|
const time = `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||||
|
console.log(time);
|
||||||
|
that.setData({
|
||||||
|
time,
|
||||||
|
DoorTimeShow: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
afterRead(e) {
|
||||||
|
const { file } = e.detail;
|
||||||
|
// 验证文件类型
|
||||||
|
if (file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image') {
|
||||||
|
wx.showToast({ title: '只能上传 JPG/PNG 格式的图片', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 验证文件大小
|
||||||
|
if (file.size > 5 * 1024 * 1024) {
|
||||||
|
wx.showToast({ title: '图片大小不能超过 5MB', icon: 'none' });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
beforeRead(e) {
|
||||||
|
console.log(e);
|
||||||
|
let that = this
|
||||||
|
wx.showLoading({
|
||||||
|
title: '上传中',
|
||||||
|
mask: true,
|
||||||
|
})
|
||||||
|
util.uploadFileUrl(e.detail.file.url, (res) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
let datas = JSON.parse(res)
|
||||||
|
console.log(datas.data);
|
||||||
|
let url = util.img_url + datas.data.path
|
||||||
|
let fileList = that.data.fileList
|
||||||
|
let fileList2 = that.data.fileList2
|
||||||
|
let obj = {
|
||||||
|
url: url,
|
||||||
|
name: 'avatar'
|
||||||
|
}
|
||||||
|
let obj2 = {
|
||||||
|
url: datas.data.path,
|
||||||
|
name: 'avatar'
|
||||||
|
}
|
||||||
|
fileList.push(obj)
|
||||||
|
fileList2.push(obj2)
|
||||||
|
that.setData({
|
||||||
|
fileList,
|
||||||
|
fileList2
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
const { selectEquipment, name, phone, time, message, fileList2 } = this.data;
|
||||||
|
let that = this
|
||||||
|
|
||||||
|
if (!selectEquipment.device_id) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请选择报修设备',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!name) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写联系人姓名',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!phone) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写联系人电话',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!util.isPhone(phone)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写正确电话',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!time) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请选择上门时间',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!message) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请填写报修内容',
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.showLoading({
|
||||||
|
title: '提交中...',
|
||||||
|
mask: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
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 => {
|
||||||
|
wx.hideLoading();
|
||||||
|
if (res.error) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '提交失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
headerSelectClick(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,
|
|
||||||
equipmentShow: false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
headerLookClick() {
|
},
|
||||||
const pageUrl = getCurrentPages();
|
|
||||||
// 获取当前页面的上一页 如果不是首页
|
|
||||||
if (pageUrl[pageUrl.length - 2].route !== 'pages/index/newIndex/newIndex') {
|
|
||||||
// 关闭当前页 返回上一页
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
wx.redirectTo({
|
|
||||||
url: '/packages/WaterPurifier/pages/Maintenance/Maintenance',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onReady() {
|
onLoad(options) {
|
||||||
|
this.init();
|
||||||
},
|
wx.showShareMenu({
|
||||||
|
withShareTicket: true,
|
||||||
/**
|
menus: ['shareAppMessage', 'shareTimeline']
|
||||||
* 生命周期函数--监听页面显示
|
})
|
||||||
*/
|
},
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
init() {
|
||||||
* 生命周期函数--监听页面隐藏
|
wx.showLoading({
|
||||||
*/
|
title: '加载中...',
|
||||||
onHide() {
|
mask: true
|
||||||
|
})
|
||||||
|
postUrl(apiArr.BXDeviceList, {
|
||||||
|
page_num: 1,
|
||||||
|
page_size: 50, //TODO: 临时写一次获取50个,后续优化
|
||||||
|
user_id: Number(wx.getStorageSync('userId'))
|
||||||
|
}, res => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (res.msg == '操作成功') {
|
||||||
|
if (res.rows) {
|
||||||
|
res.rows.forEach(item => {
|
||||||
|
item.product_icon = util.img_url + item.product_icon
|
||||||
|
})
|
||||||
|
this.setData({
|
||||||
|
equipmentList: res.rows || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
headerSelectClick(e) {
|
||||||
* 生命周期函数--监听页面卸载
|
console.log('e', e);
|
||||||
*/
|
this.setData({
|
||||||
onUnload() {
|
selectEquipment: e.currentTarget.dataset.item,
|
||||||
|
name: e.currentTarget.dataset.item.customer_name,
|
||||||
|
phone: e.currentTarget.dataset.item.customer_phone,
|
||||||
|
equipmentShow: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
},
|
headerLookClick() {
|
||||||
|
const pageUrl = getCurrentPages();
|
||||||
|
// 获取当前页面的上一页 如果不是首页
|
||||||
|
if (pageUrl[pageUrl.length - 2].route !== 'pages/index/newIndex/newIndex') {
|
||||||
|
// 关闭当前页 返回上一页
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.redirectTo({
|
||||||
|
url: '/packages/WaterPurifier/pages/Maintenance/Maintenance',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh() {
|
onReady() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面上拉触底事件的处理函数
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onReachBottom() {
|
onShow() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
onShareAppMessage(){
|
onHide() {
|
||||||
return {
|
|
||||||
title: '人人爱净水', // 分享卡片标题(必填)
|
},
|
||||||
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
|
|
||||||
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4)
|
/**
|
||||||
}
|
* 生命周期函数--监听页面卸载
|
||||||
},
|
*/
|
||||||
onShareTimeline() {
|
onUnload() {
|
||||||
return {
|
|
||||||
title: '人人爱净水', // 自定义标题
|
},
|
||||||
query: '', // 自定义页面路径中的参数
|
|
||||||
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
|
/**
|
||||||
}
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
},
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
return {
|
||||||
|
title: '人人爱净水', // 分享卡片标题(必填)
|
||||||
|
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
|
||||||
|
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShareTimeline() {
|
||||||
|
return {
|
||||||
|
title: '人人爱净水', // 自定义标题
|
||||||
|
query: '', // 自定义页面路径中的参数
|
||||||
|
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
@ -1,5 +1,6 @@
|
|||||||
let util = require('../../../../utils/util')
|
let util = require('../../../../utils/util')
|
||||||
let apiArr = require('../../../../api/water_filter')
|
let apiArr = require('../../../../api/water_filter')
|
||||||
|
let apiArr2 = require('../../../../api/partner')
|
||||||
// packages/WaterPurifier/pages/upKeep/upKeep.js
|
// packages/WaterPurifier/pages/upKeep/upKeep.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ Page({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
util.postUrl4(apiArr.OrderList,param,res=>{
|
util.postUrl4(apiArr2.getOrderPairList,param,res=>{
|
||||||
console.log('rererererererere', res);
|
console.log('rererererererere', res);
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
let flag = false
|
let flag = false
|
||||||
|
|||||||
@ -34,9 +34,15 @@
|
|||||||
<view class="device-field">
|
<view class="device-field">
|
||||||
<label class="field-label">设备状态:</label>
|
<label class="field-label">设备状态:</label>
|
||||||
<text class="field-value" wx:if="{{item.status == 1}}">在用</text>
|
<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 == 2}}">待启用</text>
|
||||||
<text class="field-value" wx:if="{{item.status == 3}}">已报废</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 == 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>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,25 +55,40 @@ Page({
|
|||||||
show:false
|
show:false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
formatPercentage(value) {
|
||||||
|
return Math.max(0, Number((value || 0).toFixed(0)));
|
||||||
|
},
|
||||||
getInfo() {
|
getInfo() {
|
||||||
let that = this
|
let that = this
|
||||||
console.log(that, 'ssss');
|
console.log(that, 'ssss');
|
||||||
util.postUrl(apiArr.masterDeviceInfo, {
|
util.postUrl(apiArr.masterDeviceInfo, {
|
||||||
device_id: that.data.id
|
device_id: that.data.id
|
||||||
}, res => {
|
}, res => {
|
||||||
res.product_icon = util.img_url + res.product_icon
|
res.remainDay = Math.max(0, that.getDaysBetweenDates2(res.expiration_duration)) //剩余天数
|
||||||
res.difDay = that.getDaysBetweenDates(res.install_time) //服务天数
|
if (res.expiration_duration) {
|
||||||
res.remainDay = that.getDaysBetweenDates2(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) {
|
if (res.parts) {
|
||||||
res.parts.forEach(item => {
|
res.parts.forEach(item => {
|
||||||
item.difDay = that.getDaysBetweenDates(item.start_time)
|
item.difDay = that.getDaysBetweenDates(item.start_time)
|
||||||
item.percentageDay = Math.round(
|
const remainingDays = Math.max(0, (item.available_days || 0) - (item.difDay || 0));
|
||||||
((item.available_days - item.difDay) / item.available_days) * 100
|
|
||||||
|
item.percentageDay = that.formatPercentage(
|
||||||
|
(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({
|
that.setData({
|
||||||
currentDevice: res
|
currentDevice: res
|
||||||
})
|
})
|
||||||
|
|||||||
@ -61,11 +61,15 @@
|
|||||||
|
|
||||||
<view class="device-state">
|
<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/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" />
|
||||||
<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>
|
||||||
</block>
|
<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/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" />
|
<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,15 +81,33 @@
|
|||||||
<view class="device-id text-size">
|
<view class="device-id text-size">
|
||||||
编号:{{currentDevice.device_code}}
|
编号:{{currentDevice.device_code}}
|
||||||
</view>
|
</view>
|
||||||
<view class="service-day text-size text-color">
|
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
|
||||||
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
|
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="service-day text-size text-color">
|
<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>
|
||||||
<span class="day-num2">{{ currentDevice.remainDay}}</span>
|
</view>
|
||||||
<!-- <span class="day-num2">{{currentDevice.RemainDay}}</span> -->
|
|
||||||
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ let apiArr = require('../../../api/water_filter')
|
|||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
newOrderTotal: 200,
|
||||||
s: app.system.statusBarHeight, // 状态栏高度
|
s: app.system.statusBarHeight, // 状态栏高度
|
||||||
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
|
||||||
t: app.menu.top, // 胶囊局顶部距离
|
t: app.menu.top, // 胶囊局顶部距离
|
||||||
@ -148,6 +149,7 @@ Page({
|
|||||||
that.setData({
|
that.setData({
|
||||||
NewOrderList: that.data.NewOrderList.concat(res.rows || []),
|
NewOrderList: that.data.NewOrderList.concat(res.rows || []),
|
||||||
page_num: that.data.page_num + 1,
|
page_num: that.data.page_num + 1,
|
||||||
|
newOrderTotal: res.total,
|
||||||
flag
|
flag
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -43,10 +43,10 @@
|
|||||||
<view class="order-field">
|
<view class="order-field">
|
||||||
<text class="label">订单状态:</text>
|
<text class="label">订单状态:</text>
|
||||||
<text class="value " wx:if="{{item.status == '1'}}">待分配</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 == '2'}}">安装中</text>
|
||||||
<text class="value " wx:if="{{item.status == '3'}}">已安装</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 == '4'}}">已安装</text>
|
||||||
<text class="value " wx:if="{{item.status == '5'}}">待激活</text>
|
<text class="value " wx:if="{{item.status == '5'}}">忽略</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -91,10 +91,10 @@
|
|||||||
|
|
||||||
<view class="order-field">
|
<view class="order-field">
|
||||||
<text class="label">工单状态:</text>
|
<text class="label">工单状态:</text>
|
||||||
<text class="value " wx:if="{{item.status == '1'}}">待维修</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 == '2'}}">待维修</text>
|
||||||
<text class="value " wx:if="{{item.status == '3'}}">已完成</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 == '4'}}">已取消</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -198,7 +198,8 @@
|
|||||||
|
|
||||||
<view class="order-field">
|
<view class="order-field">
|
||||||
<text class="label">状态:</text>
|
<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 == 3}}">待操作 </text>
|
||||||
<text class="value" wx:if="{{item.status == 4}}">巳完成</text>
|
<text class="value" wx:if="{{item.status == 4}}">巳完成</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -126,9 +126,6 @@ Page({
|
|||||||
imgList = ''
|
imgList = ''
|
||||||
newArr = []
|
newArr = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
that.setData({
|
that.setData({
|
||||||
newOrderDesc: res,
|
newOrderDesc: res,
|
||||||
imgList: newArr,
|
imgList: newArr,
|
||||||
@ -136,8 +133,7 @@ Page({
|
|||||||
newOrderDateAppointment:res.remaining_days
|
newOrderDateAppointment:res.remaining_days
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (res.status == 5 ) {
|
||||||
if (res.status == 3 ) {
|
|
||||||
that.getDeriveInfo()
|
that.getDeriveInfo()
|
||||||
let imgList2 = ''
|
let imgList2 = ''
|
||||||
let imgList = []
|
let imgList = []
|
||||||
@ -232,7 +228,7 @@ Page({
|
|||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
util.postUrl(apiArr.completeNewOrder, {
|
util.postUrl(apiArr.completeNewOrder, {
|
||||||
install_id: Number(that.data.id),
|
install_id: Number(that.data.id),
|
||||||
status: 5,
|
status: 3,
|
||||||
install_desc: that.data.msg,
|
install_desc: that.data.msg,
|
||||||
install_imgs: that.data.imgList2.join(','),
|
install_imgs: that.data.imgList2.join(','),
|
||||||
install_time: util.getCurrentTime(),
|
install_time: util.getCurrentTime(),
|
||||||
|
|||||||
@ -37,8 +37,10 @@
|
|||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">订单状态:</text>
|
<text class="label">订单状态:</text>
|
||||||
<text class="value " wx:if="{{newOrderDesc.status == '1'}}">待分配</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 == '2'}}">安装中</text>
|
||||||
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">已安装</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>
|
||||||
<view class="info-item" wx:if="{{newOrderDesc.product_icon}}">
|
<view class="info-item" wx:if="{{newOrderDesc.product_icon}}">
|
||||||
<text class="label">产品图片:</text>
|
<text class="label">产品图片:</text>
|
||||||
@ -65,7 +67,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item item2">
|
<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="value value2" wx:if="{{!deviceCode}}">
|
||||||
<view class="btn" bind:tap="scanQrcode" wx:if="{{newOrderDesc.status == '2'}}">去扫码</view>
|
<view class="btn" bind:tap="scanQrcode" wx:if="{{newOrderDesc.status == '2'}}">去扫码</view>
|
||||||
</view>
|
</view>
|
||||||
@ -76,7 +78,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item" wx:if="{{newOrderDesc.status == 5}}">
|
<view class="info-item" wx:if="{{newOrderDesc.status == 3}}">
|
||||||
<text class="label">剩余天数:</text>
|
<text class="label">剩余天数:</text>
|
||||||
<input class="value" type="number" bindinput="changeNewAppointment" placeholder="请输入剩余天数" value="{{newOrderDateAppointment}}" />
|
<input class="value" type="number" bindinput="changeNewAppointment" placeholder="请输入剩余天数" value="{{newOrderDateAppointment}}" />
|
||||||
</view>
|
</view>
|
||||||
@ -136,16 +138,17 @@
|
|||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">订单状态:</text>
|
<text class="label">订单状态:</text>
|
||||||
<text class="value " wx:if="{{repairOrderDesc.status == '1'}}">待分配</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 == '2'}}">待维修</text>
|
||||||
<text class="value " wx:if="{{repairOrderDesc.status == '3'}}">已维修</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 == '4'}}">已取消</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">工单来源:</text>
|
<text class="label">工单来源:</text>
|
||||||
<text class="value" wx:if="{{repairOrderDesc.order_source == 1}}">微信</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 == 2}}">微信</text>
|
||||||
|
<text class="value" wx:if="{{repairOrderDesc.order_source == 3}}">后台</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
@ -192,7 +195,10 @@
|
|||||||
<view class="section-title">工单信息</view>
|
<view class="section-title">工单信息</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">配件名称:</text>
|
<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>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
@ -217,8 +223,9 @@
|
|||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">工单来源:</text>
|
<text class="label">工单来源:</text>
|
||||||
<text class="value " wx:if="{{partOrderDesc.order_source == '1'}}">微信</text>
|
<text class="value" wx:if="{{repairOrderDesc.order_source == 1}}">系统</text>
|
||||||
<text class="value " wx:if="{{partOrderDesc.order_source == '2'}}">线下</text>
|
<text class="value" wx:if="{{repairOrderDesc.order_source == 2}}">微信</text>
|
||||||
|
<text class="value" wx:if="{{repairOrderDesc.order_source == 3}}">后台</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@ -324,6 +331,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="section" wx:if="{{type == 3}}">
|
<view class="section" wx:if="{{type == 3}}">
|
||||||
<view class="section-title">拆除说明</view>
|
<view class="section-title">拆除说明</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
@ -360,7 +368,7 @@
|
|||||||
<view class="complete-btn-container" wx:if="{{type == 0 && !dis1 }}">
|
<view class="complete-btn-container" wx:if="{{type == 0 && !dis1 }}">
|
||||||
<button class="complete-btn cancel-btn" bindtap="cancelNewOrder">撤销</button>
|
<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="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>
|
||||||
|
|
||||||
<view class="complete-btn-container" wx:if="{{type == 1 && !dis2 }}">
|
<view class="complete-btn-container" wx:if="{{type == 1 && !dis2 }}">
|
||||||
|
|||||||
@ -12,15 +12,17 @@ Page({
|
|||||||
statusType: {
|
statusType: {
|
||||||
1: '待分配',
|
1: '待分配',
|
||||||
2: '安装中',
|
2: '安装中',
|
||||||
3: '已安装',
|
3: '待激活',
|
||||||
4: '已撤销',
|
4: '已安装',
|
||||||
|
5: '忽略',
|
||||||
},
|
},
|
||||||
option1: [
|
option1: [
|
||||||
{ text: '全部', value: 0 },
|
{ text: '全部', value: 0 },
|
||||||
{ text: '待分配', value: 1 },
|
{ text: '待分配', value: 1 },
|
||||||
{ text: '安装中', value: 2 },
|
{ text: '安装中', value: 2 },
|
||||||
{ text: '已安装', value: 3 },
|
{ text: '待激活', value: 3 },
|
||||||
{ text: '已撤销', value: 4 },
|
{ text: '已安装', value: 4 },
|
||||||
|
{ text: '忽略', value: 5 },
|
||||||
],
|
],
|
||||||
option2: [
|
option2: [
|
||||||
{ text: '渠道', value: 'a' },
|
{ text: '渠道', value: 'a' },
|
||||||
@ -234,9 +236,11 @@ Page({
|
|||||||
that.setData({
|
that.setData({
|
||||||
page_num:1,
|
page_num:1,
|
||||||
flag:false,
|
flag:false,
|
||||||
deviceList:[]
|
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
that.setData({
|
||||||
|
deviceList:[]
|
||||||
|
})
|
||||||
that.getNewOrderList()
|
that.getNewOrderList()
|
||||||
},1500)
|
},1500)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -10,14 +10,12 @@
|
|||||||
<view class="orderList" wx:if="{{deviceList.length != 0}}">
|
<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" 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_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_tit">设备号</view>
|
||||||
<view class="orderItem_Item_con">{{item.device_id}}</view>
|
<view class="orderItem_Item_con">{{item.device_id}}</view>
|
||||||
</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">
|
||||||
<view class="orderItem_Item_tit">客户名称</view>
|
<view class="orderItem_Item_tit">客户名称</view>
|
||||||
<view class="orderItem_Item_con">{{item.customer_name}}</view>
|
<view class="orderItem_Item_con">{{item.customer_name}}</view>
|
||||||
@ -42,10 +40,11 @@
|
|||||||
<view class="state state3" catch:tap="headerOkClick" wx:if="{{item.status === 3}}">完成</view>
|
<view class="state state3" catch:tap="headerOkClick" wx:if="{{item.status === 3}}">完成</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="addBtn" bind:tap="addWorkOrder">新增</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="addBtn" bind:tap="addWorkOrder">新增</view>
|
||||||
|
|
||||||
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
|
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { areaList } from '../../data/index';
|
|||||||
|
|
||||||
let util = require('../../../../utils/util')
|
let util = require('../../../../utils/util')
|
||||||
let apiArr = require('../../../../api/water_filter')
|
let apiArr = require('../../../../api/water_filter')
|
||||||
|
let apiArr2 = require('../../../../api/partner')
|
||||||
|
|
||||||
// packages/partner/pages/creatMaster/creatMaster.js
|
// packages/partner/pages/creatMaster/creatMaster.js
|
||||||
Page({
|
Page({
|
||||||
@ -65,6 +66,8 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getPhoncreateMastereByUser(){
|
getPhoncreateMastereByUser(){
|
||||||
|
|
||||||
|
|
||||||
let that = this
|
let that = this
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '创建中...',
|
title: '创建中...',
|
||||||
@ -128,10 +131,10 @@ Page({
|
|||||||
let avatar
|
let avatar
|
||||||
|
|
||||||
if(that.data.fileList2.length != 0){
|
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,
|
address:that.data.address,
|
||||||
avatar,
|
avatar,
|
||||||
name:that.data.name,
|
name:that.data.name,
|
||||||
|
|||||||
@ -23,43 +23,100 @@ Page({
|
|||||||
password: e.detail.value
|
password: e.detail.value
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
accountLogin(){
|
accountLogin() {
|
||||||
let that=this
|
let that = this
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '登录中...',
|
title: '登录中...',
|
||||||
mask:true
|
mask: true
|
||||||
})
|
})
|
||||||
util.postUrl(apiArr.login,{
|
|
||||||
account:that.data.account,
|
wx.getSetting({
|
||||||
password:that.data.password
|
withSubscriptions: true,
|
||||||
},res=>{
|
success: (res) => {
|
||||||
wx.hideLoading()
|
if (res.subscriptionsSetting && res.subscriptionsSetting.mainSwitch) {
|
||||||
if(res.msg == '操作成功'){
|
const itemSettings = res.subscriptionsSetting.itemSettings || {};
|
||||||
wx.setStorageSync('atoken', res.token)
|
const tmplMap = {
|
||||||
that.getInfo()
|
'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 == '操作成功') {
|
||||||
|
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() {
|
||||||
|
let that = this
|
||||||
|
util.postUrl4(apiArr.loginInfo, {}, res => {
|
||||||
|
console.log(res);
|
||||||
|
wx.showToast({
|
||||||
|
title: '登录成功!',
|
||||||
|
})
|
||||||
|
wx.setStorageSync('admin', res.data)
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/packages/partner/pages/partner',
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getInfo(){
|
tohome() {
|
||||||
let that = this
|
|
||||||
util.postUrl4(apiArr.loginInfo,{},res=>{
|
|
||||||
console.log(res);
|
|
||||||
wx.showToast({
|
|
||||||
title: '登录成功!',
|
|
||||||
})
|
|
||||||
wx.setStorageSync('admin', res.data)
|
|
||||||
setTimeout(()=>{
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '/packages/partner/pages/partner',
|
|
||||||
})
|
|
||||||
},1500)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
tohome(){
|
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/chooseEntrance/chooseEntrance',
|
url: '/pages/chooseEntrance/chooseEntrance',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,8 @@ Page({
|
|||||||
flag = false
|
flag = false
|
||||||
}
|
}
|
||||||
res.rows.forEach(item=>{
|
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({
|
that.setData({
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
let util = require('../../../../utils/util')
|
let util = require('../../../../utils/util')
|
||||||
let apiArr = require('../../../../api/water_filter')
|
let apiArr = require('../../../../api/water_filter')
|
||||||
|
let apiArr2 = require('../../../../api/partner')
|
||||||
// packages/partner/pages/orderDesc/orderDesc.js
|
// packages/partner/pages/orderDesc/orderDesc.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -10,10 +11,11 @@ Page({
|
|||||||
type: '',
|
type: '',
|
||||||
install_id:"",
|
install_id:"",
|
||||||
statusType: {
|
statusType: {
|
||||||
1: '待分配',
|
1: '待分配',
|
||||||
2: '安装中',
|
2: '安装中',
|
||||||
3: '已安装',
|
3: '待激活',
|
||||||
4: '已撤销'
|
4: '已安装',
|
||||||
|
5: '忽略',
|
||||||
},
|
},
|
||||||
Info:{}
|
Info:{}
|
||||||
},
|
},
|
||||||
@ -26,7 +28,7 @@ Page({
|
|||||||
install_id:Number(that.data.install_id)
|
install_id:Number(that.data.install_id)
|
||||||
}
|
}
|
||||||
if (this.data.type === 'repair') {
|
if (this.data.type === 'repair') {
|
||||||
url = apiArr.repairOrderOne;
|
url = apiArr2.getOrderPairListInfo;
|
||||||
param = {
|
param = {
|
||||||
repair_id: Number(that.data.install_id)
|
repair_id: Number(that.data.install_id)
|
||||||
}
|
}
|
||||||
@ -40,7 +42,7 @@ Page({
|
|||||||
|
|
||||||
headerPicClick() {
|
headerPicClick() {
|
||||||
wx.previewImage({
|
wx.previewImage({
|
||||||
urls: [this.data.Info.fault_imgs]
|
urls: [ util.img_url + this.data.Info.fault_imgs]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
<view class="pic_view">
|
<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" 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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -112,5 +112,4 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<Footer></Footer>
|
|
||||||
|
|
||||||
|
|||||||
@ -19,8 +19,8 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="label">来源</text>
|
<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 == 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 == 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 == 3}}">后台</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="label">区域</text>
|
<text class="label">区域</text>
|
||||||
@ -54,5 +54,4 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<Footer></Footer>
|
|
||||||
|
|
||||||
|
|||||||
@ -1,38 +1,62 @@
|
|||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
subscribeList: [
|
subscribeList: [
|
||||||
{ id: 1, name: '订单付款通知', subscribed: false, },
|
{ id: 1, name: '订单付款通知', status: 'unsubscribed' },
|
||||||
{ id: 2, name: '订单续费通知', subscribed: false },
|
{ id: 2, name: '订单续费通知', status: 'unsubscribed' },
|
||||||
{ id: 3, name: '欠费通知', subscribed: false },
|
{ id: 3, name: '欠费通知', status: 'unsubscribed' },
|
||||||
{ id: 4, name: '新注册用户提醒', subscribed: false },
|
{ id: 4, name: '新注册用户提醒', status: 'unsubscribed' },
|
||||||
{ id: 5, name: '工单状态通知', subscribed: false },
|
{ id: 5, name: '工单状态通知', status: 'unsubscribed' },
|
||||||
{ id: 6, name: '工单完成通知', subscribed: false },
|
{ id: 6, name: '工单完成通知', status: 'unsubscribed' },
|
||||||
{ id: 7, name: '工单派工通知', subscribed: false },
|
{ id: 7, name: '工单派工通知', status: 'unsubscribed' },
|
||||||
{ id: 8, name: '设备告警通知', subscribed: false },
|
{ id: 8, name: '设备告警通知', status: 'unsubscribed' },
|
||||||
{ id: 9, name: '订单重新指派提醒', subscribed: false },
|
{ id: 9, name: '订单重新指派提醒', status: 'unsubscribed' },
|
||||||
{ id: 10, name: '新订单提醒', subscribed: false },
|
{ id: 10, name: '新订单提醒', status: 'unsubscribed' },
|
||||||
{ id: 11, name: '设备故障通知', subscribed: false },
|
{ id: 11, name: '设备故障通知', status: 'unsubscribed' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 从缓存加载用户订阅状态
|
const tmplIds = {
|
||||||
const savedSubs = wx.getStorageSync('subscribeSettings') || {};
|
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0',
|
||||||
this.setData({
|
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU',
|
||||||
subscribeList: this.data.subscribeList.map(item => ({
|
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24',
|
||||||
...item,
|
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44',
|
||||||
subscribed: savedSubs[item.id] || false
|
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,
|
||||||
|
status: itemSettings[tmplIds[item.id]] === 'accept' ? 'subscribed' :
|
||||||
|
itemSettings[tmplIds[item.id]] === 'reject' ? 'rejected' : 'unsubscribed'
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSubscribe(e) {
|
handleSubscribe(e) {
|
||||||
const { id } = e.currentTarget.dataset;
|
const { id } = e.currentTarget.dataset;
|
||||||
const newValue = e.detail.value;
|
const item = this.data.subscribeList.find(item => item.id === id);
|
||||||
|
|
||||||
// 检查是否之前被拒绝过
|
if (item.status === 'subscribed') {
|
||||||
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
|
return; // 已订阅的不做处理
|
||||||
if (newValue && rejected[id]) {
|
}
|
||||||
|
|
||||||
|
// 如果是已拒绝状态,提示用户去设置开启权限
|
||||||
|
if (item.status === 'rejected') {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '您之前拒绝了订阅,需要前往设置重新开启',
|
content: '您之前拒绝了订阅,需要前往设置重新开启',
|
||||||
@ -42,70 +66,7 @@ Page({
|
|||||||
wx.openSetting({
|
wx.openSetting({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.authSetting['scope.subscribeMessage']) {
|
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);
|
this.requestSubscribeMessage(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,23 +75,23 @@ Page({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 未订阅状态直接触发订阅
|
||||||
this.requestSubscribeMessage(id);
|
this.requestSubscribeMessage(id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 修改 requestSubscribeMessage 方法
|
|
||||||
requestSubscribeMessage(id) {
|
requestSubscribeMessage(id) {
|
||||||
const tmplIds = {
|
const tmplIds = {
|
||||||
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0', // 滤芯更换提醒模板ID
|
1: '5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0',
|
||||||
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU', // 设备异常提醒模板ID
|
2: '2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU',
|
||||||
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24', // 水质检测报告模板ID
|
3: 'eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24',
|
||||||
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44', // 服务到期提醒模板ID
|
4: 're34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44',
|
||||||
5: '_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4', // 服务到期提醒模板ID
|
5: '_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4',
|
||||||
6: 'CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384', // 服务到期提醒模板ID
|
6: 'CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384',
|
||||||
7: 'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4', // 服务到期提醒模板ID
|
7: 'qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4',
|
||||||
8: 'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo', // 服务到期提醒模板ID
|
8: 'T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo',
|
||||||
9: 'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA', // 服务到期提醒模板ID
|
9: 'q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA',
|
||||||
10: 'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg', // 服务到期提醒模板ID
|
10: 'pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg',
|
||||||
11: 'VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s' // 促销活动通知模板ID
|
11: 'VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s' // 促销活动通知模板ID
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,39 +99,24 @@ Page({
|
|||||||
tmplIds: [tmplIds[id]],
|
tmplIds: [tmplIds[id]],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res[tmplIds[id]] === 'accept') {
|
if (res[tmplIds[id]] === 'accept') {
|
||||||
// 清除拒绝记录
|
this.setData({
|
||||||
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
|
subscribeList: this.data.subscribeList.map(item =>
|
||||||
delete rejected[id];
|
item.id === id ? {...item, status: 'subscribed'} : item
|
||||||
wx.setStorageSync('rejectedSubscriptions', rejected);
|
)
|
||||||
|
});
|
||||||
// 保存订阅状态
|
|
||||||
this.saveSubscribeStatus(id, true);
|
|
||||||
wx.showToast({ title: '订阅成功' });
|
wx.showToast({ title: '订阅成功' });
|
||||||
} else {
|
} else {
|
||||||
// 记录拒绝状态
|
this.setData({
|
||||||
const rejected = wx.getStorageSync('rejectedSubscriptions') || {};
|
subscribeList: this.data.subscribeList.map(item =>
|
||||||
rejected[id] = true;
|
item.id === id ? {...item, status: 'rejected'} : item
|
||||||
wx.setStorageSync('rejectedSubscriptions', rejected);
|
)
|
||||||
wx.showToast({
|
|
||||||
title: '订阅被拒绝',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
});
|
||||||
|
wx.showToast({ title: '订阅被拒绝', icon: 'none' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
wx.showToast({
|
wx.showToast({ title: '订阅失败', icon: 'none' });
|
||||||
title: '订阅失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
// saveSubscribeStatus 方法保持不变
|
|
||||||
saveSubscribeStatus(id, subscribed) {
|
|
||||||
// 只更新缓存,不更新UI
|
|
||||||
const settings = wx.getStorageSync('subscribeSettings') || {};
|
|
||||||
settings[id] = subscribed;
|
|
||||||
wx.setStorageSync('subscribeSettings', settings);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1,7 +1,14 @@
|
|||||||
<!--pages/SubscribeMessage/SubscribeMessage.wxml-->
|
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="subscribe-item" wx:for="{{subscribeList}}" wx:key="id" bindtap="handleSubscribe" data-id="{{item.id}}">
|
<view class="subscribe-item" wx:for="{{subscribeList}}" wx:key="id" bindtap="handleSubscribe" data-id="{{item.id}}">
|
||||||
<text class="item-name">{{item.name}}</text>
|
<text>{{item.name}}</text>
|
||||||
<text class="item-action">订阅</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>
|
</view>
|
||||||
@ -10,6 +10,36 @@
|
|||||||
border-bottom: 1rpx solid #f5f5f5;
|
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 {
|
.item-name {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|||||||
@ -107,7 +107,7 @@ Page({
|
|||||||
if (accountInfo.miniProgram.version) {
|
if (accountInfo.miniProgram.version) {
|
||||||
version = accountInfo.miniProgram.version
|
version = accountInfo.miniProgram.version
|
||||||
} else {
|
} else {
|
||||||
version = '1.0.17'
|
version = '1.0.19'
|
||||||
}
|
}
|
||||||
|
|
||||||
wx.setStorageSync('version', version)
|
wx.setStorageSync('version', version)
|
||||||
|
|||||||
@ -8,7 +8,10 @@
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
padding-top: 300rpx;
|
padding-top: 300rpx;
|
||||||
}
|
}
|
||||||
|
page{
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
.title {
|
.title {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@ -301,27 +301,7 @@ Page({
|
|||||||
that.setData({
|
that.setData({
|
||||||
GoodsMsg: res
|
GoodsMsg: res
|
||||||
})
|
})
|
||||||
|
|
||||||
that.pay()
|
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()
|
that.queryPay()
|
||||||
},
|
},
|
||||||
fail(fal) {
|
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() {
|
queryPay() {
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl2(PayJs.HsqueryPayByWechat, {
|
util.postUrl2(PayJs.HsqueryPayByWechat, {
|
||||||
out_trade_no: that.data.GoodsMsg.order_no
|
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 => {
|
}, res => {
|
||||||
if (res.statusCode == '200') {
|
if (res.statusCode == '200') {
|
||||||
|
|
||||||
// wx.requestSubscribeMessage({
|
|
||||||
// tmplIds:['pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg'],
|
|
||||||
// success(res){
|
|
||||||
// console.log(res);
|
|
||||||
// },
|
|
||||||
// fail(err){
|
|
||||||
// console.log(err);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '支付成功!',
|
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 {
|
} else {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
|
|||||||
@ -68,7 +68,9 @@
|
|||||||
<text class="label">详细说明</text>
|
<text class="label">详细说明</text>
|
||||||
<view class="value">
|
<view class="value">
|
||||||
<!-- <input type="text" value="{{selectedDeposit.desc}}" placeholder-style="font-size: 26rpx;color:#999" disabled /> -->
|
<!-- <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>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@ -11,11 +11,11 @@ Page({
|
|||||||
loginType: 'account', // 默认手机登录
|
loginType: 'account', // 默认手机登录
|
||||||
password: "",
|
password: "",
|
||||||
account: "",
|
account: "",
|
||||||
type:""
|
type: ""
|
||||||
},
|
},
|
||||||
navigateToAgreement(){
|
navigateToAgreement() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '../Agreement/Agreement',
|
url: '../Agreement/Agreement',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
accountIpt(e) {
|
accountIpt(e) {
|
||||||
@ -44,10 +44,74 @@ Page({
|
|||||||
}
|
}
|
||||||
that.setData({
|
that.setData({
|
||||||
loginType,
|
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) {
|
getPhoneNumber(event) {
|
||||||
let that = this
|
let that = this
|
||||||
const { isLogin } = this.data;
|
const { isLogin } = this.data;
|
||||||
@ -190,18 +210,11 @@ Page({
|
|||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
postUrl(apiArr.loginGetPhone, {
|
postUrl(apiArr.loginGetPhone, {
|
||||||
code: event.detail.code
|
code: event.detail.code
|
||||||
}, res => {
|
}, res => {
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wx.setStorageSync('phone', res.phone);
|
wx.setStorageSync('phone', res.phone);
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@ -210,9 +223,10 @@ Page({
|
|||||||
mask: true,
|
mask: true,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
success: () => {
|
success: () => {
|
||||||
this.tohome();
|
that.tohome();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@ -239,80 +253,19 @@ 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 () {
|
tohome: function () {
|
||||||
let that= this
|
let that = this
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/water_filter/water_filter'
|
url: '/pages/water_filter/water_filter'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
backHomes(){
|
backHomes() {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/chooseEntrance/chooseEntrance',
|
url: '/pages/chooseEntrance/chooseEntrance',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -11,8 +11,9 @@ Page({
|
|||||||
statusType: {
|
statusType: {
|
||||||
1: '待分配',
|
1: '待分配',
|
||||||
2: '安装中',
|
2: '安装中',
|
||||||
3: '已安装',
|
3: '待激活',
|
||||||
4: '已撤销',
|
4: '已安装',
|
||||||
|
5: '忽略',
|
||||||
},
|
},
|
||||||
|
|
||||||
value1: 0,
|
value1: 0,
|
||||||
|
|||||||
@ -47,8 +47,10 @@
|
|||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">订单状态:</text>
|
<text class="label">订单状态:</text>
|
||||||
<text class="value " wx:if="{{newOrderDesc.status == '1'}}">待分配</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 == '2'}}">安装中</text>
|
||||||
<text class="value " wx:if="{{newOrderDesc.status == '3'}}">已安装</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>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
.label {
|
.label {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
width: 160rpx;
|
width: 210rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
|
|||||||
@ -88,17 +88,31 @@ Page({
|
|||||||
chartData: {
|
chartData: {
|
||||||
xAxis: [],
|
xAxis: [],
|
||||||
series: []
|
series: []
|
||||||
}
|
},
|
||||||
|
|
||||||
|
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(){
|
back() {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/chooseEntrance/chooseEntrance',
|
url: '/pages/chooseEntrance/chooseEntrance',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
scanOrder() {
|
scanOrder() {
|
||||||
let that= this
|
let that = this
|
||||||
util.postUrl(apiArr.scanOrder, { open_id: wx.getStorageSync('openId') }, res => {
|
util.postUrl(apiArr.scanOrder, { open_id: wx.getStorageSync('openId') }, res => {
|
||||||
console.log(res,'数据返回');
|
console.log(res, '数据返回');
|
||||||
if (res.id) {
|
if (res.id) {
|
||||||
if (wx.canIUse('requestMerchantTransfer')) {
|
if (wx.canIUse('requestMerchantTransfer')) {
|
||||||
wx.requestMerchantTransfer({
|
wx.requestMerchantTransfer({
|
||||||
@ -106,7 +120,7 @@ Page({
|
|||||||
appId: res.app_id,
|
appId: res.app_id,
|
||||||
package: res.package_info,
|
package: res.package_info,
|
||||||
success: (ress) => {
|
success: (ress) => {
|
||||||
console.log(res,'成功');
|
console.log(res, '成功');
|
||||||
that.queryOrder(res.id)
|
that.queryOrder(res.id)
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '支付成功!',
|
title: '支付成功!',
|
||||||
@ -114,7 +128,7 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
console.log(res,'失败');
|
console.log(res, '失败');
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '支付失败',
|
title: '支付失败',
|
||||||
icon: "none"
|
icon: "none"
|
||||||
@ -122,7 +136,7 @@ Page({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
content: '你的微信版本过低,请更新至最新版本。',
|
content: '你的微信版本过低,请更新至最新版本。',
|
||||||
@ -138,47 +152,47 @@ Page({
|
|||||||
let that = this
|
let that = this
|
||||||
wx.requestSubscribeMessage({
|
wx.requestSubscribeMessage({
|
||||||
tmplIds: ["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0", "2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU", "eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24"],
|
tmplIds: ["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0", "2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU", "eEetEKoNpqXk_EY0xqMt22_Xd7NFEyiODY6j0t3_A24"],
|
||||||
success(res){
|
success(res) {
|
||||||
console.log(res,'sucs');
|
console.log(res, 'sucs');
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
console.log(err,'err');
|
console.log(err, 'err');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
wx.requestSubscribeMessage({
|
wx.requestSubscribeMessage({
|
||||||
tmplIds: ["re34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44", "_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4", "CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384"],
|
tmplIds: ["re34uubgvrwJLaiM3LhQEmvxrRxoNcJbo7b8gcbxx44", "_s7GcsGNqapbnlLAJ5lUFexCEAx-dl4RD-DwwL9QqC4", "CWtF10H3syth9rdUaGr-4XojSa8TJMflb2z7zStw384"],
|
||||||
success(res){
|
success(res) {
|
||||||
console.log(res,'sucs');
|
console.log(res, 'sucs');
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
console.log(err,'err');
|
console.log(err, 'err');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
wx.requestSubscribeMessage({
|
wx.requestSubscribeMessage({
|
||||||
tmplIds: ["qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4", "T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo", "q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA"],
|
tmplIds: ["qLYGETdlX5pR8WvTs8v4g4zlBOhA04z46KS_Q_yesr4", "T87KsBIrVrjgO4VETEOpIn4c4-bsxOTpzM6lR0ghduo", "q3Aa07wgYPgB23mu4JOuSzgFoiYhouUcw-NhV5CNuSA"],
|
||||||
success(res){
|
success(res) {
|
||||||
console.log(res,'sucs');
|
console.log(res, 'sucs');
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
console.log(err,'err');
|
console.log(err, 'err');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
wx.requestSubscribeMessage({
|
wx.requestSubscribeMessage({
|
||||||
tmplIds: ["pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg", "VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s"],
|
tmplIds: ["pUkdPwh7jWLjCWWv2zyz7I086xNO_GoaJQ6A-cYuGVg", "VXRbeTG6gPPOrxTSwF_da8jzqH0UVHxQykYAH0XH51s"],
|
||||||
success(res){
|
success(res) {
|
||||||
console.log(res,'sucs');
|
console.log(res, 'sucs');
|
||||||
},
|
},
|
||||||
fail(err){
|
fail(err) {
|
||||||
console.log(err,'err');
|
console.log(err, 'err');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
queryOrder(data){
|
queryOrder(data) {
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl(api.queryOrder,{id:data},res=>{
|
util.postUrl(api.queryOrder, { id: data }, res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -186,7 +200,7 @@ Page({
|
|||||||
replay(e) {
|
replay(e) {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '重置中...',
|
title: '重置中...',
|
||||||
mask:true
|
mask: true
|
||||||
})
|
})
|
||||||
util.postUrl(apiArr.resetFilter, {
|
util.postUrl(apiArr.resetFilter, {
|
||||||
device_id: e.currentTarget.dataset.item.device_id,
|
device_id: e.currentTarget.dataset.item.device_id,
|
||||||
@ -254,7 +268,7 @@ Page({
|
|||||||
|
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
})
|
})
|
||||||
let that = this
|
let that = this
|
||||||
util.postUrl(apiArr.loginInfo, {}, ress => {
|
util.postUrl(apiArr.loginInfo, {}, ress => {
|
||||||
@ -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 }) {
|
base64({ url, type }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
wx.getFileSystemManager().readFile({
|
wx.getFileSystemManager().readFile({
|
||||||
@ -496,11 +567,11 @@ Page({
|
|||||||
currentDevice = item
|
currentDevice = item
|
||||||
currentDeviceId = item.device_id
|
currentDeviceId = item.device_id
|
||||||
wx.setStorageSync('device_id', item.device_id)
|
wx.setStorageSync('device_id', item.device_id)
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
that.getInfo(wx.getStorageSync('device_id'))
|
that.getInfo(wx.getStorageSync('device_id'))
|
||||||
|
|
||||||
@ -551,10 +622,8 @@ Page({
|
|||||||
let that = this
|
let that = this
|
||||||
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
|
util.postUrl(apiArr.deviceInfo, { device_id: e }, res => {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
|
|
||||||
// res.expiration_duration = '2025-06-01 08:06:42'
|
// 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) {
|
if (res.expiration_duration) {
|
||||||
res.difDay = Math.max(0, that.getDaysBetweenDates(res.install_time)) //服务天数,确保不小于0
|
res.difDay = Math.max(0, that.getDaysBetweenDates(res.install_time)) //服务天数,确保不小于0
|
||||||
} else {
|
} else {
|
||||||
@ -578,14 +647,14 @@ Page({
|
|||||||
}
|
}
|
||||||
res.today = Number(res.today).toFixed(2)
|
res.today = Number(res.today).toFixed(2)
|
||||||
res.yesterday = Number(res.yesterday).toFixed(2)
|
res.yesterday = Number(res.yesterday).toFixed(2)
|
||||||
console.log(res.difDay,'ressss');
|
|
||||||
that.setData({
|
that.setData({
|
||||||
currentDevice: res
|
currentDevice: res
|
||||||
})
|
})
|
||||||
that.getDeriveInfo()
|
that.getDeriveInfo()
|
||||||
|
|
||||||
wx.setStorageSync('device_id', res.device_id),
|
wx.setStorageSync('device_id', res.device_id),
|
||||||
wx.setStorageSync('currentDevice', res)
|
wx.setStorageSync('currentDevice', res)
|
||||||
wx.setStorageSync('billing_method', res.billing_method)
|
wx.setStorageSync('billing_method', res.billing_method)
|
||||||
|
|
||||||
if (!res.device_net) {
|
if (!res.device_net) {
|
||||||
|
|||||||
@ -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/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" />
|
<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" />
|
<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>
|
</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>
|
||||||
@ -2,6 +2,41 @@
|
|||||||
"condition": {
|
"condition": {
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"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",
|
"name": "pages/deposit/deposit",
|
||||||
"pathName": "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",
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
"libVersion": "3.8.1",
|
"libVersion": "3.8.7",
|
||||||
"projectname": "ui",
|
"projectname": "ui",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true,
|
"compileHotReLoad": true,
|
||||||
|
|||||||
@ -26,6 +26,32 @@ const getGuid = function () {
|
|||||||
return uuid;
|
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 formatTimeForChart = date => {
|
||||||
|
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
@ -252,23 +278,28 @@ const postUrl = function (url, data, successfn, token) {
|
|||||||
console.log('successddd', f);
|
console.log('successddd', f);
|
||||||
// TODO: 待验证是否可做判断依据
|
// TODO: 待验证是否可做判断依据
|
||||||
// 调用成功,返回200 等其他情况则表示接口失败
|
// 调用成功,返回200 等其他情况则表示接口失败
|
||||||
if (f.statusCode == 401) {
|
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
|
||||||
wx.showModal({
|
console.log('走到这?')
|
||||||
title: '提示',
|
goLogin();
|
||||||
content: '请登录后查看',
|
// wx.showModal({
|
||||||
confirmText: "去登陆",
|
// title: '提示',
|
||||||
complete: (res) => {
|
// content: '请登录后查看',
|
||||||
if (res.cancel) {
|
// confirmText: "去登陆",
|
||||||
|
// complete: (res) => {
|
||||||
|
// if (res.cancel) {
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (res.confirm) {
|
// if (res.confirm) {
|
||||||
wx.navigateTo({
|
|
||||||
url: '/pages/login/login',
|
|
||||||
})
|
// wx.reLaunch({
|
||||||
}
|
// url: JumpUrl,
|
||||||
}
|
// // url: '/pages/login/login',
|
||||||
})
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (f.data && f.statusCode === 200) {
|
if (f.data && f.statusCode === 200) {
|
||||||
@ -432,7 +463,9 @@ const postUrl3 = function (url, data, version, successfn, token) {
|
|||||||
console.log('successddd', f);
|
console.log('successddd', f);
|
||||||
// TODO: 待验证是否可做判断依据
|
// TODO: 待验证是否可做判断依据
|
||||||
// 调用成功,返回200 等其他情况则表示接口失败
|
// 调用成功,返回200 等其他情况则表示接口失败
|
||||||
if (f.statusCode == 401) {
|
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
|
||||||
|
goLogin();
|
||||||
|
return;
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请登录后查看',
|
content: '请登录后查看',
|
||||||
@ -442,9 +475,12 @@ const postUrl3 = function (url, data, version, successfn, token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
wx.navigateTo({
|
wx.reLaunch({
|
||||||
url: '/pages/login/login',
|
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);
|
console.log('successddd', f);
|
||||||
// TODO: 待验证是否可做判断依据
|
// TODO: 待验证是否可做判断依据
|
||||||
// 调用成功,返回200 等其他情况则表示接口失败
|
// 调用成功,返回200 等其他情况则表示接口失败
|
||||||
if (f.statusCode == 401) {
|
if (f.statusCode == 401 || f.data.msg === "效验令牌失败") {
|
||||||
|
goLogin();
|
||||||
|
return;
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请登录后查看',
|
content: '请登录后查看',
|
||||||
@ -537,8 +575,8 @@ const postUrl4 = function (url, data, successfn, token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
wx.navigateTo({
|
wx.reLaunch({
|
||||||
url: '/pages/login/login',
|
url: '/pages/login/login',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user