diff --git a/api/partner.js b/api/partner.js index a7ddcde..5dff2d0 100644 --- a/api/partner.js +++ b/api/partner.js @@ -1,12 +1,14 @@ const login = '/users/admin-login' //登录 const loginInfo = '/users/get-info' //登录信息 +const getPartnerList = '/dealer/get-list'//经销商列表 const getPartner = '/dealer/get-one' //经销商信息 +const editPartner = '/dealer/modify' //修改经销商信息 const getPackageList = '/new-install/packages' //套餐购买列表 - const createNewOrder = '/new-install/create' //创建新装工单 + const phoneSearch = '/customer/phone-search' //搜索客户电话 const getproductList = '/water/dealer/deposit_pack_product'//新增工单产品 @@ -28,8 +30,69 @@ const getOrderPairList = '/order-repair/list' const getOrderPairListInfo = '/order-repair/one' const assignPartReplaceMaster = '/part_replace/assign' //指派 + +const getNewOrder = '/new-install/list' //新增工单列表 +const newOrderDesc = '/new-install/one' //新装工单详情 +const BeActive = '/new-install/active-device' //新装工单激活 +const completeNewOrder = '/new-install/complete' //新装工单完成 +const cancelNewOrder = '/water/new-install-cancel' + + +const gerRepairOrder = '/order-repair/list' //维修工单列表 +const RepairOrderDesc = '/order-repair/one'//维修工单详情 +const completeRepairOrder = '/order-repair/complete'//完成维修工单 +const assignRepairMaster = '/order-repair/assign' //维修工单指派师傅 + + +const getPartOrder = '/part_replace/list' //更换工单列表 +const PartOrderDesc = '/part_replace/one' //滤芯更换详情 +const completePartOrder = '/part_replace/complete-part-replace'//完成更换 + +const getUninstallOrder = '/uninstall/list' //拆除工单列表 +const getUninstallDesc = '/uninstall/one' //拆除工单详情 +const unintsall = '/uninstall/complete' //完成拆除 +const operate = '/uninstall/operate' //报废 入库 + +const boardInfo = '/waters/board-info-query' +const getDeviceByCode = '/device/qrcode' //扫码 +const ScanQrcodeInNewOrder = '/water/new-install-device-code' +const allocation = '/device/allocation' //设备分配 + +const UninstallAllocation = '/uninstall/allocation'//分配拆除工单 + + +const getEquipmentStock = '/product/inventory-list'//设备库存 +const getEquipmentStockInfo = '/inventory/info' //设备库存-设备详情 +const getFilterStock = '' +const getFilterStockInfo = '' + const apiArr = { + getDeviceByCode, + assignRepairMaster, + UninstallAllocation, + ScanQrcodeInNewOrder, + getEquipmentStock, + getEquipmentStockInfo, + allocation, + operate, + unintsall, + completeRepairOrder, + newOrderDesc, + BeActive, + getPartnerList, + completeNewOrder, + completePartOrder, + cancelNewOrder, + editPartner, + RepairOrderDesc, + PartOrderDesc, + getUninstallDesc, + boardInfo, createMaster, + getNewOrder, + gerRepairOrder, + getPartOrder, + getUninstallOrder, getOrderPairList, getOrderPairListInfo, masterSelect, diff --git a/api/water_filter.js b/api/water_filter.js index a871e7e..0f7f5fc 100644 --- a/api/water_filter.js +++ b/api/water_filter.js @@ -50,7 +50,6 @@ const deviceDesc = '/device/one' //设备详情 // const newOrderList = '/wechat/water/dealer/get_list_new_install' //新装工单列表 const newOrderList = '/new-install/list' //新装工单列表 - const userNewOrderList = '/wechat/water/new-install-list' //微信新装工单列表 @@ -142,7 +141,31 @@ const scanOrder = '/wechat/trans-order/confirm' //查询是否有转账 const queryOrder = '/wechat/trans-order/success' //确认是否转账 const BeActive = '/wechat/water/dealer/active-device' //激活设备 + +const UninstallOrder = '/uninstall/create'//创建拆机工单 +const deviceActive = '/device/active' //设备激活 +const deviceDataForce = '/waters/board-data-force' //流量充值 +const deviceDeactivation = '/waters/board-deactivation' //时长充值 +const deviceToTime = '/waters/billing-mode-to-time' //转时长 +const deviceToTraffic = '/waters/billing-mode-to-traffic' //转流量 +const deviceToRetail = '/waters/billing-mode-to-retail' //转零售 + + +const getServerInfo = '/wechat/cus-server-info' //平台客服 二维码 +const cusGetServerInfo = '/wechat/water/get-customer-service' //用户获取平台二维码 + +const getTrans = '/wechat/water/trans' //品宣金 const apiArr = { + getServerInfo, + cusGetServerInfo, + getTrans, + deviceDeactivation, + deviceToTime, + deviceToTraffic, + deviceDataForce, + deviceActive, + deviceToRetail, + UninstallOrder, cancelActivation, queryOrder, createUninstallOrder, diff --git a/app.json b/app.json index 586bdee..29f7c74 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/newLogin/newLogin", "pages/chooseEntrance/chooseEntrance", "pages/water_filter/water_filter", "pages/info/info", @@ -16,8 +17,10 @@ "pages/newOrderList/newOrderList", "pages/newOrderListDesc/index", "pages/RechargeRecord/RechargeRecord", + "pages/RechargeRecordDesc/RechargeRecordDesc", "pages/filterChange/filterChange", - "pages/SubscribeMessage/SubscribeMessage" + "pages/SubscribeMessage/SubscribeMessage", + "pages/renewalRecord/renewalRecord" ], "subPackages": [ { @@ -72,12 +75,14 @@ { "root": "packages/master", "pages":[ + "masterIndex/index", "order/index", "orderDesc/index", "PersonCen/index", "masterInfo/index", "device/index", - "deviceInfo/index" + "deviceInfo/index", + "addNewOrder/index" ] }, { @@ -85,6 +90,9 @@ "pages": [ "pages/login/login", "pages/partner", + "pages/OrderMsg/OrderMsg", + "pages/OrderMsgInfo/OrderMsgInfo", + "pages/distributor/distributor", "pages/purchaseGoods/purchaseGoods", "pages/WorkOrder/WorkOrder", "pages/newWorkOrder/newWorkOrder", @@ -103,7 +111,20 @@ "pages/income/income", "pages/incomeDesc/incomeDesc", "pages/incomeDetail/incomeDetail", - "pages/addNewOrder/addNewOrder" + "pages/addNewOrder/addNewOrder", + "pages/chooseDevice/chooseDevice", + "pages/chooseRepairDevice/chooseRepairDevice", + "pages/editAdmin/editAdmin", + "pages/device/device", + "pages/equipmentStock/equipmentStock", + "pages/filterStock/filterStock", + "pages/filterStockInfo/filterStockInfo", + "pages/deviceDesc/deviceDesc", + "pages/mine/mine", + "pages/marketingOrder1/marketingOrder1", + "pages/marketingOrder2/marketingOrder2", + "pages/order1/order1", + "pages/order2/order2" ] } ], diff --git a/component/masterFooter/index.js b/component/masterFooter/index.js index e284630..1c16fcd 100644 --- a/component/masterFooter/index.js +++ b/component/masterFooter/index.js @@ -16,8 +16,8 @@ Component({ data: { nav_list:[ { - url:"/packages/master/order/index", - nav_name:"订单", + url:"/packages/master/masterIndex/index", + nav_name:"首页", photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1" }, { diff --git a/component/partnerFooter/index.js b/component/partnerFooter/index.js new file mode 100644 index 0000000..ba08694 --- /dev/null +++ b/component/partnerFooter/index.js @@ -0,0 +1,50 @@ +import apiAddr from '../../api/base'; +import { setData } from '../../utils/index'; + +Component({ + + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + nav_list:[ + { + url:"/packages/partner/pages/partner", + nav_name:"首页", + photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1" + }, + { + url:"/packages/partner/pages/mine/mine", + nav_name:"我的", + photo:"https://zhsq.hshuishang.com/attachs/navigation/2024/12/23/6768c0b16ce89.png" + }, + ], + foot_width:'50%', + }, + + /** + * 组件的方法列表 + */ + methods: { + + jump(e){ + wx.redirectTo({ + url: e.currentTarget.dataset.url, + }) + }, + + }, + + lifetimes: { + attached: function () { + // 组件被添加到页面节点树时执行 + }, + }, +}) \ No newline at end of file diff --git a/component/partnerFooter/index.json b/component/partnerFooter/index.json new file mode 100644 index 0000000..011372e --- /dev/null +++ b/component/partnerFooter/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/component/partnerFooter/index.wxml b/component/partnerFooter/index.wxml new file mode 100644 index 0000000..08df2e1 --- /dev/null +++ b/component/partnerFooter/index.wxml @@ -0,0 +1,9 @@ + + + + + + {{item.nav_name}} + + + \ No newline at end of file diff --git a/component/partnerFooter/index.wxss b/component/partnerFooter/index.wxss new file mode 100644 index 0000000..4f0490b --- /dev/null +++ b/component/partnerFooter/index.wxss @@ -0,0 +1,3 @@ +/* pages/public/footer.wxss */ +@import "../../app.wxss"; + diff --git a/component/wan-select/index.js b/component/wan-select/index.js new file mode 100644 index 0000000..111037b --- /dev/null +++ b/component/wan-select/index.js @@ -0,0 +1,132 @@ +// components/wan-select/select.js +Component({ + options: { + addGlobalClass: true, + }, + properties: { + /* --------- 样式参数 --------- */ + titleWidth: { // 标题长度 + type: String, + value: "60px" + }, + bgColor: { // 输入框背景颜色 + type: String, + value: "#fff" + }, + itemBgColor: { // 选中的选项背景颜色 + type: String, + value: "#F5F8FE" + }, + textColor: { // 选中的字体颜色 + type: String, + value: "#3772E9" + }, + /* --------- 数据参数 --------- */ + title: { // 下拉框标题 + type: String, + value: "" + }, + options: { // 选项数组 + type: Array, + value: [], + }, + labelName: { // 选项数组-绑定的label名称 + type: String, + value: "dictLabel", + }, + valueName: { // 选项数组-绑定的value名称 + type: String, + value: "dictValue" + }, + modelValue: { // 绑定的value + type: String, + value: "", + observer: function () { + //如果有默认值,需要匹配出name,所以这里使用obersver,当父组件中值改变时触发 + this.handleData(); + } + }, + placeholder: { // 输入框为空时占位符 + type: String, + value: "请选择" + }, + disabled: { // 是否禁用 + type: Boolean, + value: false + }, + readonly: { // 是否只读 + type: Boolean, + value: false + } + }, + /** + * 页面的初始数据 + */ + data: { + show: false, //选项框及图标展示 + selectValue: "", //选中的value + selectLabel: "", //选中的label + toTop: false, // 下拉框是否展示在输入框上方 + }, + attached() { + this.handleData() + }, + methods: { + // 清空输入框 + clearInput() { + this.setData({ + selectValue: "", //选中的value + selectLabel: "", //选中的label + show: false, + }) + }, + // 下拉框收起和展开 + changeShow(e) { + let that = this + const query = wx.createSelectorQuery(); + // 选择当前点击的 view 元素 + query.select('.inputPlaceholder').boundingClientRect(); + query.exec(function (res) { // res[0].bottom 是元素距离可视区域顶部的距离加上元素自身的高度; res[1].scrollTop 是页面的滚动距离 + var show = !that.data.show + if (res[0]) { + /* that.triggerEvent("handleShow", show); // [暂未发现]处理滚动选项区域时背景页面滚动问题 */ + let toBottom = wx.getSystemInfoSync().windowHeight - res[0].bottom; + console.log('距离设备底部的距离:', toBottom); + that.setData({ + toTop: toBottom < 160 ? true : false, + show: show + }) + } else { + that.setData({ show: show }) + } + }); + }, + // 选择数据后回显 + handleChange(e) { + let { item } = e.currentTarget.dataset + let { labelName, valueName } = this.data + this.setData({ + selectValue: item[valueName], + selectLabel: item[labelName], + show: false + }) + let obj = {} + obj[valueName] = item[valueName] + obj[labelName] = item[labelName] + this.triggerEvent("handleChange", obj);// 传参 + }, + // 匹配值并回显 + handleData() { + let { modelValue, options, valueName, labelName } = this.properties; + if (modelValue) { + let item = options.find(r => r[valueName] == modelValue) + this.setData({ + selectLabel: item ? item[labelName] : modelValue, + selectValue: modelValue, + }); + } + } + } + }) + + \ No newline at end of file diff --git a/component/wan-select/index.json b/component/wan-select/index.json new file mode 100644 index 0000000..6aec2a2 --- /dev/null +++ b/component/wan-select/index.json @@ -0,0 +1,5 @@ +{ + "component": true, + "usingComponents": {} + } + \ No newline at end of file diff --git a/component/wan-select/index.wxml b/component/wan-select/index.wxml new file mode 100644 index 0000000..0663294 --- /dev/null +++ b/component/wan-select/index.wxml @@ -0,0 +1,40 @@ + + + + {{title}} + + + + {{selectLabel}} + {{placeholder}} + + + + + + {{selectLabel}} + + + + + {{placeholder}} + + + + + + + + + + + 暂无数据 + + {{item[labelName]}} + + + + + \ No newline at end of file diff --git a/component/wan-select/index.wxss b/component/wan-select/index.wxss new file mode 100644 index 0000000..773e3d6 --- /dev/null +++ b/component/wan-select/index.wxss @@ -0,0 +1,100 @@ +/* components/wan-select/select.wxss */ +.select_all_view { + display: flex; + justify-content: start; + align-items: start; + } + + .select_view { + /* min-width: 200rpx; */ + min-height: 64rpx; + } + + .inputPlaceholder { + font-size: 28rpx; + } + + .icon { + position: absolute; + right: 12rpx; + top: 20rpx; + } + + .contentItem { + height: 64rpx; + } + + .content { + width: calc(100% - 4px); + margin-left: 2px; + position: absolute; + z-index: 999; + max-height: 296rpx; + background: #FFFFFF; + /* border: 1px solid #ccc; */ + box-shadow: 0 0 4px #ccc; + opacity: 1; + /* margin-top: 10rpx; */ + overflow-x: hidden; + overflow-y: scroll; + } + + .triangleBox { + position: absolute; + z-index: 1000; + left: 30rpx; + } + + .triangle { + position: relative; + border-left: 12rpx solid transparent; + border-right: 12rpx solid transparent; + border-bottom: 10rpx solid #ccc; + } + + .triangle::after { + content: ''; + position: absolute; + top: 3rpx; + left: -12rpx; + border-left: 12rpx solid transparent; + border-right: 12rpx solid transparent; + border-bottom: 10rpx solid #fff; + } + + .triangleBox-top { + position: absolute; + z-index: 1000; + left: 30rpx; + + } + + .triangle-top { + position: relative; + border-left: 12rpx solid transparent; + border-right: 12rpx solid transparent; + border-top: 10rpx solid #ccc; + } + + .triangle-top::after { + content: ''; + position: absolute; + bottom: 3rpx; + left: -12rpx; + border-left: 12rpx solid transparent; + border-right: 12rpx solid transparent; + border-top: 10rpx solid #fff; + } + + .is-reverse { + transform: rotate(180deg); + } + + .transfer { + transition: transform .3s; + } + + .no-reverse { + transition: rotate(0deg); + } + \ No newline at end of file diff --git a/packages/WaterPurifier/pages/Addfriend/Addfriend.js b/packages/WaterPurifier/pages/Addfriend/Addfriend.js index 8bc4832..f26b30d 100644 --- a/packages/WaterPurifier/pages/Addfriend/Addfriend.js +++ b/packages/WaterPurifier/pages/Addfriend/Addfriend.js @@ -1,116 +1,138 @@ +let util = require('../../../../utils/util') +let apiArr = require('../../../../api/water_filter') // packages/WaterPurifier/pages/Addfriend/Addfriend.js Page({ - /** - * 页面的初始数据 - */ - data: { + /** + * 页面的初始数据 + */ + data: { - }, + }, - save(){ - wx.downloadFile({ - url: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/customer.jpg', - success(res) { - if (res.statusCode === 200) { - const tempFilePath = res.tempFilePath; // 获取临时文件路径 + save() { + wx.downloadFile({ + url: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/customer.jpg', + success(res) { + if (res.statusCode === 200) { + const tempFilePath = res.tempFilePath; // 获取临时文件路径 - // 保存图片到相册 - wx.saveImageToPhotosAlbum({ - filePath: tempFilePath, - success() { - wx.showToast({ - title: '保存成功', - icon: 'success', - }); + // 保存图片到相册 + wx.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success() { + wx.showToast({ + title: '保存成功', + icon: 'success', + }); + }, + fail(err) { + console.error('保存失败', err); + wx.showToast({ + title: '保存失败,请重试', + icon: 'none', + }); + }, + }); + } }, fail(err) { - console.error('保存失败', err); - wx.showToast({ - title: '保存失败,请重试', - icon: 'none', - }); + console.error('下载失败', err); + wx.showToast({ + title: '下载失败,请重试', + icon: 'none', + }); }, }); + }, + + getServerInfo() { + let that = this + util.postUrl(apiArr.cusGetServerInfo, { + device_id:wx.getStorageSync('device_id') + }, res => { + res.qr_code = res.qr_code.startsWith('http') ? res.qr_code : util.img_url + res.qr_code + console.log(res.qr_code); + that.setData({ + serverInfo: res + }) + }) + }, + call(){ + let that = this + wx.makePhoneCall({ + phoneNumber: that.data.serverInfo.customer_phone, + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + wx.showShareMenu({ + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] + }) + this.getServerInfo() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + 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) } }, - fail(err) { - console.error('下载失败', err); - wx.showToast({ - title: '下载失败,请重试', - icon: 'none', - }); + onShareTimeline() { + return { + title: '人人爱净水', // 自定义标题 + query: '', // 自定义页面路径中的参数 + imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径 + } }, - }); -}, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - wx.showShareMenu({ - withShareTicket: true, - menus: ['shareAppMessage', 'shareTimeline'] - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - 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' // 自定义分享图片路径 - } -}, }) \ No newline at end of file diff --git a/packages/WaterPurifier/pages/Addfriend/Addfriend.wxml b/packages/WaterPurifier/pages/Addfriend/Addfriend.wxml index a1ab6df..221da15 100644 --- a/packages/WaterPurifier/pages/Addfriend/Addfriend.wxml +++ b/packages/WaterPurifier/pages/Addfriend/Addfriend.wxml @@ -1,5 +1,10 @@ - - 保存到相册 + + 客服电话: + {{serverInfo.customer_phone}} + + + + 长按保存二维码 \ No newline at end of file diff --git a/packages/WaterPurifier/pages/Addfriend/Addfriend.wxss b/packages/WaterPurifier/pages/Addfriend/Addfriend.wxss index 0c9dbdc..aab9ece 100644 --- a/packages/WaterPurifier/pages/Addfriend/Addfriend.wxss +++ b/packages/WaterPurifier/pages/Addfriend/Addfriend.wxss @@ -3,28 +3,29 @@ image { height: 100%; } -.box{ +.box { display: flex; flex-direction: column; align-items: center; - justify-content: center; height: 100vh; } -.btn { - width: 650rpx; - height: 80rpx; - background: #2583FF; - border-radius: 100rpx 100rpx 100rpx 100rpx; - font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; - font-weight: 400; - font-size: 36rpx; - color: #FFFFFF; + +.row { + margin-top: 100rpx; display: flex; align-items: center; justify-content: center; - margin-top: 120rpx; + font-size: 30rpx; + color: #000; } -#img{ + +.label { + color: #999; + margin-right: 10rpx; +} + +#img { width: 400rpx; - margin-bottom: 300rpx; + margin-top: 120rpx; + margin-bottom: 60rpx; } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.js b/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.js index 9a67f3b..c8d8c1f 100644 --- a/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.js +++ b/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.js @@ -29,14 +29,6 @@ Page({ name: "待支付", type: "1" }, - { - name: "待发货", - type: "2" - }, - { - name: "已发货", - type: "3" - }, { name: "已支付", type: "4" @@ -45,14 +37,6 @@ Page({ name: "已取消", type: "5" }, - { - name: "已失效", - type: "6" - }, - { - name: "支付失败", - type: "7" - }, ], state: 0, selectPackage: "" diff --git a/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.wxml b/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.wxml index 97c443a..8cbdeb5 100644 --- a/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.wxml +++ b/packages/WaterPurifier/pages/RechargeRecord/RechargeRecord.wxml @@ -22,14 +22,11 @@ 待支付 - 代发货 - 已发货 - 已支付 + 已支付 已取消 - 已失效 - 支付失败 - + 其他 + 订单名称 @@ -40,8 +37,8 @@ {{item.order_no}} - 本次购买 - {{item.pay_time}} + 套餐名称 + {{item.package_name}} 支付方式 @@ -55,6 +52,11 @@ 金额 ¥{{item.total_price}} + + 支付时间 + {{item.pay_time}} + + 去支付 diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.js b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.js new file mode 100644 index 0000000..805a287 --- /dev/null +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.js @@ -0,0 +1,403 @@ +let util = require("../../../../../utils/util") +const apiArr = require('../../../../../api/water_filter') +const { postUrl3 } = require("../../../../../utils/util") + +// packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + progress_List: [{ + "name": "HXTH滤芯", + "progress": 97.41 + }, + { + "name": "RO膜滤芯", + "progress": 87.41 + }, + { + "name": "PP+CB滤芯", + "progress": 40.41 + }, + { + "name": "PP棉滤芯", + "progress": 90.41 + } + ], + device_id: "", + Info: {}, + show: false, + show2: false, + show3: false, + remarks1: "", + remainingDays: "", + surplusFlow: "", + }, + + getInfo() { + let that = this + util.postUrl(apiArr.deviceDesc, { + device_id: Number(that.data.device_id) + }, res => { + if (res.device_part) { + res.device_part.forEach(item => { + item.shengyuTime = that.getDaysDifference(item.expiration_time) + item.parent = Math.round((Number(item.shengyuTime) / Number(item.availableDays) * 100)) + }) + + const first = res.device_part.findIndex(item => + item.parts_name.indexOf("PP棉滤芯") !== -1 + ); + if (first !== -1) { + const [removed] = res.device_part.splice(first, 1); // 移除该对象 + res.device_part.unshift(removed); // 插入到首位 + } + + const Second = res.device_part.findIndex(item => + item.parts_name.indexOf("PP+CB") !== -1 + ); + if (Second !== -1) { + const [removed] = res.device_part.splice(Second, 1); // 移除该对象 + res.device_part.splice(1, 0, removed); // 插入到第二位 + } + + const Third = res.device_part.findIndex(item => + item.parts_name.indexOf("RO") !== -1 + ); + if (Third !== -1) { + const [removed] = res.device_part.splice(Third, 1); // 移除该对象 + res.device_part.splice(2, 0, removed); // 插入到第二位 + } + + + const Fourth = res.device_part.findIndex(item => + item.parts_name.indexOf("后置活性炭") !== -1 + ); + if (Fourth !== -1) { + const [removed] = res.device_part.splice(Fourth, 1); // 移除该对象 + res.device_part.splice(3, 0, removed); // 插入到第二位 + } + } + that.setData({ + Info: res + }) + }) + }, + + getDaysDifference(targetDate) { + // 获取当前时间 + const now = new Date(); + // 将传递的时间转换为日期对象 + const target = new Date(targetDate); + // 计算时间差(以毫秒为单位) + const timeDiff = target.getTime() - now.getTime(); + // 将毫秒转换为天数 + const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); + return daysDiff; + }, + + + //开机 + Open() { + let that = this + util.postUrl2(apiArr.openOff, { + deviceId: that.data.Info.device_id, + onOff: 1 + }, res => { + if (res.data.params.sevice_status.value == '10') { + wx.showToast({ + title: '开机成功!', + icon: "none" + }) + that.getInfo() + } + }) + }, + //关机 + Close() { + let that = this + util.postUrl2(apiArr.openOff, { + deviceId: that.data.Info.device_id, + onOff: 2 + }, res => { + if (res.data.params.sevice_status.value == '00') { + wx.showToast({ + title: '关机成功!', + icon: "none" + }) + that.getInfo() + } + }) + }, + + // 拆机 + uninstall() { + let that = this + wx.showModal({ + title: '提示', + content: '请确保设备通电开机状态,该操作将取消设备激活状态', + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + that.setData({ + show: true + }) + } + } + }) + }, + createUninstall() { + wx.showLoading({ + title: '加载中...', + mask: true + }) + let that = this + util.postUrl(apiArr.UninstallOrder, { + device_id: that.data.Info.device_id, + remark: that.data.remarks1 + }, res => { + console.log(res); + wx.hideLoading() + wx.showToast({ + title: '拆机工单创建完成', + icon: "none" + }) + + setTimeout(()=>{ + wx.navigateTo({ + url: '/packages/partner/pages/removeOrder/removeOrder', + }) + },1500) + }) + }, + // 激活 + active() { + wx.showLoading({ + title: '加载中...', + mask: true + }) + let that = this + util.postUrl2(apiArr.deviceActive, { + device_id: that.data.Info.device_id + }, res => { + if (res.statusCode == 200) { + wx.showToast({ + title: '激活成功', + icon: "none" + }) + that.getInfo() + + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + wx.hideLoading() + }) + }, + //时长充值 + recharge1() { + let that = this + that.setData({ + show2: true + }) + }, + deviceDeactivation() { + let that = this + if(!that.isPureNumber(that.data.remainingDays)){ + return wx.showToast({ + title: '请输入正确到期日期', + icon:"none" + }) + } + wx.showModal({ + title: '提示', + content: '确定要充值时长吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + wx.showLoading({ + title: '加载中...', + mask: true + }) + util.postUrl2(apiArr.deviceDeactivation, { + device_id: that.data.Info.device_id, + remainingDays: that.data.remainingDays + }, res => { + wx.hideLoading() + if (res.statusCode == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show2: false, + remainingDays: "" + }) + }) + } + } + }) + }, + changeRemainingDay(e) { + console.log(e); + let that = this + that.setData({ + remainingDays: e.detail.value + }) + }, + //流量充值 + recharge2() { + let that = this + that.setData({ + show3: true + }) + }, + changeSurplusFlow(e) { + let that = this + that.setData({ + surplusFlow: e.detail.value + }) + }, + deviceDataForce() { + let that = this + + if(!that.isPureNumber(that.data.surplusFlow)){ + return wx.showToast({ + title: '请输入正确数额', + icon:"none" + }) + } + wx.showModal({ + title: '提示', + content: '确定要充值流量吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { + + } + + if (res.confirm) { + util.postUrl2(apiArr.deviceDataForce, { + device_id: that.data.Info.device_id, + surplusFlow: that.data.surplusFlow + }, res => { + wx.hideLoading() + if (res.statusCode == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show3: false, + surplusFlow: "" + }) + }) + } + } + }) + }, + + isPureNumber(value) { + return /^\d+(\.\d+)?$/.test(value); + }, + + onClose() { + this.setData({ + show: false, + show2: false, + show3: false + }) + }, + + remarksIpt1(e) { + console.log(e); + let that = this + that.setData({ + remarks1: e.detail.value + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let that = this + console.log(options); + that.setData({ + device_id: options.device_id + }) + that.getInfo() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxml b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxml new file mode 100644 index 0000000..7b8fe42 --- /dev/null +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxml @@ -0,0 +1,145 @@ + + + + + + + 设备编号:{{Info.device.device_code}} + + 设备型号 + {{Info.device.product_name}} + + + + 设备状态 + {{Info.device_net.active_status}} + + + 原水值 + {{Info.device_net.raw_water_value}} + + + 净水值 + {{Info.device_net.purification_water_value}} + + + 计费模式 + {{Info.device_net.billing_mode}} + + + 剩余流量 + {{Info.device.surplus_flow}} + + + 货贷总价 + 277天 + + + 累计过滤流量 + {{Info.device.accumulated_usage}}升 + + + 水质等级 + {{Info.device.purification_water_value}} + + + iccd + {{Info.device.device_iccid}} + + + 创建时间 + {{Info.device.create_time}} + + + + 开机 + + 关机 + 拆机 + 激活 + + 流量充值 + 时长充值 + + + + + 滤芯信息 + + {{item.parts_name}} + + 复位 + + + + + 机主信息 + + 姓名 + {{Info.device.customer_name}} + + + 微信昵称 + {{Info.device.customer_name}} + + + 手机号码 + {{Info.device.customer_phone}} + + + 地址 + {{Info.device.region + Info.device.address}} + + + + + + + + + 取消 + 确定 + + + 备注: + + + + + + + + + + 取消 + 确定 + + + 到期日期: + + + + + + + + + + + 取消 + 确定 + + + 设置数额: + + + + + \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxss b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxss new file mode 100644 index 0000000..60f6257 --- /dev/null +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc copy.wxss @@ -0,0 +1,214 @@ +page {} + +/* 容器样式 */ +.container { + display: flex; + flex-direction: column; + padding-bottom: 200rpx; +} + +/* 滑动 Tab 栏样式 */ +.tab-scroll { + white-space: nowrap; + /* 禁止换行 */ + background-color: #f7f8fa; + padding: 10px 0; +} + +.tab-item { + display: inline-block; + padding: 10px 20px; + font-size: 16px; + color: #333; +} + + +/* 内容区域样式 */ +.content-scroll { + white-space: nowrap; + /* 禁止换行 */ + height: 300px; + /* 设置内容区域高度 */ +} + +.content-item { + display: inline-block; + width: 100vw; + /* 每个内容项占满屏幕宽度 */ + height: 100%; + display: flex; + justify-content: center; + align-items: center; + font-size: 20px; + border-bottom: 1px solid #eee; +} + + +.tab-item.active { + font-weight: bold; + font-size: 32rpx; + color: #222222; + position: relative; +} + +.tab-item.active::after { + content: ''; + width: 127rpx; + height: 10rpx; + background: #2583FF; + position: absolute; + left: 50%; + transform: translateX(-50%); + bottom: 0; + +} + +.tab-item.active::before { + content: ''; + width: 127rpx; + height: 10rpx; + background: #FF5D73; + position: absolute; + left: 50%; + transform: translateX(-50%); + bottom: 0; +} + +.deviceInfo { + padding: 30rpx 20rpx; +} + +.deviceInfo_Tit { + font-weight: bold; + font-size: 32rpx; + color: #222222; + margin-bottom: 30rpx; +} + +.deviceInfo_Item { + display: flex; + align-items: flex-start; + margin-bottom: 20rpx; +} + +.deviceInfo_Item_ask { + font-weight: 400; + font-size: 26rpx; + color: #999999; + margin-right: 30rpx; + min-width: 110rpx; +} + +.deviceInfo_Item_con { + font-weight: 400; + font-size: 26rpx; + color: #222222; +} + +.btnList { + display: flex; + align-items: center; + margin-top: 40rpx; + color: #fff; + justify-content: space-between; + /* padding: 0 82rpx; */ +} + +.btn { + border-radius: 100rpx 100rpx 100rpx 100rpx; + display: flex; + align-items: center; + justify-content: center; + padding: 10rpx 40rpx; + white-space: nowrap; +} + +.btn1 { + background: #2583FF; +} + +.btn2 { + background: #999999; +} + +.btn3 { + background: #D5AC66; +} + +.btn4 { + background: #67C23A; +} + +.filter_Info { + padding: 30rpx 20rpx; +} + +.lifetime-progress { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 30rpx; +} + +.progress-name { + font-weight: 400; + font-size: 26rpx; + color: #999999; + width: 20%; + white-space: nowrap; +} + +.van-progress { + width: 366rpx; + margin-right: 19rpx; + margin-top: 10rpx; +} + +.progress { + font-weight: 400; + font-size: 26rpx; + color: #FFFFFF; + width: 90rpx; + height: 36rpx; + background: #2583FF; + border-radius: 100rpx 100rpx 100rpx 100rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.owner { + padding: 30rpx 20rpx; +} + +.row { + padding-top: 30rpx; + height: 300rpx; + overflow: hidden; + overflow-y: auto; + padding: 30rpx; + box-sizing: border-box; + font-size: 30rpx; + display: flex; + color: #606266; +} +.row_label{ + margin-right: 20rpx; + white-space: nowrap; +} + +.row_con{ + flex: 1; +} +.row_con textarea{ + height: 100% !important; +} +.tit { + display: flex; + align-items: center; + justify-content: space-between; + font-size: 32rpx; + padding-right: 30rpx; + padding-left: 30rpx; + padding-top: 20rpx; +} \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js index 631b34f..7e3de02 100644 --- a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js @@ -1,137 +1,802 @@ -let util = require("../../../../../utils/util") -const apiArr = require('../../../../../api/water_filter') -// packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.js +let util = require('../../../../../utils/util') +let apiArr = require('../../../../../api/water_filter') +import * as echarts from '../../../../../component/ec-canvas/echarts'; + +// packages/master/deviceInfo/index.js Page({ - /** - * 页面的初始数据 - */ - data: { - progress_List: [{ - "name": "HXTH滤芯", - "progress": 97.41 - }, - { - "name": "RO膜滤芯", - "progress": 87.41 - }, - { - "name": "PP+CB滤芯", - "progress": 40.41 - }, - { - "name": "PP棉滤芯", - "progress": 90.41 - } - ], - device_id:"", - Info:{}, - }, + /** + * 页面的初始数据 + */ + data: { + id: "", + currentDevice: "", + imagePath: "", + ec: { + onInit: initChart + }, - getInfo(){ - let that= this - util.postUrl(apiArr.deviceDesc,{ - device_id:Number(that.data.device_id) - },res=>{ - console.log(res); - res.device_part.forEach(item=>{ - item.shengyuTime = that.getDaysDifference(item.expiration_time) - item.parent = Math.round((Number(item.shengyuTime) / Number(item.availableDays)*100)) - }) + appointment_time: "", + show: false, + show2: false, + show3: false, + show4: false, + show5: false, + show6: false, + remarks1: "", //拆机备注 + remainingDays: "",//到期日期 + surplusFlow: "",//剩余流量 + remaining_days: "",//转时长 + surplus_flow: "",//转流量 + minDate: new Date().getTime(), + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }, + }, + onInput(event) { + let that = this + const date = new Date(event.detail); // 获取选中的 Date 对象 + const year = date.getFullYear(); // 获取年份 + const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1 + 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}`; that.setData({ - Info:res + appointment_time: time, + show: false }) - }) - }, - getDaysDifference(targetDate) { - // 获取当前时间 - const now = new Date(); - // 将传递的时间转换为日期对象 - const target = new Date(targetDate); - // 计算时间差(以毫秒为单位) - const timeDiff = target.getTime() - now.getTime(); - // 将毫秒转换为天数 - const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); - return daysDiff; - }, + that.cancelActivation() + }, + onClose() { + let that = this + that.setData({ + show: false + }) + }, + formatPercentage(value) { + return Math.max(0, Number((value || 0).toFixed(0))); + }, + getInfo() { + let that = this + console.log(that, 'ssss'); + util.postUrl(apiArr.deviceInfo, { + device_id: that.data.id + }, res => { + res.remainDay = Math.max(0, that.getDaysBetweenDates2(res.expiration_duration)) //剩余天数 + if (res.expiration_duration) { + res.difDay = Math.max(0, that.getDaysBetweenDates(res.install_time)) //服务天数,确保不小于0 + } else { + const installDate = new Date(res.install_time) + const expireDate = new Date(res.expiration_duration) + res.difDay = Math.max(0, Math.floor((expireDate - installDate) / (1000 * 60 * 60 * 24))) //确保不小于0 + } + + if (res.device_part) { + res.device_part.forEach(item => { + item.difDay = that.getDaysBetweenDates(item.start_time) + const remainingDays = Math.max(0, (item.available_days || 0) - (item.difDay || 0)); + + item.percentageDay = that.formatPercentage( + (remainingDays / (item.available_days || 1)) * 100 + ); + item.percentageCapacity = that.formatPercentage( + (1 - (item.threshold_volume || 0) / (item.available_volume || 1)) * 100 + ); + }) + + const first = res.device_part.findIndex(item => + item.parts_name.indexOf("PP棉滤芯") !== -1 + ); + if (first !== -1) { + const [removed] = res.device_part.splice(first, 1); // 移除该对象 + res.device_part.unshift(removed); // 插入到首位 + } + const Second = res.device_part.findIndex(item => + item.parts_name.indexOf("PP+CB") !== -1 + ); + if (Second !== -1) { + const [removed] = res.device_part.splice(Second, 1); // 移除该对象 + res.device_part.splice(1, 0, removed); // 插入到第二位 + } + const Third = res.device_part.findIndex(item => + item.parts_name.indexOf("RO") !== -1 + ); + if (Third !== -1) { + const [removed] = res.device_part.splice(Third, 1); // 移除该对象 + res.device_part.splice(2, 0, removed); // 插入到第二位 + } + const Fourth = res.device_part.findIndex(item => + item.parts_name.indexOf("后置活性炭") !== -1 + ); + if (Fourth !== -1) { + const [removed] = res.device_part.splice(Fourth, 1); // 移除该对象 + res.device_part.splice(3, 0, removed); // 插入到第二位 + } + } + res.today = Number(res.today).toFixed(2) + res.yesterday = Number(res.yesterday).toFixed(2) + + that.setData({ + currentDevice: res + }) + let Xarr = []; + let Yarr = []; + res.device_net.forEach(item => { + Xarr.push(item.create_time.slice(11, 16)) + Yarr.push((item.cumulative_filtration_flow).toFixed(1)) + }) + that.updateChart({ + xAxis: Xarr, + series: Yarr + }) + that.getDeriveInfo() + setTimeout(() => { + const ecComponent = that.selectComponent("#mychart-dom-bar") + // 将 canvas 内容转换为临时图片文件 + ecComponent.canvasToTempFilePath({ + // canvasId: 'mychart-dom-bar', + success: (result) => { + that.base64({ + url: result.tempFilePath, + type: 'png', + }).then((res) => { + that.setData({ + imagePath: res + }) + }) + }, + fail: (err) => { + console.error('转换失败:', err); + } + }); + }, 2000) + + }) + }, + replay(e) { + wx.showLoading({ + title: '重置中...', + }) + util.postUrl4(apiArr.resetFilter, { + part_id: e.currentTarget.dataset.item.id, + device_id: e.currentTarget.dataset.item.device_id, + }, res => { + wx.hideLoading() + console.log(res); + if (res.msg == '操作成功') { + wx.showToast({ + title: '重置成功!', + icon: "none" + }) + that.getfilterList() + } else { + wx.showToast({ + title: res.msg, + icon: "none" + }) + } + }) + }, - //开机 - Open(){ - let that = this - util.postUrl(apiArr) - }, - //关机 - Close(){ - let that = this - util.postUrl(apiArr) - }, -// 强冲 - QC(){ - let that = this - util.postUrl(apiArr) - }, + //查询设备实时信息 + getDeriveInfo() { + let that = this + util.postUrl4(apiArr.boardInfo, { + device_id: that.data.currentDevice.device_id + }, res => { + console.log(res); + }) + }, + ///////////////////////////////////////////////新增///////////////////////////////////////////////////////////////////////// + onClose2() { + this.setData({ + show2: false, + show3: false, + show4: false, + show5: false, + show6: false, + }) + }, + // 拆机 + uninstall() { + let that = this + wx.showModal({ + title: '提示', + content: '请确保设备通电开机状态,该操作将取消设备激活状态', + complete: (res) => { + if (res.cancel) { - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let that = this - console.log(options); - that.setData({ - device_id:options.device_id - }) - that.getInfo() - }, + } - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { + if (res.confirm) { + that.setData({ + show2: true + }) + } + } + }) + }, + remarksIpt1(e) { + console.log(e); + let that = this + that.setData({ + remarks1: e.detail.value + }) + }, + createUninstall() { + wx.showLoading({ + title: '加载中...', + mask: true + }) + let that = this + util.postUrl(apiArr.createUninstallOrder, { + device_id: that.data.currentDevice.device_id, + info_id:wx.getStorageSync('info_id'), + remark: that.data.remarks1 + }, res => { + console.log(res); + wx.hideLoading() + wx.showToast({ + title: '拆机工单创建完成', + icon: "none" + }) - }, + setTimeout(() => { + wx.navigateTo({ + url: '/packages/master/order/index?type=3', + }) + }, 1500) + }) + }, + // 激活 + active() { + wx.showLoading({ + title: '加载中...', + mask: true + }) + let that = this + util.postUrl4(apiArr.deviceActive, { + device_id: that.data.currentDevice.device_id + }, res => { + console.log(res); + wx.showToast({ + title: res.msg, + icon: "none" + }) + that.getInfo() + wx.hideLoading() - /** - * 生命周期函数--监听页面显示 - */ - onShow() { + return + if (res.statusCode == 200) { + wx.showToast({ + title: '激活成功', + icon: "none" + }) + that.getInfo() - }, + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + wx.hideLoading() + }) + }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - }, + isPureNumber(value) { + return /^\d+(\.\d+)?$/.test(value); + }, + //时长充值 + recharge1() { + let that = this + that.setData({ + show4: true + }) + }, + deviceDeactivation() { + let that = this + if (!that.isPureNumber(that.data.remainingDays)) { + return wx.showToast({ + title: '请输入正确到期日期', + icon: "none" + }) + } + wx.showModal({ + title: '提示', + content: '确定要充值时长吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { + } - }, + if (res.confirm) { + wx.showLoading({ + title: '加载中...', + mask: true + }) + util.postUrl4(apiArr.deviceDeactivation, { + device_id: that.data.currentDevice.device_id, + remainingDays: that.data.remainingDays + }, res => { + wx.hideLoading() + if (res.data.code == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show4: false, + remainingDays: "" + }) + }) + } + } + }) + }, + changeRemainingDay(e) { + console.log(e); + let that = this + that.setData({ + remainingDays: e.detail.value + }) + }, + //流量充值 + recharge2() { + let that = this + that.setData({ + show3: true + }) + }, + changeSurplusFlow(e) { + let that = this + that.setData({ + surplusFlow: e.detail.value + }) + }, + deviceDataForce() { + let that = this + if (!that.isPureNumber(that.data.surplusFlow)) { + return wx.showToast({ + title: '请输入正确数额', + icon: "none" + }) + } + wx.showModal({ + title: '提示', + content: '确定要充值流量吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { + } - }, + if (res.confirm) { + util.postUrl4(apiArr.deviceDataForce, { + device_id: that.data.currentDevice.device_id, + surplusFlow: that.data.surplusFlow + }, res => { + if (res.data.code == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show3: false, + surplusFlow: "" + }) + }) + } + } + }) + }, + //转时长 + timeSet() { + let that = this + that.setData({ + show5: true + }) + }, + changeRemainingDay2(e) { + console.log(e); + let that = this + that.setData({ + remaining_days: e.detail.value + }) + }, + modeToTime() { + let that = this + if (!that.data.remaining_days) { + return wx.showToast({ + title: '请输入到期日期', + }) + } + wx.showModal({ + title: '提示', + content: '确定要将设备转时长吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { + } + if (res.confirm) { + util.postUrl4(apiArr.deviceToTime, { + device_id: that.data.currentDevice.device_id, + remaining_days: that.data.remaining_days + }, res => { + if (res.data.code == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show5: false, + remaining_days: "" + }) + }) + } + } + }) + }, + // 转流量 + timeSet2() { + let that = this + that.setData({ + show6: true + }) + }, + changeRemainingDay3(e) { + console.log(e); + let that = this + that.setData({ + surplus_flow: e.detail.value + }) + }, + modeToFlowRate() { + let that = this + if (!that.data.surplus_flow) { + return wx.showToast({ + title: '请输入数额', + }) + } + wx.showModal({ + title: '提示', + content: '确定要设备转流量吗?请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { + } + if (res.confirm) { + util.postUrl4(apiArr.deviceToTraffic, { + device_id: that.data.currentDevice.device_id, + surplus_flow: that.data.surplus_flow + }, res => { + if (res.data.code == 200) { + wx.showToast({ + title: '充值成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + that.setData({ + show6: false, + surplus_flow: "" + }) + }) + } + } + }) - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - }, + }, + // 转零售 + retailSet() { + let that = this + wx.showModal({ + title: '提示', + content: '是否确认设置为零售模式?此操作请在设备通电开机的状态下进行操作', + complete: (res) => { + if (res.cancel) { - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { + } - } -}) \ No newline at end of file + if (res.confirm) { + util.postUrl4(apiArr.deviceToRetail, { + device_id: that.data.currentDevice.device_id + }, res => { + if (res.data.code == 200) { + wx.showToast({ + title: '设置成功', + icon: "none" + }) + that.getInfo() + } else { + wx.showToast({ + title: res.data.msg, + icon: "none" + }) + } + }) + } + } + }) + }, + + ///////////////////////////////////////////////新增///////////////////////////////////////////////////////////////////////// + //开关机 + openOff() { + let that = this + let onOff = '' + + if (that.data.currentDevice.sevice_status == 1) { + onOff = 2 + } else if (that.data.currentDevice.sevice_status == 2) { + onOff = 1 + } + + wx.showLoading({ + title: '操作中...', + mask: true + }) + + util.postUrl(apiArr.openOff, { + deviceId: that.data.currentDevice.device_id, + onOff + }, res => { + wx.hideLoading() + console.log(res); + if (res.msg == '操作成功') { + if (res.data.params.sevice_status.value == '00') { + wx.hideLoading() + wx.showToast({ + title: '关机成功!', + icon: "none" + }) + that.setData({ + "currentDevice.sevice_status": 2 + }) + console.log('关机'); + } else if (res.data.params.sevice_status.value == '10') { + wx.hideLoading() + wx.showToast({ + title: '开机成功!', + icon: "none" + }) + that.setData({ + "currentDevice.sevice_status": 1 + }) + console.log('开机'); + } + } + }) + }, + + updateChart(data) { + const ecComponent = this.selectComponent("#mychart-dom-bar"); + if (!ecComponent) return; + + this.setData({ + chartData: data + }); + + ecComponent.init((canvas, width, height, dpr) => { + const chart = initChart(canvas, width, height, dpr); + chart.setOption({ + grid: { + left: '3%', // 左边距 + right: '4%', // 右边距 + bottom: '3%', // 底部边距 + containLabel: true // 确保标签包含在内 + }, + xAxis: { + data: data.xAxis + }, + series: [{ + data: data.series, + label: { // 添加这个label配置 + show: true, // 开启显示 + position: 'top', // 位置在柱子上方 + color: '#333', // 文字颜色 + // fontSize: 8 // 文字大小 + } + }] + }); + return chart; + }); + }, + + base64({ url, type }) { + return new Promise((resolve, reject) => { + wx.getFileSystemManager().readFile({ + filePath: url, //选择图片返回的相对路径 + encoding: 'base64', //编码格式 + success: res => { + resolve('data:image/' + type.toLocaleLowerCase() + ';base64,' + res.data) + }, + fail: res => reject(res.errMsg) + }) + }) + }, + convertCanvasToImage() { + wx.canvasToTempFilePath({ + canvasId: 'myChart', + success: (res) => { + console.log(res.tempFilePath); + this.setData({ + imagePath: res.tempFilePath + }); + }, + fail: (err) => { + console.error('Canvas to image failed:', err); + } + }); + }, + getDaysBetweenDates(inputDate) { + const currentDate = new Date(); + // 将传入的日期字符串转换为日期对象 + const targetDate = new Date(inputDate); + // 计算两个日期之间的时间差(以毫秒为单位) + const timeDifference = currentDate - targetDate; + // 将时间差转换为天数 + const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); + // 返回天数 + return daysDifference; + }, + getDaysBetweenDates2(targetDate) { + // 获取当前日期(不含时间) + const today = new Date(); + today.setHours(0, 0, 0, 0); // 时间归零,避免时间差影响 + // 解析目标日期(格式:YYYY-MM-DD) + const target = new Date(targetDate); + target.setHours(0, 0, 0, 0); + // 计算毫秒差并转换为天数 + const timeDiff = target - today; + const daysRemaining = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); + return daysRemaining; + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let that = this + that.setData({ + id: options.device_id + }) + that.getInfo() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + let that = this + setTimeout(() => { + this.convertCanvasToImage() + }, 5000) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) + +function initChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // 将此选项设置为 2,可以在高分辨率屏幕上绘制更清晰的图表 + }); + canvas.setChart(chart); + const option = { + xAxis: { + type: 'category', + // data: ['16:41', '22:41', '04:41', '10:41', '16:41'], + data: [] + }, + yAxis: { + type: 'value', + // data: ['0ml', '560ml'] + min: 0, + axisLabel: { + formatter: '{value}ml' + } + }, + series: [{ + // data: [150, 230, 224, 218, 135, 147, 345], + data: [], + type: 'bar', + barWidth: 15, + itemStyle: { //柱状颜色和圆角 + color: { + x: 0, + y: 1, + colorStops: [{ + offset: 0, + color: '#FFBBAC', + }, { + offset: 1, + color: '#338BFF' + }] + }, + barBorderRadius: [5, 5, 0, 0], // (顺时针左上,右上,右下,左下) + }, + }] + }; + chart.setOption(option); + return chart; +} \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.json b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.json index 71aff8b..719aba1 100644 --- a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.json +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.json @@ -1,4 +1,6 @@ { - "usingComponents": {}, + "usingComponents": { + "ec-canvas": "/component/ec-canvas/ec-canvas" + }, "navigationBarTitleText": "设备详情" } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxml b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxml index 8bd13e3..0cf3d96 100644 --- a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxml +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxml @@ -1,97 +1,209 @@ - - - + + + + + + + + {{currentDevice.region + currentDevice.address}} + - --> + + + + + + 净化前 + 水质TDS值 + {{currentDevice.raw_water_value}} + PPM + + + + + + + 净化后 + 水质TDS值 + {{currentDevice.purification_water_value}} + PPM + + + + + + + 净化前水质:极好 + 净化前水质:良好 + 净化前水质:正常 + 净化前水质:较差 + 净化前水质:极差 + + + 净化后水质:极好 + 净化后水质:良好 + 净化后水质:正常 + 净化后水质:较差 + 净化后水质:极差 + + + + + + + + + + 我的设备 + + {{currentDevice.product_name}} + + + + + 开机 + 关机 + 制水故障 + 漏水故障 + 主板故障 - - 设备编号:{{Info.device.device_code}} - - 设备型号 - {{Info.device.product_name}} + + + {{currentDevice.network_status == '1'?'在线':'离线'}} + + + + + + 编号:{{currentDevice.device_code}} + + + 已服务{{currentDevice.difDay}} + + + + 已服务0 + + + + + + 剩余天数 + {{ currentDevice.remainDay}} + + + + + 已欠费 + + + + + + 剩余天数 + 0 + + + + + + + + + + + 滤芯寿命 + 滤芯寿命用水量和使用时间来综合计算 + + + + + + {{item.parts_name}} + + + + + + {{item.percentageDay}}% + + + + {{item.percentageCapacity}}% + + + + + {{item.percentageDay}}% + + + + + 重置 + + + + + + + + + + 用水量 + + + + + 累计用水量 + {{currentDevice.cumulative_filtration_flow}}L + + + 今日用水量 + {{currentDevice.today}}L + + + 昨日用水量 + {{currentDevice.yesterday}}L + + + + + + + + + + + - - - 设备状态 - {{Info.device_net.active_status}} - - - 原水值 - {{Info.device_net.raw_water_value}} - - - 净水值 - {{Info.device_net.purification_water_value}} - - - 计费模式 - {{Info.device_net.billing_mode}} - - - 剩余流量 - {{Info.device.surplus_flow}} - - - 货贷总价 - 277天 - - - 累计过滤流量 - {{Info.device.accumulated_usage}}升 - - - 水质等级 - {{Info.device.purification_water_value}} - - - iccd - {{Info.device.device_iccid}} - - - 创建时间 - {{Info.device.create_time}} - - - 开机 - 关机 - 强冲 - - - - - 滤芯信息 - - {{item.parts_name}} - - 复位 - - - - - 机主信息 - - 姓名 - {{Info.device.customer_name}} - - - 微信昵称 - {{Info.device.customer_name}} - - - 手机号码 - {{Info.device.customer_phone}} - - - 地址 - {{Info.device.region + Info.device.address}} - - + - \ No newline at end of file + + + 拆机 + + + + + + + + + + + + + 取消 + 确定 + + + 备注: + + + + + + diff --git a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxss b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxss index 0ad9d8e..41c7281 100644 --- a/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxss +++ b/packages/WaterPurifier/pages/device/deviceDesc/deviceDesc.wxss @@ -1,180 +1,741 @@ -page{ +.nav-box { + box-sizing: border-box; + width: 100%; + position: relative; + /* position: fixed; */ + z-index: 2; } -/* 容器样式 */ -.container { +.nav-box .nav-bar { display: flex; - flex-direction: column; - padding-bottom: 200rpx; + align-items: center; } -/* 滑动 Tab 栏样式 */ -.tab-scroll { - white-space: nowrap; - /* 禁止换行 */ - background-color: #f7f8fa; - padding: 10px 0; +.nav-box .nav-bar .nav-bar-left, +.nav-box .nav-bar .nav-bar-right { + padding: 0 20rpx; + min-width: 36rpx; } -.tab-item { - display: inline-block; - padding: 10px 20px; - font-size: 16px; - color: #333; +.nav-box .nav-bar .nav-bar-left van-icon { + vertical-align: sub; + color: #333333; +} + +.nav-box .nav-bar .nav-bar-title { + flex: 1; + text-align: center; + font-weight: 400; + font-size: 36rpx; + color: #FFFFFF; +} + +.nav-box .nav-bar-title { + color: red; + margin-left: -20rpx; } -/* 内容区域样式 */ -.content-scroll { - white-space: nowrap; - /* 禁止换行 */ - height: 300px; - /* 设置内容区域高度 */ -} - -.content-item { - display: inline-block; +.water-filter { width: 100vw; - /* 每个内容项占满屏幕宽度 */ - height: 100%; + overflow: hidden; +} + +.nowrap { + white-space: nowrap; +} + +.top { + background-color: #FFFFFF; + +} + +/* 位置定位 */ +.positioning { + display: flex; + margin-left: 24rpx; + padding-top: 40rpx; + margin-right: 20rpx; + margin-bottom: 64rpx; + justify-content: space-between; +} + +.positioning-left { + display: flex; + align-items: center; + overflow: hidden; +} + +.positioning-right { + display: flex; + align-items: center; +} + +.positioning-icon-left { + width: 33rpx; + height: 33rpx; +} + +.positioning-text { + font-size: 26rpx; + color: #FFFFFF; + margin-left: 9rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.positioning-icon-right { + width: 24rpx; + height: 24rpx; +} + +/* 净化前后数值 */ +.purification-value { + display: flex; + margin-left: 114rpx; +} + +.purification-value-left { + display: inline; + width: 210rpx; + height: 250rpx; +} + +.purification-value-right { + margin-left: 116rpx; +} + +.purification-value-icon { + width: 210rpx; + height: 250rpx; + position: absolute; +} + +.purification-value-text { + position: absolute; + margin: 60rpx 42rpx 0 41rpx; +} + +.puri-text { display: flex; justify-content: center; - align-items: center; - font-size: 20px; - border-bottom: 1px solid #eee; -} - - -.tab-item.active { - font-weight: bold; - font-size: 32rpx; - color: #222222; - position: relative; -} - -.tab-item.active::after { - content: ''; - width: 127rpx; - height: 10rpx; - background: #2583FF; - position: absolute; - left: 50%; - transform: translateX(-50%); - bottom: 0; - -} - -.tab-item.active::before { - content: ''; - width: 127rpx; - height: 10rpx; - background: #FF5D73; - position: absolute; - left: 50%; - transform: translateX(-50%); - bottom: 0; -} - -.deviceInfo { - padding: 30rpx 20rpx; -} - -.deviceInfo_Tit { - font-weight: bold; - font-size: 32rpx; - color: #222222; - margin-bottom: 30rpx; -} - -.deviceInfo_Item { - display: flex; - align-items: flex-start; - margin-bottom: 20rpx; -} - -.deviceInfo_Item_ask { - font-weight: 400; + color: #FFFFFF; font-size: 26rpx; - color: #999999; - margin-right: 30rpx; - min-width: 110rpx; } -.deviceInfo_Item_con { - font-weight: 400; - font-size: 26rpx; - color: #222222; +.tds { + opacity: 0.5; } -.btnList { +.tds-value { + font-size: 50rpx; +} + +/* 净化前后水质 */ +.water-quality { + margin-left: 80rpx; + margin-top: 23rpx; +} + +.water-quality2 { display: flex; - align-items: center; - margin-top: 40rpx; - color: #fff; - justify-content: space-between; - padding: 0 82rpx; + margin: 0 80rpx; + margin-top: 10rpx; } -.btn { +.water-quality2 .water-quality-left { + flex: 1; + display: flex; + text-align: center; + height: auto; + background: transparent; +} + +.water-quality2 .water-quality-text { width: 150rpx; height: 50rpx; + background: #fff; border-radius: 100rpx 100rpx 100rpx 100rpx; + color: #2583FF; + display: block; + line-height: 50rpx; +} + +.water-quality-left { + display: inline; + width: 265rpx; + height: 50rpx; + padding: 10rpx 38rpx 10rpx 30rpx; + justify-content: center; + align-items: center; + border-radius: 20rpx; + background: linear-gradient(to right, #2583FF1a, #2583FF); +} + +.water-quality-text { + font-size: 26rpx; + color: #FFFFFF; +} + +/* 我的设备 */ +.my-device { + background-color: #FFFFFF; + /* margin: 0 24rpx 0 20rpx; */ + /* padding-bottom: 30rpx; */ +} + +.mydevice { + font-size: 28rpx; + display: flex; + margin-bottom: 23rpx; +} + +.text-color { + color: #999999; +} + +.replayBtn { + width: 120rpx; + height: 50rpx; display: flex; align-items: center; justify-content: center; + background-color: #2887ff; + color: #fff; + border-radius: 30rpx; + margin-left: 20rpx; } -.btn1 { - background: #2583FF; +.day-num2 { + color: #ff0000da; + font-size: 36rpx; + font-weight: bold; + margin: 0 7rpx 0 8rpx; } -.btn2 { - background: #999999; +.device-info { + margin: 0 24rpx 0 20rpx; } -.btn3 { - background: #D5AC66; +.info-top { + display: flex; + justify-content: space-between; } -.filter_Info { +.device-name { + font-size: 36rpx; + color: #222222; + font-weight: bold; +} + +.device-state { + display: flex; + align-items: center; +} + +.switch-icon { + width: 28rpx; + height: 28rpx; +} + +.switch-text { + margin-right: 31rpx; + margin-left: 10rpx; +} + +.wifi-text { + margin-left: 10rpx; +} + +.text-size { + font-size: 26rpx; +} + +.wifi-icon { + width: 30rpx; + height: 22rpx; +} + +.info-bottom { + display: flex; + margin-top: 22rpx; + justify-content: space-between; + align-items: center; +} + +.device-id { + color: #2583FF; + /* display: inline; */ +} + +.service-day { + /* display: inline; */ + /* float: right; */ +} + +.day-num { + color: #2583FF; + font-size: 36rpx; + font-weight: bold; + margin: 0 7rpx 0 8rpx; +} + +.day { + color: #222222; +} + +/* 购买滤芯和报修记录 */ +.van-row { + padding: 0 20rpx !important; +} + +.van-col { + display: flex; + background-color: #FFF0ED; + height: 150rpx; + border-radius: 30rpx; + align-items: center; + font-size: 28rpx; + font-weight: bold; +} + +.purchase { + width: 100rpx; + height: 100rpx; + margin-left: 68rpx; +} + +/* 功能列表 */ +.van-grid { + margin-top: 20rpx; + background-color: #FFFFFF; +} + +.van-icon__image { + width: 100rpx !important; + height: 100rpx !important; +} + +.van-icon--image { + width: 100rpx !important; + height: 100rpx !important; +} + + +.van-grid-item__text { + font-size: 26rpx !important; + color: #222222 !important; +} + +/* 滤芯寿命 */ +.lifetime { + margin-top: 20rpx; + background-color: #FFFFFF; padding: 30rpx 20rpx; } +.lifetime-title { + font-size: 28rpx; + font-weight: bold; + color: #000000; +} + +.lifetime-prompt { + font-size: 24rpx; + color: #999999; + margin-top: 20rpx; + margin-bottom: 25rpx; +} + .lifetime-progress { + margin-top: 10rpx; display: flex; align-items: center; justify-content: space-between; - margin-bottom: 30rpx; } .progress-name { - font-weight: 400; - font-size: 26rpx; - color: #999999; - width: 20%; white-space: nowrap; + /* width: 24%; */ + overflow: hidden; + white-space: nowrap; + font-size: 26rpx; + display: flex; + justify-content: space-between; + padding-top: 10rpx; } .van-progress { - width: 366rpx; + width: 100%; margin-right: 19rpx; margin-top: 10rpx; } .progress { + color: #000000; + font-size: 24rpx; +} + +.contral3 { + display: flex; + flex-direction: column; +} + +.equi-contral-right2 { + margin-top: 20rpx; +} + +/* 用水量 */ +.water-consumption { + background-color: #FFFFFF; + margin-top: 20rpx; + padding: 30rpx 24rpx 0 20rpx; +} + +.water-consumption-title { + font-size: 28rpx; + font-weight: bold; + margin-bottom: 30rpx; +} + +.row-index--van-row { + margin: 0 !important; +} + +.van-col--8 { + display: inline; + height: 130rpx !important; + width: 220rpx !important; + margin-right: 5rpx; +} + +.water-consumption-col-name { + font-size: 24rpx; + font-weight: normal; + color: #000000; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + margin-top: 12rpx; + margin-bottom: 16rpx; +} + +.water-consumption-col-num { + text-align: center; + font-size: 38rpx; + font-weight: bold; + color: #2583FF; +} + +.water-consumption-col-num-size { + font-size: 24rpx; + font-weight: normal; +} + +.container { + width: 100%; + height: 600rpx; + padding-bottom: 100rpx; + position: relative; + +} + +.container canvas { + position: absolute; + right: -100vw; + top: 0; +} + +#mychart-bar { + border-radius: 30rpx 30rpx 0 0; +} + +.chart { + display: flex; + align-items: flex-end; + height: 300px; +} + +.bar { + width: 20px; + margin: 0 5px; + background-color: blue; + border-radius: 30rpx 30rpx 0 0; +} + + + + + +.water-consumption-row { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0; + margin: 0 24rpx; +} + +.water-consumption-col { + width: 220rpx; + height: 112rpx; + background: linear-gradient(180deg, #F0F4FF 0%, #DEE7FF 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + box-sizing: border-box; +} + +.water-consumption-row .col2 { + background: linear-gradient(180deg, #FFFBD8 0%, #FFEBB8 100%); + margin: 0 20rpx; +} + +.water-consumption-row .col3 { + background: linear-gradient(180deg, #ECECEC 0%, #E5E4E4 100%); +} + +.water-consumption-col .water-consumption-col-name { font-weight: 400; - font-size: 26rpx; - color: #FFFFFF; - width: 90rpx; - height: 36rpx; + font-size: 24rpx; + color: #000000; +} + +.water-consumption-col .water-consumption-col-num { + font-weight: bold; + font-size: 36rpx; + color: #2583FF; +} + +.equi-contral { + display: flex; + align-items: center; + justify-content: space-between; + margin-left: 20rpx; + margin-right: 20rpx; +} + +.equi-contral2 .equi-contral-right { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; +} + +.equi-contral2 .equi-contral-right .equi-contral-right-btn2 { + margin-top: 0; + width: 335rpx; +} + +.equi-contral2 .equi-contral-right .equi-contral-right-btn1 { + margin-top: 0; + width: 335rpx; +} + +.equi-contral-left { + position: relative; + width: 345rpx; + height: 320rpx; + background: #FFF0ED; + border-radius: 30rpx 30rpx 30rpx 30rpx; + font-weight: bold; + font-size: 28rpx; + color: #000000; + box-sizing: border-box; + padding-top: 58rpx; + padding-left: 28rpx; +} + +.equi-contral-left #img1 { + width: 219.21rpx; + height: 175rpx; + position: absolute; + left: 116rpx; + bottom: 5rpx; +} + +.equi-contral-left #img2 { + width: 119rpx; + height: 95rpx; + position: absolute; + bottom: 32rpx; + left: 180rpx; +} + +.van-grid-item__text text { + white-space: nowrap; +} + +.equi-contral-right { + /* justify-content: center !important; */ +} + +.equi-contral-right-btn1 { + width: 345rpx; + height: 150rpx; + background: linear-gradient(180deg, #FFFBD8 0%, #FFEBB8 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + font-weight: bold; + font-size: 28rpx; + color: #000000; + display: flex; + align-items: center; + justify-content: space-between; + padding-left: 30rpx; + padding-right: 30rpx; + box-sizing: border-box; +} + +.equi-contral-right-btn1 image { + width: 100rpx; + height: 100rpx; +} + +.equi-contral-right-btn2 { + width: 345rpx; + height: 150rpx; + background: linear-gradient(180deg, #ECECEC 0%, #E5E4E4 100%); + border-radius: 20rpx 20rpx 20rpx 20rpx; + margin-top: 23rpx; + position: relative; + box-sizing: border-box; + font-weight: bold; + font-size: 28rpx; + color: #000000; + display: flex; + align-items: center; + justify-content: space-between; + padding-left: 30rpx; + padding-right: 30rpx; + box-sizing: border-box; +} + +.equi-contral-right-btn2 image { + width: 100rpx; + height: 100rpx; +} + + +.foot-fixed { + z-index: 999999999999 !important; +} + +.btnDevice { + width: 650rpx; + height: 80rpx; background: #2583FF; border-radius: 100rpx 100rpx 100rpx 100rpx; display: flex; align-items: center; justify-content: center; + margin: 0 auto; + margin-top: 300rpx; + font-weight: 400; + font-size: 36rpx; + color: #FFFFFF; } -.owner{ - padding: 30rpx 20rpx; +.deleteBtn { + width: 710rpx; + height: 100rpx; + background-color: #dd0000; + color: #fff; + border-radius: 20rpx; + font-size: 34rpx; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto; + margin-top: 40rpx; +} + +.btn3 { + background: #D5AC66; + width: 710rpx; + height: 100rpx; + color: #fff; + border-radius: 20rpx; + font-size: 34rpx; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto; + margin-top: 40rpx; +} + +.btn4 { + background: #67C23A; + width: 710rpx; + height: 100rpx; + color: #fff; + border-radius: 20rpx; + font-size: 34rpx; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto; + margin-top: 40rpx; +} +.btn5{ + background-color: #909399; + width: 710rpx; + height: 100rpx; + color: #fff; + border-radius: 20rpx; + font-size: 34rpx; + font-weight: 700; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto; + margin-top: 40rpx; +} + +.row { + padding-top: 30rpx; + height: 300rpx; + overflow: hidden; + overflow-y: auto; + padding: 30rpx; + box-sizing: border-box; + font-size: 30rpx; + display: flex; + color: #606266; +} + +.row2 { + padding-top: 30rpx; + overflow: hidden; + overflow-y: auto; + padding: 30rpx; + padding-bottom: 0; + box-sizing: border-box; + font-size: 30rpx; + display: flex; + color: #606266; +} +.row_label { + margin-right: 20rpx; + white-space: nowrap; +} + +.row_con { + flex: 1; +} + +.row_con textarea { + height: 100% !important; +} + +.tit { + display: flex; + align-items: center; + justify-content: space-between; + font-size: 32rpx; + padding-right: 30rpx; + padding-left: 30rpx; + padding-top: 20rpx; } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceList/deviceList.js b/packages/WaterPurifier/pages/device/deviceList/deviceList.js index 0e0d34a..979b444 100644 --- a/packages/WaterPurifier/pages/device/deviceList/deviceList.js +++ b/packages/WaterPurifier/pages/device/deviceList/deviceList.js @@ -12,37 +12,32 @@ Page({ option1: [ { text: '全部', value: 0 }, { text: '已安装', value: 1 }, - { text: '空闲', value: 2 }, + { text: '待启用', value: 2 }, { text: '已拆机', value: 3 }, ], option2: [ { text: '全部', value: 0 }, - { text: '正常', value: 1 }, - { text: '报废', value: 2 }, - { text: '待启用', value: 3 }, + { text: '在用', value: 1 }, + { text: '待启用', value: 2 }, + { text: '关机', value: 3 }, { text: '已拆机', value: 4 }, { text: '漏水', value: 5 }, - { text: '制水故障', value: 6 }, - { text: '关机', value: 7 }, - { text: '已欠费', value: 8 }, - { text: '在库', value: 9 }, - { text: '激活失败', value: 10 }, + { text: '制水故障', value: 6 } ], - - stateType: { - 1: '正常', - 2: '报废', - 3: '待启用', + 1: '在用', + 2: '待启用', + 3: '关机', 4: '已拆机', 5: '漏水', 6: '制水故障', - 7: '关机', + 7: '报废', 8: '已欠费', 9: '在库', + 10: '激活失败' }, value1: 0, - value2: 'a', + value2: 0, nav_list: {}, foot_width: "", @@ -51,17 +46,22 @@ Page({ page_size: 10, flag: false, total: '', - deviceList: [] + deviceList: [], + dropdownOpen:false, + text2:"设备状态:全部" }, - + onDropdownOpen() { + console.log(123); + this.setData({ dropdownOpen: true }); + }, + onDropdownClose() { + this.setData({ dropdownOpen: false }); + }, ipt1(e) { let that = this that.setData({ searchText: e.detail.value, - page_num: 1, - deviceList: [], }) - that.getDeviceList() }, deviceDesc(e) { @@ -85,29 +85,62 @@ Page({ deviceList: [] }); if (e.detail == 0) { - this.getDeviceList(); + this.getDeviceList(0); return; } - this.getDeviceList(e.detail, ''); + this.getDeviceList(e.detail); }, // 设备管理选择 headerEquipmentClick(e) { + let that = this + let text2 = '' + if(e.detail == 0){ + text2 = '设备状态:全部' + }else if(e.detail == 1){ + text2 = '设备状态:在用' + }else if(e.detail == 2){ + text2 = '设备状态:待启用' + }else if(e.detail == 3){ + text2 = '设备状态:关机' + }else if(e.detail == 4){ + text2 = '设备状态:已拆机' + }else if(e.detail == 5){ + text2 = '设备状态:漏水' + }else if(e.detail == 6){ + text2 = '设备状态:制水故障' + }else if(e.detail == 7){ + text2 = '设备状态:报废' + }else if(e.detail == 8){ + text2 = '设备状态:已欠费' + }else if(e.detail == 9){ + text2 = '设备状态:在库' + }else if(e.detail == 10){ + text2 = '设备状态:激活失败' + } this.setData({ value2: e.detail, - value1: 0, page_num: 1, - deviceList: [] + deviceList: [], + text2 }); if (e.detail == 0) { - this.getDeviceList(); + this.getDeviceList(0); return; } - this.getDeviceList('', e.detail); + this.getDeviceList(e.detail); }, - - getDeviceList(networkStatus, status) { + search2(){ + let that=this + that.setData({ + deviceList:[], + flag:false, + page_num:1 + }) + that.getDeviceList(that.data.value2) + }, + getDeviceList(status) { wx.showLoading({ title: '加载中', mask: true @@ -118,22 +151,11 @@ Page({ page_size: that.data.page_size, page_num: that.data.page_num, search: that.data.searchText, - dealer_id: admin.shop_id + info_id: wx.getStorageSync('info_id'), + status: Number(status), }; - if (networkStatus) { - param = { - ...param, - install_status: networkStatus - } - } - if (status) { - param = { - ...param, - status: Number(status), - } - } - util.postUrl4(apiArr2.deviceList, param, res => { + util.postUrl(apiArr.masterDeviceList, param, res => { wx.hideLoading() let flag = false if (res.list && res.list.length == that.data.page_size) { @@ -144,7 +166,7 @@ Page({ flag = false } that.setData({ - deviceList: that.data.deviceList.concat(res.list || []), + deviceList: that.data.deviceList.concat(res.rows || []), total: res.total, flag, page_num: that.data.page_num + 1 @@ -157,7 +179,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getDeviceList(); + this.getDeviceList(0); wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] @@ -196,7 +218,18 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + let that = this + that.setData({ + flag:false, + page_num:1, + total:0, + searchText:"", + value1:"", + value2:"", + deviceList:[] + }) + that.getDeviceList(0); + wx.stopPullDownRefresh(); }, /** @@ -204,9 +237,8 @@ Page({ */ onReachBottom() { let that = this - console.log(123, that.data.flag); if (that.data.flag) { - that.getDeviceList('', that.data.value2) + that.getDeviceList( that.data.value2) } }, diff --git a/packages/WaterPurifier/pages/device/deviceList/deviceList.json b/packages/WaterPurifier/pages/device/deviceList/deviceList.json index a7dbd7d..2a62106 100644 --- a/packages/WaterPurifier/pages/device/deviceList/deviceList.json +++ b/packages/WaterPurifier/pages/device/deviceList/deviceList.json @@ -1,4 +1,5 @@ { "usingComponents": {}, - "navigationBarTitleText": "设备管理" + "navigationBarTitleText": "设备管理", + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/device/deviceList/deviceList.wxml b/packages/WaterPurifier/pages/device/deviceList/deviceList.wxml index 2347e3f..957a3be 100644 --- a/packages/WaterPurifier/pages/device/deviceList/deviceList.wxml +++ b/packages/WaterPurifier/pages/device/deviceList/deviceList.wxml @@ -1,32 +1,35 @@ - + 设备总数:{{total}} - - + + + + + - - + + - + 设备编码:{{item.device_code}} 客户姓名 - {{item.customer_name}} + {{item.customer_info.name}} 客户手机 - {{item.customer_phone}} + {{item.customer_info.phone}} 网络状态 @@ -45,19 +48,18 @@ 设备地址 - {{item.address}} + {{item.region}}{{item.address}} - + - -新增 + diff --git a/packages/WaterPurifier/pages/device/deviceList/deviceList.wxss b/packages/WaterPurifier/pages/device/deviceList/deviceList.wxss index 56a5c28..eebd90c 100644 --- a/packages/WaterPurifier/pages/device/deviceList/deviceList.wxss +++ b/packages/WaterPurifier/pages/device/deviceList/deviceList.wxss @@ -1,4 +1,3 @@ - .deviceList { background-color: #F9F9F9; padding-bottom: 120rpx; @@ -9,6 +8,13 @@ background-color: #fff; } +.fixed-page { + position: fixed; + width: 100%; + height: 100%; + overflow: hidden; +} + .deviceImg { width: 157rpx; height: 157rpx; @@ -32,7 +38,7 @@ .deviceIpt { width: 710rpx; - height: 54rpx; + height: 70rpx; background: #F9F9F9; border-radius: 100rpx 100rpx 100rpx 100rpx; margin: 0 auto; @@ -50,9 +56,9 @@ flex: 1; } -.deviceIpt image{ - width: 30rpx; - height: 30rpx; +.deviceIpt image { + width: 40rpx; + height: 40rpx; } .dropBox .van-dropdown-menu { @@ -85,17 +91,25 @@ .deviceItemCon_tit { font-weight: 400; - font-size: 26rpx; + font-size: 28rpx; color: #999999; margin-right: 30rpx; } .deviceItemCon_con { font-weight: 400; - font-size: 26rpx; + font-size: 28rpx; color: #222222; } +.searchBox { + padding-left: 30rpx; + height: 54rpx; + display: flex; + align-items: center; + justify-content: center; +} + .addBtn { @@ -116,14 +130,14 @@ .addBtn::after { content: ''; - background: rgba(77, 154, 255,.5); + background: rgba(77, 154, 255, .5); filter: blur(10.899999618530273rpx); width: 90rpx; height: 90rpx; position: absolute; left: 50%; top: 50%; - transform: translate(-50%,-50%); + transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; z-index: -1; diff --git a/packages/WaterPurifier/pages/filter/filter.js b/packages/WaterPurifier/pages/filter/filter.js index 32ec4c9..1ced138 100644 --- a/packages/WaterPurifier/pages/filter/filter.js +++ b/packages/WaterPurifier/pages/filter/filter.js @@ -72,6 +72,7 @@ Page({ } res.list.forEach(item => { + console.log(item, 'zzzz'); // 计算已使用天数 item.difDay = that.getDaysBetweenDates(item.start_time || item.create_time); @@ -85,6 +86,36 @@ Page({ (1 - (item.threshold_volume || 0) / (item.available_volume || 1)) * 100 ); }) + + const first = res.list.findIndex(item => + item.parts_name.indexOf("PP棉滤芯") !== -1 + ); + if (first !== -1) { + const [removed] = res.list.splice(first, 1); // 移除该对象 + res.list.unshift(removed); // 插入到首位 + } + const Second = res.list.findIndex(item => + item.parts_name.indexOf("PP+CB") !== -1 + ); + if (Second !== -1) { + const [removed] = res.list.splice(Second, 1); // 移除该对象 + res.list.splice(1, 0, removed); // 插入到第二位 + } + const Third = res.list.findIndex(item => + item.parts_name.indexOf("RO") !== -1 + ); + if (Third !== -1) { + const [removed] = res.list.splice(Third, 1); // 移除该对象 + res.list.splice(2, 0, removed); // 插入到第二位 + } + const Fourth = res.list.findIndex(item => + item.parts_name.indexOf("后置活性炭") !== -1 + ); + if (Fourth !== -1) { + const [removed] = res.list.splice(Fourth, 1); // 移除该对象 + res.list.splice(3, 0, removed); // 插入到第二位 + } + that.setData({ filterList: res.list }) @@ -211,9 +242,9 @@ Page({ that.queryPay() }, fail(fal) { - if(fal.errMsg == 'requestPayment:fail cancel'){ + if (fal.errMsg == 'requestPayment:fail cancel') { that.payFail(2) - }else{ + } else { that.payFail(1) } } @@ -222,13 +253,13 @@ Page({ }) }, - payFail(e){ + payFail(e) { let that = this - util.postUrl(PayJs.payFail,{ - order_id:that.data.orderMsg.OrderId, - type:"3", - state:e, - },res=>{ + util.postUrl(PayJs.payFail, { + order_id: that.data.orderMsg.OrderId, + type: "3", + state: e, + }, res => { console.log(res); }) }, diff --git a/packages/WaterPurifier/pages/filter/filter.wxml b/packages/WaterPurifier/pages/filter/filter.wxml index 64f6242..41fcaec 100644 --- a/packages/WaterPurifier/pages/filter/filter.wxml +++ b/packages/WaterPurifier/pages/filter/filter.wxml @@ -39,20 +39,20 @@ - + - 剩余可用{{item.available_days}}天 + 预计剩余寿命:{{item.available_days}}天 - + - 剩余流量{{item.remaining_volume}} + 预计剩余寿命:{{item.remaining_volume}}升 购买 - 剩余可用{{item.available_days}}天 + 预计剩余寿命:{{item.available_days}}天 diff --git a/packages/WaterPurifier/pages/filter/filter.wxss b/packages/WaterPurifier/pages/filter/filter.wxss index f5d49df..5758e8c 100644 --- a/packages/WaterPurifier/pages/filter/filter.wxss +++ b/packages/WaterPurifier/pages/filter/filter.wxss @@ -115,7 +115,7 @@ .filter_Item_Info_desc { font-weight: 400; - font-size: 22rpx; + font-size: 24rpx; color: #999999; margin-top: 10rpx; text-align: right; diff --git a/packages/WaterPurifier/pages/repair/repair.js b/packages/WaterPurifier/pages/repair/repair.js index aaa7749..4870846 100644 --- a/packages/WaterPurifier/pages/repair/repair.js +++ b/packages/WaterPurifier/pages/repair/repair.js @@ -1,6 +1,6 @@ -const apiArr = require("~/api/water_filter"); -const { postUrl } = require("~/utils/util"); -const util = require("~/utils/util"); +const apiArr = require("../../../../api/water_filter"); +const { postUrl } = require("../../../../utils/util"); +const util = require("../../../../utils/util"); // pages/water_filter/repair/repair.js const app = getApp() @@ -20,6 +20,8 @@ Page({ name: "", phone: "", message: "", + address:"", + fileList: [], fileList2: [], time: "", @@ -42,6 +44,39 @@ Page({ } return value; }, + currentDevice:{}, + + show2: false, + cityList: [], + areaList: [], + businessList: [], + newAreaList: [], // 默认展示 市区 + newBusiness: [], // 默认展示 县/区 + confirmCity: '', + confirmArea: '', + confirmBusiness: '', + }, + choseRegion(){ + this.setData({ + show2:true + }) + }, + getInfo() { + wx.showLoading({ + title: '加载中...', + mask: true + }) + let that = this + util.postUrl(apiArr.deviceInfo, { device_id:wx.getStorageSync('device_id')}, res => { + wx.hideLoading() + that.setData({ + currentDevice: res, + name:res.device_customer.name, + phone:res.device_customer.phone, + address:res.address, + region:res.region + }) + }) }, deleteImg(e) { console.log(e); @@ -74,6 +109,12 @@ Page({ message: e.detail }) }, + ipt4(e) { + let that = this + that.setData({ + address: e.detail + }) + }, switchShow() { let that = this @@ -253,7 +294,8 @@ Page({ device_id: selectEquipment.device_id, fault_desc: message, fault_imgs: fileList2.length !== 0 ? fileList2[0].url : '', - user_id: Number(wx.getStorageSync('userId')) + user_id: Number(wx.getStorageSync('userId')), + }, res => { wx.hideLoading(); if (res.error) { @@ -345,9 +387,92 @@ Page({ }) } }); + }, + + getSSQ() { + let that = this + util.postUrl2(apiArr.city, {}, res => { + util.postUrl2(apiArr.area, {}, res1 => { + util.postUrl2(apiArr.business, {}, res2 => { + wx.hideLoading(); + // 省列表来自 res + let cityList = res.data.data.rows; + // 市列表来自 res1 + let areaList = res1.data.data.rows; + // 区列表来自 res2 + let businessList = res2.data.data.rows; + + // 处理市列表,将衡水市放到最后 + let hengshuiIndex = areaList.findIndex(item => item.name === '衡水市'); + console.log(hengshuiIndex, 'hengshuiIndex'); + if (hengshuiIndex !== -1) { + const hengshui = areaList.splice(hengshuiIndex, 1)[0]; + areaList.push(hengshui); + } + + console.log(businessList); + // 处理区列表,将衡水市的桃城区放到最后一个 + let taochengIndex = businessList.findIndex(item => item.business_name === '桃城区'); + if (taochengIndex !== -1) { + const taocheng = businessList.splice(taochengIndex, 1)[0]; + businessList.unshift(taocheng); + } + // 默认展示第一条数据的省、市和区 + let newArea = res1.data.data.rows.filter((item) => { + return item.city_id === res.data.data.rows[0].city_id + }); + let newbus = res2.data.data.rows.filter((item) => { + return item.area_id === res1.data.data.rows[0].area_id + }); + // 正确存储数据 + wx.setStorageSync('cityList', cityList) + wx.setStorageSync('areaList', areaList) + wx.setStorageSync('businessList', businessList) + + this.setData({ + cityList: cityList, + areaList: areaList, + businessList: businessList, + newAreaList: newArea, // 默认展示市 + newBusiness: newbus, // 默认展示区 + confirmCity: cityList[0], + confirmArea: newArea[0], + confirmBusiness: newbus[0], + }) + }) + }) + }) + }, + onClose2() { + this.setData({ + show2: false + }) + }, + + bindChange(e) { + const { value } = e.detail; + const { cityList, areaList, businessList } = this.data; + // 每次切换时,根据当前点击的省过滤出所属市区,并且试试变化县/区 + let newArea = areaList.filter((item) => item.city_id === cityList[value[0]].city_id); + let newbus = businessList.filter((item) => item.area_id === newArea[value[1]].area_id); + this.setData({ + newAreaList: newArea, + newBusiness: newbus, + confirmCity: cityList[value[0]], + confirmArea: newArea[value[1]], + confirmBusiness: newbus[value[2]], + }) + }, + onOk() { + const { confirmCity, confirmArea, confirmBusiness } = this.data; + console.log(confirmCity, confirmArea, confirmBusiness); + this.setData({ + show2: false, + region: `${confirmCity.name}${confirmArea.area_name}${confirmBusiness.business_name}`, + }) }, /** @@ -355,10 +480,36 @@ Page({ */ onLoad(options) { this.init(); + this.getInfo() wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] }) + if (wx.getStorageSync('cityList') && wx.getStorageSync('areaList') && wx.getStorageSync('businessList')) { + let res = wx.getStorageSync('cityList') + let res1 = wx.getStorageSync('areaList') + let res2 = wx.getStorageSync('businessList') + console.log(res1); + // 默认展示第一条数据 的市区 和 城区 + let newArea = res1.filter((item) => { + return item.city_id === res[0].city_id + }); + let newbus = res2.filter((item) => { + return item.area_id === res1[0].area_id + }); + this.setData({ + cityList: res, + areaList: res1, + businessList: res2, + newAreaList: newArea, // 默认展示 市区 + newBusiness: newbus, // 默认展示 县/区 + confirmCity: res1[0], + confirmArea: newArea[0], + confirmBusiness: newbus[0], + }) + } else { + that.getSSQ() + } }, init() { @@ -378,7 +529,8 @@ Page({ item.product_icon = util.img_url + item.product_icon }) this.setData({ - equipmentList: res.rows || [] + equipmentList: res.rows || [], + selectEquipment:res.rows[0] || '' }) } } @@ -392,7 +544,9 @@ Page({ selectEquipment: e.currentTarget.dataset.item, name: e.currentTarget.dataset.item.customer_name, phone: e.currentTarget.dataset.item.customer_phone, - equipmentShow: false + address:e.currentTarget.dataset.item.address, + region:e.currentTarget.dataset.item.region, + equipmentShow: false, }) }, diff --git a/packages/WaterPurifier/pages/repair/repair.wxml b/packages/WaterPurifier/pages/repair/repair.wxml index 41b2c5f..837601d 100644 --- a/packages/WaterPurifier/pages/repair/repair.wxml +++ b/packages/WaterPurifier/pages/repair/repair.wxml @@ -1,103 +1,114 @@ - - - - 基本信息 - - 设备型号 - - + + + + 基本信息 + + 设备型号 + + + + + + + 联系人 + + + + + + + 联系电话 + + + + + + + 省市区 + + + + + + + 详细地址 + + + + + + + 期望上门时间 + + + {{time}} + + + + + + + - - - - 联系人 - - + + + 报修内容 + - + + + 图片上传 + + + + - - 联系电话 - - - - - 期望上门时间 - - - {{time}} - + + 提交 - - - - - - - - 报修内容 - + + + + 提交成功 - - - 图片上传 - - - - - - - - 提交 - - - - - - 提交成功 - - - - - - + + - - - - 取消 + + + + 取消 + + + + {{item.device_code}} + - - - {{item.device_code}} + + + + + + 取消 + 确认 - + + + {{item.name}} + + + {{item.name}} + + + {{item.business_name}} + + \ No newline at end of file diff --git a/packages/WaterPurifier/pages/repair/repair.wxss b/packages/WaterPurifier/pages/repair/repair.wxss index 5ae7958..eff4108 100644 --- a/packages/WaterPurifier/pages/repair/repair.wxss +++ b/packages/WaterPurifier/pages/repair/repair.wxss @@ -211,4 +211,18 @@ .equipment_title { margin-bottom: 20rpx; text-align: right; -} \ No newline at end of file +} + + + +.popup_title { + display: flex; + margin: 20rpx 30rpx 0; + justify-content: space-between; + } + .popup_label { + color: #999; + } + .color_blue { + color: #576b95; + } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/upKeep/upKeep.js b/packages/WaterPurifier/pages/upKeep/upKeep.js index fb8e00b..fcbe3f1 100644 --- a/packages/WaterPurifier/pages/upKeep/upKeep.js +++ b/packages/WaterPurifier/pages/upKeep/upKeep.js @@ -1,318 +1,348 @@ let util = require('../../../../utils/util') let apiArr = require('../../../../api/water_filter') let apiArr2 = require('../../../../api/partner') +const app = getApp({ allowDefault: true }) + // packages/WaterPurifier/pages/upKeep/upKeep.js Page({ - /** - * 页面的初始数据 - */ - data: { - stateType: { - 1: '待分配', - 2: '维修中', - 3: '维修成功', - 4: '已撤销', + /** + * 页面的初始数据 + */ + data: { + s: app.system.statusBarHeight, // 状态栏高度 + n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度 + t: app.menu.top, // 胶囊局顶部距离 + h: app.menu.height, // 胶囊高度 + stateType: { + 1: '待分配', + 2: '维修中', + 3: '维修成功', + 4: '已撤销', + }, + option1: [ + { text: '全部', value: 0 }, + { text: '待分配', value: 1 }, + { text: '维修中', value: 2 }, + { text: '维修成功', value: 3 }, + { text: '已撤销', value: 4 }, + ], + value1: 0, + show: false, + MasterList: [], + orderList: [], + page_num: 1, + page_size: 10, + total: '', + flag: false, + sendOrders: {}, + searchText: "", }, - option1: [ - { text: '全部', value: 0 }, - { text: '待分配', value: 1 }, - { text: '维修中', value: 2 }, - { text: '维修成功', value: 3 }, - { text: '已撤销', value: 4 }, - ], - value1: 0, - show:false, - MasterList:[], - orderList:[], - page_num:1, - page_size:10, - total:'', - flag:false, - sendOrders: {}, - }, - - onClose(){ - let that = this - that.setData({ - show:false - }) - }, - dispatch(e){ - let that = this - that.setData({ - show:true, - sendOrders: e.currentTarget.dataset.item - }) - }, - - addOrder(){ - wx.navigateTo({ - url: '/packages/partner/pages/addNewOrder/addNewOrder', - }) - }, - - desc(e){ - let that = this - wx.navigateTo({ - url: `/packages/partner/pages/orderDesc/orderDesc?install_id=${e.currentTarget.dataset.id}&type=repair`, - }) -}, - - headerDropdownClick(e) { - this.setData({ - value1: e.detail, - orderList: [], - page_num: 1, - }) - this.getOrderList(); - }, - - // 撤回工单 - headerRecallClick(e) { - const _this = this; - const { item } = e.currentTarget.dataset; - console.log('eitmeitmeitmeitme', item) - wx.showLoading({ - title: '加载中...', - mask: true - }) - - util.postUrl4(apiArr.RecallRepair,{ - status: 4, - repair_id: item.repair_id, - },res=>{ - wx.hideLoading() - if (res.error) { - wx.showToast({ - title: '撤回工单失败', - icon: 'none', + back(){ + wx.reLaunch({ + url: '/packages/partner/pages/partner', }) - return; - } - wx.showToast({ - title: res.msg, - icon: 'none', - success() { - setTimeout(() => { - _this.setData({ - orderList: [], - page_num: 1, - flag:false + }, + ipt1(e) { + let that = this + console.log(e); + that.setData({ + searchText: e.detail.value, + }) + }, + onClose() { + let that = this + that.setData({ + show: false + }) + }, + dispatch(e) { + let that = this + that.setData({ + show: true, + sendOrders: e.currentTarget.dataset.item + }) + }, + + addOrder() { + wx.navigateTo({ + url: '/packages/partner/pages/addNewOrder/addNewOrder', + }) + }, + + desc(e) { + let that = this + wx.navigateTo({ + url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=1`, + }) + }, + + headerDropdownClick(e) { + this.setData({ + value1: e.detail, + orderList: [], + page_num: 1, + }) + this.getOrderList(); + }, + + // 撤回工单 + headerRecallClick(e) { + const _this = this; + const { item } = e.currentTarget.dataset; + console.log('eitmeitmeitmeitme', item) + wx.showLoading({ + title: '加载中...', + mask: true + }) + + util.postUrl4(apiArr.RecallRepair, { + status: 4, + repair_id: item.repair_id, + }, res => { + wx.hideLoading() + if (res.error) { + wx.showToast({ + title: '撤回工单失败', + icon: 'none', + }) + return; + } + wx.showToast({ + title: res.msg, + icon: 'none', + success() { + setTimeout(() => { + _this.setData({ + orderList: [], + page_num: 1, + flag: false + }) + _this.getOrderList(); + }, 2000) + } }) - _this.getOrderList(); - }, 2000) - } - }) - }) - }, - - getOrderList(name){ - let that = this - //设置加载状态 - wx.showLoading({ - title: '加载中...', - mask: true - }); - - let admin = wx.getStorageSync('admin') - let param = { - status:that.data.value1, - page_num:that.data.page_num, - page_size:that.data.page_size, - dealer_id:admin.shop_id - }; - if(name) { - param = { - ...param, - customer_name: name - } - }; - - util.postUrl4(apiArr2.getOrderPairList,param,res=>{ - console.log('rererererererere', res); - wx.hideLoading() - let flag = false - if(res.rows.length == that.data.page_size){ - flag = true - }else{ - flag = false - } + }) + }, + search() { + let that = this that.setData({ - orderList:that.data.orderList.concat(res.rows || []), - page_num:that.data.page_num+1, - flag + orderList: [] }) - console.log(that.data.flag); - }) - }, + this.getOrderList(); + }, + getOrderList(name) { + let that = this + //设置加载状态 + wx.showLoading({ + title: '加载中...', + mask: true + }); - headerInputClick(e) { - const that = this; - that.setData({ - orderList:[], - page_num: 1, - flag:false - }, () => { - this.getOrderList(e.detail.value); - }) - }, + let admin = wx.getStorageSync('admin') + let param = { + status: that.data.value1, + page_num: that.data.page_num, + page_size: that.data.page_size, + dealer_id: admin.shop_id, + search: that.data.searchText, + }; + if (name) { + param = { + ...param, + customer_name: name + } + }; - //师傅列表 - getMasterList(){ - let that = this - wx.showLoading({ - title: '加载中...', - mask: true - }) - - util.postUrl4(apiArr.MasterList,{ - page_num:1, - page_size:100, - dealer_id:wx.getStorageSync('dealer_id') - },res=>{ - wx.hideLoading() - res.rows.forEach(item=>{ - item.avatar = util.img_url + item.avatar + util.postUrl4(apiArr2.getOrderPairList, param, res => { + console.log('rererererererere', res); + wx.hideLoading() + let flag = false + if (res.rows.length == that.data.page_size) { + flag = true + } else { + flag = false + } + that.setData({ + orderList: that.data.orderList.concat(res.rows || []), + page_num: that.data.page_num + 1, + flag + }) + console.log(that.data.flag); }) + }, + headerInputClick(e) { + const that = this; that.setData({ - MasterList:res.rows + orderList: [], + page_num: 1, + flag: false + }, () => { + this.getOrderList(e.detail.value); }) - }) - }, - //选择师傅 - selectMaster(e){ - console.log(e); - let that = this - let MasterList = that.data.MasterList - MasterList.forEach(item=>{ - item.checked = false - }) - MasterList[e.currentTarget.dataset.index].checked = true - that.setData({ - MasterList - }) -}, -//确定 -sure(){ - let that = this - const { sendOrders, MasterList } = this.data; - const checkedMaster = MasterList.filter((item) => item.checked)[0]; - console.log('sendOrders', sendOrders); - console.log('checkedMaster', checkedMaster); - that.setData({ - show:false - }) - util.postUrl4(apiArr.orderRepairAssign,{ - master_id: checkedMaster.info_id, - repair_id: sendOrders.repair_id, - dealer_id: Number(wx.getStorageSync('dealer_id')) - },res=>{ - if (res.error) { - wx.showToast({ - title: '派单失败', - icon: 'none', - }) - return; - } - wx.showToast({ - title: res.msg, - icon: 'none', - success() { - setTimeout(() => { - that.setData({ - flag:false, - page_num:1, - orderList:[] + }, + + //师傅列表 + getMasterList() { + let that = this + wx.showLoading({ + title: '加载中...', + mask: true + }) + + util.postUrl4(apiArr.MasterList, { + page_num: 1, + page_size: 100, + dealer_id: wx.getStorageSync('dealer_id') + }, res => { + wx.hideLoading() + res.rows.forEach(item => { + item.avatar = util.img_url + item.avatar + }) + + that.setData({ + MasterList: res.rows + }) + }) + }, + //选择师傅 + selectMaster(e) { + console.log(e); + let that = this + let MasterList = that.data.MasterList + MasterList.forEach(item => { + item.checked = false + }) + MasterList[e.currentTarget.dataset.index].checked = true + that.setData({ + MasterList + }) + }, + //确定 + sure() { + let that = this + const { sendOrders, MasterList } = this.data; + const checkedMaster = MasterList.filter((item) => item.checked)[0]; + console.log('sendOrders', sendOrders); + console.log('checkedMaster', checkedMaster); + that.setData({ + show: false + }) + util.postUrl4(apiArr2.assignRepairMaster, { + master_id: checkedMaster.info_id, + repair_id: sendOrders.repair_id, + }, res => { + if (res.error) { + wx.showToast({ + title: '派单失败', + icon: 'none', + }) + return; + } + wx.showToast({ + title: res.msg, + icon: 'none', + success() { + setTimeout(() => { + that.setData({ + flag: false, + page_num: 1, + orderList: [] + }) + that.getOrderList() + }, 1500) + } + }) + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let that = this + // that.getFootNav() + // that.getOrderList() + that.getMasterList() + wx.showShareMenu({ + withShareTicket: true, + menus: ['shareAppMessage', 'shareTimeline'] + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.setData({ + page_num: 1, + orderList: [], + }) + this.getOrderList() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + let that = this + that.setData({ + page_num: 1, + orderList: [], + flag: false }) that.getOrderList() - }, 1500) - } - }) - }) -}, + wx.stopPullDownRefresh(); + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - let that =this - // that.getFootNav() - // that.getOrderList() - // that.getMasterList() - wx.showShareMenu({ - withShareTicket: true, - menus: ['shareAppMessage', 'shareTimeline'] - }) - }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + let that = this + console.log(123, that.data.flag); + if (that.data.flag) { + this.getOrderList() + } + }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - this.setData({ - page_num: 1, - orderList: [], - }) - this.getOrderList() - this.getMasterList() - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - let that = this - console.log(123,that.data.flag); - if(that.data.flag){ - this.getOrderList() - } - }, - - /** - * 用户点击右上角分享 - */ - 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' // 自定义分享图片路径 - } -}, + /** + * 用户点击右上角分享 + */ + 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' // 自定义分享图片路径 + } + }, }) \ No newline at end of file diff --git a/packages/WaterPurifier/pages/upKeep/upKeep.json b/packages/WaterPurifier/pages/upKeep/upKeep.json index e82b2e4..e3cfdde 100644 --- a/packages/WaterPurifier/pages/upKeep/upKeep.json +++ b/packages/WaterPurifier/pages/upKeep/upKeep.json @@ -2,5 +2,6 @@ "usingComponents": { "Footer":"/component/footer/index" }, - "navigationBarTitleText": "维修工单" + "enablePullDownRefresh": true, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/packages/WaterPurifier/pages/upKeep/upKeep.wxml b/packages/WaterPurifier/pages/upKeep/upKeep.wxml index 1762e43..c53ca93 100644 --- a/packages/WaterPurifier/pages/upKeep/upKeep.wxml +++ b/packages/WaterPurifier/pages/upKeep/upKeep.wxml @@ -1,11 +1,30 @@ + + + + + + + + + 维修工单 + + + + + + + + - - + + + + + - 新增 @@ -25,8 +44,9 @@ 工单号:{{item.repair_no}} + - 设备号 + 设备编号 {{item.device_code}} @@ -50,14 +70,13 @@ {{item.fault_desc}} - 具体位置 - {{item.region + item.address}} + 详细地址 + {{item.region + item.address || "暂无数据"}} 撤回 派单 - diff --git a/packages/WaterPurifier/pages/upKeep/upKeep.wxss b/packages/WaterPurifier/pages/upKeep/upKeep.wxss index c5589e7..b1d0de1 100644 --- a/packages/WaterPurifier/pages/upKeep/upKeep.wxss +++ b/packages/WaterPurifier/pages/upKeep/upKeep.wxss @@ -1,5 +1,11 @@ .upkeep{ } +.nav-box{ + padding-bottom: 30rpx; +} +.nav-bar-right{ + opacity: 0; +} .upkeep_select { display: flex; align-items: center; @@ -8,16 +14,20 @@ font-size: 26rpx; color: #222222; background-color: #F9F9F9; - padding: 30rpx 20rpx; + padding: 16rpx 20rpx; +} +.ipt input{ + flex: 1; + height: 100%; } - .upkeep_select .ipt { display: flex; align-items: center; justify-content: space-between; background-color: #fff; - width: 623rpx; - height: 54rpx; + width: 710rpx; + height: 98rpx; + background: #FFFFFF; border-radius: 100rpx 100rpx 100rpx 100rpx; padding-left: 26rpx; @@ -25,8 +35,8 @@ } .ipt image { - width: 30rpx; - height: 30rpx; + width: 42rpx; + height: 42rpx; } .orderList { @@ -54,7 +64,7 @@ .orderItem_Item_tit { font-weight: 400; - font-size: 26rpx; + font-size: 28rpx; color: #999999; min-width: 110rpx; margin-right: 30rpx; @@ -62,7 +72,7 @@ .orderItem_Item_con { font-weight: 400; - font-size: 26rpx; + font-size: 28rpx; color: #222222; } @@ -236,4 +246,12 @@ .MasterAva .van-uploader__wrapper{ width: 100% !important; height: 100% !important; +} + + +.searchBox{ + display: flex; + align-items: center; + justify-content: center; + padding-left: 40rpx; } \ No newline at end of file diff --git a/packages/master/PersonCen/index.js b/packages/master/PersonCen/index.js index 80c2fc3..ecaa208 100644 --- a/packages/master/PersonCen/index.js +++ b/packages/master/PersonCen/index.js @@ -43,7 +43,7 @@ Page({ loginOut(){ wx.removeStorageSync('is_master') wx.redirectTo({ - url:"/pages/chooseEntrance/chooseEntrance" + url:"/pages/newLogin/newLogin" }) }, @@ -70,8 +70,10 @@ Page({ }) if (res.avatar) { + let avatarUrl = res.avatar.startsWith('http')? res.avatar : util.img_url + res.avatar + console.log(res.avatar.startsWith('http')); that.setData({ - avatarUrl: util.img_url + res.avatar + avatarUrl }) } diff --git a/packages/master/PersonCen/index.wxml b/packages/master/PersonCen/index.wxml index 4adf111..0591228 100644 --- a/packages/master/PersonCen/index.wxml +++ b/packages/master/PersonCen/index.wxml @@ -27,9 +27,9 @@ - + diff --git a/packages/master/addNewOrder/index.js b/packages/master/addNewOrder/index.js new file mode 100644 index 0000000..16fdcc3 --- /dev/null +++ b/packages/master/addNewOrder/index.js @@ -0,0 +1,394 @@ +let util = require('../../../utils/util') +let apiArr = require('../../../api/partner') +let apiArr2 = require('../../../api/water_filter') +Page({ + + /** + * 页面的初始数据 + */ + data: { + fileList: [], + fileList2: [], + device_code: "", + customer_name: "", + customer_phone: "", + region: "", + address: "", + deviceList: [], + fault_desc: "", + page_num: 1, + page_size: 50, + show: false, + currentDeviceInfo: { + region:"", + address:"", + }, + formatter(type, value) { + if (type === 'year') { + return `${value}年`; + } + if (type === 'month') { + return `${value}月`; + } + if (type === 'day') { + return `${value}日`; + } + return value; + }, + show2: false, + cityList: [], + areaList: [], + businessList: [], + newAreaList: [], // 默认展示 市区 + newBusiness: [], // 默认展示 县/区 + confirmCity: '', + confirmArea: '', + confirmBusiness: '', + deviceInfo:{ + customer_name:"", + customer_phone:"", + device_code:"", + address:"", + region:"" + } + }, + onClose2() { + this.setData({ + show2: false + }) + }, + headerAreaClick() { + this.setData({ + show2: true + }) + }, + bindChange(e) { + const { value } = e.detail; + const { cityList, areaList, businessList } = this.data; + // 每次切换时,根据当前点击的省过滤出所属市区,并且试试变化县/区 + let newArea = areaList.filter((item) => item.city_id === cityList[value[0]].city_id); + let newbus = businessList.filter((item) => item.area_id === newArea[value[1]].area_id); + this.setData({ + newAreaList: newArea, + newBusiness: newbus, + confirmCity: cityList[value[0]], + confirmArea: newArea[value[1]], + confirmBusiness: newbus[value[2]], + }) + + }, + onOk() { + const { confirmCity, confirmArea, confirmBusiness } = this.data; + console.log(confirmCity, confirmArea, confirmBusiness); + this.setData({ + show2: false, + "currentDeviceInfo.region": `${confirmCity.name}${confirmArea.area_name}${confirmBusiness.business_name}`, + }) + }, + + getSSQ() { + let that = this + util.postUrl2(apiArr2.city, {}, res => { + util.postUrl2(apiArr2.area, {}, res1 => { + util.postUrl2(apiArr2.business, {}, res2 => { + wx.hideLoading(); + // 省列表来自 res + let cityList = res.data.data.rows; + // 市列表来自 res1 + let areaList = res1.data.data.rows; + // 区列表来自 res2 + let businessList = res2.data.data.rows; + + // 处理市列表,将衡水市放到最后 + let hengshuiIndex = areaList.findIndex(item => item.name === '衡水市'); + console.log(hengshuiIndex, 'hengshuiIndex'); + if (hengshuiIndex !== -1) { + const hengshui = areaList.splice(hengshuiIndex, 1)[0]; + areaList.push(hengshui); + } + + console.log(businessList); + // 处理区列表,将衡水市的桃城区放到最后一个 + let taochengIndex = businessList.findIndex(item => item.business_name === '桃城区'); + if (taochengIndex !== -1) { + const taocheng = businessList.splice(taochengIndex, 1)[0]; + businessList.unshift(taocheng); + } + + + // 默认展示第一条数据的省、市和区 + let newArea = res1.data.data.rows.filter((item) => { + return item.city_id === res.data.data.rows[0].city_id + }); + let newbus = res2.data.data.rows.filter((item) => { + return item.area_id === res1.data.data.rows[0].area_id + }); + + // 正确存储数据 + wx.setStorageSync('cityList', cityList) + wx.setStorageSync('areaList', areaList) + wx.setStorageSync('businessList', businessList) + + this.setData({ + cityList: cityList, + areaList: areaList, + businessList: businessList, + newAreaList: newArea, // 默认展示市 + newBusiness: newbus, // 默认展示区 + confirmCity: cityList[0], + confirmArea: newArea[0], + confirmBusiness: newbus[0], + }) + }) + }) + }) + }, + changeShow1() { + let that = this + // wx.navigateTo({ + // url: '/packages/partner/pages/chooseRepairDevice/chooseRepairDevice', + // }) + that.setData({ + show:true + }) + }, + getDeviceList() { + let that = this + util.postUrl(apiArr2.masterDeviceList, { + page_num: that.data.page_num, + page_size: that.data.page_size, + info_id:wx.getStorageSync('info_id') + }, res => { + that.setData({ + deviceList: res.rows + }) + }) + }, + + changeAddress(e){ + console.log(e); + let that = this + that.setData({ + "currentDeviceInfo.address":e.detail.value + }) + }, + + updateFault_desc(e) { + let that = this + that.setData({ + fault_desc: e.detail.value + }) + }, + + confirmPackage(e) { + let that = this + that.setData({ + show: false, + // currentDeviceInfo: e.detail.value, + device_code: e.detail.value.device_code + }) + }, + onClose() { + let that = this + that.setData({ + show: false + }) + }, + + beforeRead(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 + }) + }) + }, + deleteImg(e) { + console.log(e); + let that = this + let fileList = that.data.fileList + let fileList2 = that.data.fileList2 + fileList.splice(e.detail.index, 1) + fileList2.splice(e.detail.index, 1) + that.setData({ + fileList, + fileList2 + }) + }, + changeCustomerPhone(e){ + let that = this + that.setData({ + customer_phone: e.detail.value + }) + if(e.detail.value.length == 11){ + that.searchCustomer(e.detail.value) + } + }, + searchCustomer(e) { + let that = this + util.postUrl(apiArr.phoneSearch, { + phone: e + }, res => { + console.log(res); + if (res.row.length == 1) { + that.setData({ + customer_name: res.row[0].name, + address: res.row[0].address, + customer_id: res.row[0].info_id, + area:res.row[0].region, + address:res.row[0].address, + customer_phone:res.row[0].phone, + }) + } else { + that.setData({ + customer_name: '', + address: '', + customer_id: 0 + }) + } + }) + }, + submit() { + let that = this + + + if (!that.data.deviceInfo.device_code) { + return wx.showToast({ + title: '请选择维修设备', + icon: "none" + }) + } + if (!that.data.fault_desc) { + return wx.showToast({ + title: '请填写故障描述', + icon: "none" + }) + } + + if (!that.data.fileList.length) { + return wx.showToast({ + title: '请上传故障图片', + icon: "none" + }) + } + util.postUrl(apiArr.createRepairOrder, { + device_code: that.data.deviceInfo.device_code, + appointment_time: '', + fault_desc: that.data.fault_desc, + fault_imgs: that.data.fileList2[0].url, + info_id:wx.getStorageSync('info_id') + }, res => { + wx.showToast({ + title: '创建成功!', + icon: "none" + }) + setTimeout(() => { + wx.navigateBack({ + delta: 1 + }) + }, 1500) + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + let that = this + that.getDeviceList() + if (wx.getStorageSync('cityList') && wx.getStorageSync('areaList') && wx.getStorageSync('businessList')) { + let res = wx.getStorageSync('cityList') + let res1 = wx.getStorageSync('areaList') + let res2 = wx.getStorageSync('businessList') + console.log(res1); + // 默认展示第一条数据 的市区 和 城区 + let newArea = res1.filter((item) => { + return item.city_id === res[0].city_id + }); + let newbus = res2.filter((item) => { + return item.area_id === res1[0].area_id + }); + this.setData({ + cityList: res, + areaList: res1, + businessList: res2, + newAreaList: newArea, // 默认展示 市区 + newBusiness: newbus, // 默认展示 县/区 + confirmCity: res1[0], + confirmArea: newArea[0], + confirmBusiness: newbus[0], + }) + } else { + that.getSSQ() + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/packages/master/addNewOrder/index.json b/packages/master/addNewOrder/index.json new file mode 100644 index 0000000..b24f6b1 --- /dev/null +++ b/packages/master/addNewOrder/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "新增维修工单" + } \ No newline at end of file diff --git a/packages/master/addNewOrder/index.wxml b/packages/master/addNewOrder/index.wxml new file mode 100644 index 0000000..2587dcc --- /dev/null +++ b/packages/master/addNewOrder/index.wxml @@ -0,0 +1,127 @@ + + + + + + * + 维修设备 + + + + + + + + + + * + 用户姓名 + + + + + + + + + * + 用户电话 + + + + + + + + + + + * + 所在区域 + + + + + + + + + * + 详细地址 + + + + + + + + + + * + 故障描述 + + + + + + + + + + + * + 故障图片 + + + + + + + + + + 提交 + + + + + + + + + + + + + + + + + + + + + + + + + 取消 + 确认 + + + + {{item.name}} + + + {{item.name}} + + + {{item.business_name}} + + + \ No newline at end of file diff --git a/packages/master/addNewOrder/index.wxss b/packages/master/addNewOrder/index.wxss new file mode 100644 index 0000000..7c05122 --- /dev/null +++ b/packages/master/addNewOrder/index.wxss @@ -0,0 +1,88 @@ +.newWorkOrder{ + padding-bottom: 60rpx; +} +.form { + margin: 0 50rpx; + margin-top: 12rpx; +} + +.formItem { + display: flex; + align-items: center; + justify-content: space-between; + padding: 30rpx 0; + border-bottom: 1rpx solid #E6E6E6; + box-sizing: border-box; +} + +.formItem_tit { + display: flex; + font-weight: 400; + font-size: 26rpx; + color: #222; +} + +.formItem_tit .icon { + color: #2583FF; + font-size: 26rpx; +} + +.formItem_con { + text-align: right; + font-weight: 400; + font-size: 26rpx; + color: #222222; +} + +.formItem_con view { + display: flex; + align-items: center; +} + +.formItem_con image { + width: 13rpx; + height: 26rpx; + margin-left: 13rpx; +} +.formItem2{ + display: flex; + flex-direction: column; + padding: 30rpx 0; +} +.formItem_con2{ + display: flex; + width: 100%; + margin-top: 20rpx; + height: 200rpx; +} +.formItem_con2 textarea{ + width: 100%; + height: 100%; +} + +.submit { + font-weight: 400; + font-size: 36rpx; + color: #FFFFFF; + width: 650rpx; + height: 80rpx; + background: #2583FF; + border-radius: 100rpx 100rpx 100rpx 100rpx; + display: flex; + align-items: center; + justify-content: center; + margin-top: 0rpx; +} + + +.popup_title { + display: flex; + margin: 20rpx 30rpx 0; + justify-content: space-between; + } + .popup_label { + color: #999; + } + .color_blue { + color: #576b95; + } \ No newline at end of file diff --git a/packages/master/device/index.js b/packages/master/device/index.js index ddf5a9c..307df36 100644 --- a/packages/master/device/index.js +++ b/packages/master/device/index.js @@ -18,9 +18,9 @@ Page({ option1: [ { text: '全部', value: 0 }, { text: '在用', value: 1 }, - { text: '已拆机', value: 2 }, - { text: '已报废 ', value: 3 }, - { text: '已在库', value: 4 }, + { text: '已拆机', value: 4 }, + { text: '已报废 ', value: 7 }, + { text: '已在库', value: 9 }, ], active: 0, diff --git a/packages/master/device/index.wxml b/packages/master/device/index.wxml index 0431637..b94e577 100644 --- a/packages/master/device/index.wxml +++ b/packages/master/device/index.wxml @@ -5,23 +5,38 @@ - + - + {{item.product_name}} + + + + {{item.device_code}} + - + {{item.customer_name}} - + {{item.customer_phone}} + + + {{item.repairman_name}} + + + + + {{item.repairman_phone}} + + {{item.region}} {{item.address}} @@ -39,7 +54,7 @@ 已拆机 漏水 制水故障 - 报废 + 已报废 已欠费 在库 激活失败 @@ -48,4 +63,6 @@ + + \ No newline at end of file diff --git a/packages/master/deviceInfo/index.js b/packages/master/deviceInfo/index.js index 0d67576..b80cbf3 100644 --- a/packages/master/deviceInfo/index.js +++ b/packages/master/deviceInfo/index.js @@ -187,6 +187,9 @@ Page({ remark: '' },res=>{ console.log(res); + wx.navigateTo({ + url: `/packages/master/orderDesc/index?id=${res.uninstall_id}&type=3`, + }) }) }, diff --git a/packages/master/deviceInfo/index.wxml b/packages/master/deviceInfo/index.wxml index 132e798..85126b4 100644 --- a/packages/master/deviceInfo/index.wxml +++ b/packages/master/deviceInfo/index.wxml @@ -70,9 +70,8 @@ 漏水故障 主板故障 - - + {{currentDevice.network_status == '1'?'在线':'离线'}} diff --git a/packages/master/deviceInfo/index.wxss b/packages/master/deviceInfo/index.wxss index 60423c6..0a3f467 100644 --- a/packages/master/deviceInfo/index.wxss +++ b/packages/master/deviceInfo/index.wxss @@ -631,14 +631,17 @@ color: #FFFFFF; } -.deleteBtn{ - width: 100rpx; +.deleteBtn { + width: 710rpx; height: 100rpx; background-color: #dd0000; color: #fff; - border-radius: 50%; + border-radius: 20rpx; + font-size: 34rpx; + font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto; + margin-top: 40rpx; } \ No newline at end of file diff --git a/packages/master/masterIndex/index.js b/packages/master/masterIndex/index.js new file mode 100644 index 0000000..00deb27 --- /dev/null +++ b/packages/master/masterIndex/index.js @@ -0,0 +1,130 @@ +let util = require('../../../utils/util') +let apiArr = require('../../../api/water_filter') + +// packages/master/masterIndex/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + funcList: [ + { + text: "新装工单", + img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1", + url: "../order/index?type=0", + }, + { + text: "维修工单", + img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon4.png?1", + url: "../order/index?type=1", + }, + { + text: "拆除工单", + img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/removeIcon.png", + url: "../order/index?type=3", + }, + { + text: "滤芯更换工单", + img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/partsIcon.png", + url: "../order/index?type=2", + }, + { + text: "设备管理", + img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon2.png?1", + url: "../../WaterPurifier/pages/device/deviceList/deviceList", + } + ], + serverInfo: {} + }, + + callPhone() { + let that = this + wx.makePhoneCall({ + phoneNumber: that.data.serverInfo.customer_phone, + }) + }, + jump(e) { + wx.navigateTo({ + url: e.currentTarget.dataset.url, + }) + }, + getMasterInfo() { + let that = this + util.postUrl(apiArr.masterInfo, { + user_id: wx.getStorageSync('userId') + }, res => { + that.setData({ + info_id: res.info_id + }) + wx.setStorageSync('info_id', res.info_id) + }) + }, + + getServerInfo() { + let that = this + util.postUrl(apiArr.getServerInfo, '', res => { + res.qr_code = res.qr_code.startsWith('http') ? res.qr_code : util.img_url + res.qr_code + console.log(res.qr_code); + that.setData({ + serverInfo: res + }) + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getMasterInfo() + this.getServerInfo() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/packages/master/masterIndex/index.json b/packages/master/masterIndex/index.json new file mode 100644 index 0000000..b097ee8 --- /dev/null +++ b/packages/master/masterIndex/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "Footer":"/component/masterFooter/index" + } +} \ No newline at end of file diff --git a/packages/master/masterIndex/index.wxml b/packages/master/masterIndex/index.wxml new file mode 100644 index 0000000..5042470 --- /dev/null +++ b/packages/master/masterIndex/index.wxml @@ -0,0 +1,31 @@ + + 工单管理 + + + + {{item.text}} + + + + + + 平台客服 + + + + 平台电话 + {{serverInfo.customer_phone}} + + + 工作时间 + {{serverInfo.business_hours}} + + + + + 长按保存二维码 + + + + +