feat: 统一环境配置并移除本地测试登录入口

新增 config/env.js 管理 local/test/prod 网关,清理调试登录与页面联调相关改动。
This commit is contained in:
liluo293254 2026-08-07 08:47:52 +08:00
parent a5a558eff3
commit 11c5647ae5
127 changed files with 18476 additions and 18298 deletions

View File

@ -1,14 +1,12 @@
const host = 'https://api.hshuishang.com/api/v1';
// 水机
const httpUserUrl = host + '/waters';
// 与 utils/util.js 共用同一基址,避免生产/测试混用
const util = require('../utils/util.js')
const host = (util.server_url || 'https://test.hshuishang.com/api/v1').replace(/\/$/, '')
const httpUserUrl = host + '/waters'
const apiAddr = {
host:host,
// 处理主办激活请求
host: host,
board_activation: httpUserUrl + '/board-activation',
}
module.exports = apiAddr;
module.exports = apiAddr

View File

@ -1,7 +1,8 @@
const pay = '/lakala/preorder' //预下单
const queryPay = '/lakala/trade-query' //查询交易结果
const queryPayByWechat = '/wechat/water/query_pay' //查询交易结果
const queryPayByWechat = '/lakala/trade-query' // 原 /wechat/water/query_pay 不存在,统一走拉卡拉查单
const HsqueryPay = '/lakala/hs-preorder' //预下单
const HsqueryPayByWechat = '/lakala/hs-trade-query' //查询交易结果

View File

@ -10,13 +10,15 @@ const getdeviceListByid = '/wechat/water/device/parts-list' //根据id获取可
const createDeviceOrder = '/wechat/water/device/parts-buy' //创建配件购买订单
const changeOrderState = '/wechat/water/device/pay-parts-buy' //变更滤芯订单状态
const changeOrderState = '/wechat/water/pay-order-fail' // 已废弃 pay-parts-buy失败回写请用 payFail / PayJs.payFail
const getOrderPayList = '/wechat/water/device/parts-buy-list' //滤芯购买记录
const getFilterChangeList = '/wechat/water/dealer/part-replace-list' //滤芯购买记录
const resetFilter = '/waters/reset-filter' //重置滤芯
const resetFilter = '/waters/reset-filter' // 经销商/师傅重置(管理端 JWT / atoken
const resetFilterUser = '/wechat/water/device/reset-filter' // 用户重置wechat 域 / ctoken
// const getUserBanlance = '/wechat/water/device/balance' //我的余额
@ -220,6 +222,7 @@ const apiArr = {
getOrderPayList,
getFilterChangeList,
resetFilter,
resetFilterUser,
// getUserBanlance,
getTotalBanlance,
getOrderBuyList,

41
app.js
View File

@ -1,6 +1,8 @@
import apiArr from './api/water_filter';
import util from './utils/util';
import apiAddr from '/api/base';
// Page 注入 staticUrl不包装 Component避免 Vant wx://not-found
require('./utils/inject-static.js')
App({
globalData: {
@ -14,42 +16,15 @@ App({
isShare: false, // 用于判断是否来源于分享
nav_list:[],
foot_width:'20%',
appid: 'wx1addb25675dd8e70'
appid: 'wx77b22c0a0018e580', // 与 project.config.json 一致
staticUrl: util.static_url,
},
// 社区页脚导航已废弃:原 apiArr.footer / successfn 未定义,启动必崩,故短路
getFootNav() {
console.log(789789);
let that = this;
// util.postUrl(apiArr.footer,{},res=>{
// that.globalData.nav_list = res;
// that.globalData.foot_width = (100 / res.length).toFixed(2) + '%';
// })
wx.request({
url: apiArr.footer,
data: {},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: f => {
console.log('successddd');
if (f.data.code == "-101" || f.data.code == "-102") {
successfn(f.data);
} else if (f.data.code == "-103") {
successfn(f.data);
} else {
successfn(f.data);
}
},
error: f => {
console.log('error');
wx.showToast({
title: '系统繁忙',
icon: 'none'
})
}
})
this.globalData.nav_list = []
this.globalData.foot_width = '20%'
},
onLaunch(options) {
let that = this;

View File

@ -129,6 +129,7 @@
}
],
"requiredPrivateInfos": [
"getLocation"
],
"window": {
"backgroundTextStyle": "light",
@ -158,16 +159,16 @@
"van-datetime-picker": "/miniprogram_npm/vant-weapp/datetime-picker/index",
"van-popup": "/miniprogram_npm/vant-weapp/popup/index",
"van-circle": "/miniprogram_npm/vant-weapp/circle/index",
"van-checkbox": "/miniprogram_npm/vant-weapp/checkbox",
"van-checkbox-group": "/miniprogram_npm/vant-weapp/checkbox-group",
"van-checkbox": "/miniprogram_npm/vant-weapp/checkbox/index",
"van-checkbox-group": "/miniprogram_npm/vant-weapp/checkbox-group/index",
"van-area": "/miniprogram_npm/vant-weapp/area/index",
"van-dropdown-menu": "/miniprogram_npm/vant-weapp/dropdown-menu",
"van-dropdown-item": "/miniprogram_npm/vant-weapp/dropdown-item",
"van-notice-bar": "/miniprogram_npm/vant-weapp/notice-bar",
"van-empty": "/miniprogram_npm/vant-weapp/empty",
"van-picker": "/miniprogram_npm/vant-weapp/picker",
"van-radio": "/miniprogram_npm/vant-weapp/radio",
"van-radio-group": "/miniprogram_npm/vant-weapp/radio-group",
"van-dropdown-menu": "/miniprogram_npm/vant-weapp/dropdown-menu/index",
"van-dropdown-item": "/miniprogram_npm/vant-weapp/dropdown-item/index",
"van-notice-bar": "/miniprogram_npm/vant-weapp/notice-bar/index",
"van-empty": "/miniprogram_npm/vant-weapp/empty/index",
"van-picker": "/miniprogram_npm/vant-weapp/picker/index",
"van-radio": "/miniprogram_npm/vant-weapp/radio/index",
"van-radio-group": "/miniprogram_npm/vant-weapp/radio-group/index",
"van-stepper": "/miniprogram_npm/vant-weapp/stepper/index"
},
"sitemapLocation": "sitemap.json",

View File

@ -1,50 +1,51 @@
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/pages/water_filter/water_filter",
nav_name:"设备",
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/deviceIcon.png"
},
{
url:"/pages/info/info",
nav_name:"我的",
photo:"https://zhsq.hshuishang.com/attachs/navigation/2024/12/23/6768c0b16ce89.png"
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
console.log(e);
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
const __staticUrl = require('../../config/env.js').static_url
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/pages/water_filter/water_filter",
nav_name:"设备",
photo:(__staticUrl + '/water_filter/deviceIcon.png')
},
{
url:"/pages/info/info",
nav_name:"我的",
photo:(__staticUrl + '/person/Group_309.png')
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
console.log(e);
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
})

View File

@ -1,50 +1,51 @@
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/packages/master/masterIndex/index",
nav_name:"首页",
photo:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1"
},
{
url:"/packages/master/PersonCen/index",
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 () {
// 组件被添加到页面节点树时执行
},
},
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
const __staticUrl = require('../../config/env.js').static_url
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/packages/master/masterIndex/index",
nav_name:"首页",
photo:(__staticUrl + '/water_filter/partner/partner_icon3.png?1')
},
{
url:"/packages/master/PersonCen/index",
nav_name:"我的",
photo:(__staticUrl + '/person/Group_309.png')
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
})

View File

@ -1,50 +1,51 @@
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 () {
// 组件被添加到页面节点树时执行
},
},
import apiAddr from '../../api/base';
import { setData } from '../../utils/index';
const __staticUrl = require('../../config/env.js').static_url
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
nav_list:[
{
url:"/packages/partner/pages/partner",
nav_name:"首页",
photo:(__staticUrl + '/water_filter/partner/partner_icon3.png?1')
},
{
url:"/packages/partner/pages/mine/mine",
nav_name:"我的",
photo:(__staticUrl + '/person/Group_309.png')
},
],
foot_width:'50%',
},
/**
* 组件的方法列表
*/
methods: {
jump(e){
wx.redirectTo({
url: e.currentTarget.dataset.url,
})
},
},
lifetimes: {
attached: function () {
// 组件被添加到页面节点树时执行
},
},
})

View File

@ -1,5 +1,6 @@
import { doNavigateWithUser } from '../../utils/helper';
import apiAddr from '../../api/base';
const env = require('../../config/env.js')
const app = getApp();
Component({
@ -15,6 +16,7 @@ Component({
* 组件的初始数据
*/
data: {
staticUrl: env.static_url,
qqmap_key: app.initQQMapKey(),
address: '定位中',
selectKeyWord: '',

View File

@ -1,21 +1,21 @@
<view class="search">
<view class="locat" catchtap="goPagesLink">
<image class="local_left_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/location.png" mode=""/>
<text class="local_city">{{address}}</text>
<van-icon name="arrow-down" color="#2583FF " />
</view>
<view class='search_bar'>
<image class="search_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_36.png" mode=""/>
<!-- bindinput="searchInput" -->
<!-- bindblur="searchInput" -->
<input
class="search_input"
placeholder='输入搜索的社区名称'
confirm-type='search'
bindinput="searchInput"
bindconfirm="searchInput"
value="{{ selectKeyWord }}"
/>
<!-- <image class="search_qrcode" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_49.png" mode=""/> -->
</view>
<view class="search">
<view class="locat" catchtap="goPagesLink">
<image class="local_left_icon" src="https://static.hshuishang.com/User/_assets/location.png" mode=""/>
<text class="local_city">{{address}}</text>
<van-icon name="arrow-down" color="#2583FF " />
</view>
<view class='search_bar'>
<image class="search_icon" src="https://static.hshuishang.com/community/_assets/Group_36.png" mode=""/>
<!-- bindinput="searchInput" -->
<!-- bindblur="searchInput" -->
<input
class="search_input"
placeholder='输入搜索的社区名称'
confirm-type='search'
bindinput="searchInput"
bindconfirm="searchInput"
value="{{ selectKeyWord }}"
/>
<!-- <image class="search_qrcode" src="https://static.hshuishang.com/community/_assets/Group_49.png" mode=""/> -->
</view>
</view>

View File

@ -1,6 +1,6 @@
import { doNavigateWithUser } from '../../utils/helper';
import { isObjEmpty } from '../../utils/index';
import { img_url } from '../../utils/util';
import { static_url } from '../../utils/util';
Component({
@ -32,7 +32,8 @@ Component({
* 组件的初始数据
*/
data: {
picUrl: img_url,
picUrl: static_url,
staticUrl: static_url,
},
/**

View File

@ -1,31 +1,31 @@
<view class="container" bind:tap="headerEnterClick2" data-id="{{item.community_id}}" data-name="{{item.name}}">
<image class="left_logo" src="{{picUrl}}{{item.pic}}" mode="aspectFill"/>
<view class="right {{isLast && 'no_bottom'}}">
<view class="header">
<view class="title">{{item.name}}</view>
<view class="distance" wx:if="{{item.distance}}">{{item.distance}}</view>
</view>
<view class="center">物业公司:{{item.shop.shop_name}}</view>
<view class="address">
<image class="address_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Group_50.png" mode=""/>
<view class="text-container">
<text>{{item.addr}}</text>
</view>
</view>
<view class="bottom">
<view class="bottom_left">
<view class="btn" catch:tap="handleOptionClick">
<image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Send.png" mode="aspectFill"/>
导航
</view>
<view class="btn mobile" catch:tap="headlePhoneClick">
<image class="btn_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/community/_assets/Phone-telephone.png" mode=""/>
电话
</view>
</view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 1}}">前往预定</view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 2}}">进入小区</view>
<view class="bottom_right" catch:tap="chooseClick" wx:if="{{joinType == 3}}" data-id="{{item.community_id}}" data-name="{{item.name}}">选择小区</view>
</view>
</view>
<view class="container" bind:tap="headerEnterClick2" data-id="{{item.community_id}}" data-name="{{item.name}}">
<image class="left_logo" src="{{picUrl}}{{item.pic}}" mode="aspectFill"/>
<view class="right {{isLast && 'no_bottom'}}">
<view class="header">
<view class="title">{{item.name}}</view>
<view class="distance" wx:if="{{item.distance}}">{{item.distance}}</view>
</view>
<view class="center">物业公司:{{item.shop.shop_name}}</view>
<view class="address">
<image class="address_icon" src="https://static.hshuishang.com/community/_assets/Group_50.png" mode=""/>
<view class="text-container">
<text>{{item.addr}}</text>
</view>
</view>
<view class="bottom">
<view class="bottom_left">
<view class="btn" catch:tap="handleOptionClick">
<image class="btn_icon" src="https://static.hshuishang.com/community/_assets/Send.png" mode="aspectFill"/>
导航
</view>
<view class="btn mobile" catch:tap="headlePhoneClick">
<image class="btn_icon" src="https://static.hshuishang.com/community/_assets/Phone-telephone.png" mode=""/>
电话
</view>
</view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 1}}">前往预定</view>
<view class="bottom_right" catch:tap="headerEnterClick" wx:if="{{joinType == 2}}">进入小区</view>
<view class="bottom_right" catch:tap="chooseClick" wx:if="{{joinType == 3}}" data-id="{{item.community_id}}" data-name="{{item.name}}">选择小区</view>
</view>
</view>
</view>

55
config/env.js Normal file
View File

@ -0,0 +1,55 @@
/**
* 净水机小程序环境仅本小程序
*
* APP_ENV:
* local 本机 8120需开发者工具勾选不校验合法域名
* test 测试网关
* prod 生产网关正式版 / 体验版发版必须用 prod
*
* 静态资源统一 https://static.hshuishang.com
*/
const APP_ENV = 'local' // local | test | prod正式/体验版必须 prod本机联调改为 local
const STATIC_URL = 'https://static.hshuishang.com'
const ALIYUN_OSS_URL = 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com'
const API = {
local: {
server_url: 'http://127.0.0.1:8120/api/v1',
api_host: 'http://127.0.0.1:8120',
},
test: {
server_url: 'https://test.hshuishang.com/api/v1',
api_host: 'https://test.hshuishang.com',
},
prod: {
server_url: 'https://api.hshuishang.com/api/v1',
api_host: 'https://api.hshuishang.com',
},
}
if (!API[APP_ENV]) {
throw new Error('config/env.js: APP_ENV must be local|test|prod, got ' + APP_ENV)
}
const api = API[APP_ENV]
const USE_LOCAL = APP_ENV === 'local'
module.exports = {
APP_ENV,
USE_LOCAL,
STATIC_URL,
CDN: {
development: { static_url: STATIC_URL, aliyun_oss_url: ALIYUN_OSS_URL },
production: { static_url: STATIC_URL, aliyun_oss_url: ALIYUN_OSS_URL },
},
ENV: {
local: { ...API.local, static_url: STATIC_URL, aliyun_oss_url: ALIYUN_OSS_URL },
test: { ...API.test, static_url: STATIC_URL, aliyun_oss_url: ALIYUN_OSS_URL },
prod: { ...API.prod, static_url: STATIC_URL, aliyun_oss_url: ALIYUN_OSS_URL },
},
server_url: api.server_url,
img_url: api.api_host,
static_url: STATIC_URL,
aliyun_oss_url: ALIYUN_OSS_URL,
}

View File

@ -1,138 +1,139 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/WaterPurifier/pages/Addfriend/Addfriend.js
Page({
/**
* 页面的初始数据
*/
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; // 获取临时文件路径
// 保存图片到相册
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',
});
},
});
},
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
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/WaterPurifier/pages/Addfriend/Addfriend.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
},
save() {
wx.downloadFile({
url: (__staticUrl + '/water_filter/customer.jpg'),
success(res) {
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
// 保存图片到相册
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',
});
},
});
},
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: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,411 +1,412 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const app = getApp()
import { areaList } from '../../data/index';
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
checked: true,
areaList,
show: false, //弹出层
name: "",
phone: "",
area: "",
address: "",
message: "",
page_num: 1,
page_size: 10,
flag: false,
PartsList: [],
currentId: [],
currentName: [],
price: 0,
orderMsg: "",//订单信息
GoodsMsg: "",//商户信息
},
ipt1(e) {
let that = this
that.setData({
name: e.detail.value
})
},
ipt2(e) {
let that = this
that.setData({
phone: e.detail.value
})
},
ipt3(e) {
let that = this
that.setData({
address: e.detail.value
})
},
ipt4(e) {
let that = this
that.setData({
message: e.detail.value
})
},
onChange(e) {
console.log(e);
let that = this
let PartsList = that.data.PartsList
let currentId = that.data.currentId
let currentName = that.data.currentName
let price = that.data.price
currentId = []
currentName = []
PartsList[e.currentTarget.dataset.idx].checked = !PartsList[e.currentTarget.dataset.idx].checked
price = 0
PartsList.forEach(item => {
if (item.checked) {
// price += item.unit_price
price = util.floatCalculate(price, item.unit_price, '+=')
currentId.push(item.parts_id)
currentName.push(item.parts_name)
}
})
that.setData({
PartsList,
currentId,
currentName,
price
})
},
getPartsByid() {
wx.showLoading({
title: '加载中...',
})
let that = this
util.postUrl(apiArr.getdeviceListByid, {
device_id: Number(wx.getStorageSync('device_id')),
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
console.log(res, 'resss');
let flag
if (res.rows) {
res.rows.forEach(item => {
item.checked = false
})
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
item.parts_icon = util.img_url + item.parts_icon
})
that.setData({
PartsList: that.data.PartsList.concat(res.rows || []),
flag,
page_size: that.data.page_size + 1
})
}
})
},
createDeriveOrder() {
let that = this
if (that.data.currentId.length == 0) {
wx.showToast({
title: '请选择商品',
icon: "none"
})
return
}
if (!that.data.name) {
wx.showToast({
title: '请填写收货人',
icon: "none"
})
return
}
if (!that.data.phone) {
wx.showToast({
title: '请填写收货人电话',
icon: "none"
})
return
}
if (!util.isPhone(that.data.phone)) {
wx.showToast({
title: '请填写正确电话',
icon: "none"
})
return
}
if (!that.data.area) {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return
}
if (!that.data.address) {
wx.showToast({
title: '请填写详情地址',
icon: "none"
})
return
}
let parts_ids = that.data.currentId.join()
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.area,
address: that.data.address,
parts_ids,
total_price: String(that.data.price),
customer_name: that.data.name,
customer_phone: that.data.phone,
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.orderMsg.DealerId),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
GoodsMsg: res
})
that.pay()
})
},
pay() {
let that = this
let parts_ids = that.data.currentId.join()
let subject = that.data.currentName.join()
util.postUrl2(PayJs.pay, {
address: that.data.area + that.data.address,
goods_id: parts_ids,
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.orderMsg.OrderNo,
quantity: 1,
remark: that.data.message,
subject,
term_no: that.data.GoodsMsg.term_no,
total_amount: String(that.data.price * 100),
user: String(wx.getStorageSync('userId')),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
console.log(res, 'ssss');
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.OrderId,
type: "3",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.GoodsMsg.merchant_no,
term_no: that.data.GoodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo
}, res => {
if (res.statusCode == '200') {
// wx.requestSubscribeMessage({
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
// })
wx.showToast({
title: '支付成功!',
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
account() {
wx.navigateTo({
url: '../payList/payList',
})
},
onClose(e) {
let that = this
that.setData({
show: false
})
},
changeShow() {
let that = this
that.setData({
show: true
})
},
//选择地区
AreaConfirm(e) {
let that = this
let area = ''
if (e.detail.values[0].name == e.detail.values[1].name) {
area = e.detail.values[1].name + e.detail.values[2].name
} else {
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
show: false,
area
})
},
//取消
cancel(e) {
let that = this
that.setData({
show: false
})
},
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/share.png' // 自定义分享图片路径
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getPartsByid()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPartsByid()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const app = getApp()
import { areaList } from '../../data/index';
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
checked: true,
areaList,
show: false, //弹出层
name: "",
phone: "",
area: "",
address: "",
message: "",
page_num: 1,
page_size: 10,
flag: false,
PartsList: [],
currentId: [],
currentName: [],
price: 0,
orderMsg: "",//订单信息
GoodsMsg: "",//商户信息
},
ipt1(e) {
let that = this
that.setData({
name: e.detail.value
})
},
ipt2(e) {
let that = this
that.setData({
phone: e.detail.value
})
},
ipt3(e) {
let that = this
that.setData({
address: e.detail.value
})
},
ipt4(e) {
let that = this
that.setData({
message: e.detail.value
})
},
onChange(e) {
console.log(e);
let that = this
let PartsList = that.data.PartsList
let currentId = that.data.currentId
let currentName = that.data.currentName
let price = that.data.price
currentId = []
currentName = []
PartsList[e.currentTarget.dataset.idx].checked = !PartsList[e.currentTarget.dataset.idx].checked
price = 0
PartsList.forEach(item => {
if (item.checked) {
// price += item.unit_price
price = util.floatCalculate(price, item.unit_price, '+=')
currentId.push(item.parts_id)
currentName.push(item.parts_name)
}
})
that.setData({
PartsList,
currentId,
currentName,
price
})
},
getPartsByid() {
wx.showLoading({
title: '加载中...',
})
let that = this
util.postUrl(apiArr.getdeviceListByid, {
device_id: Number(wx.getStorageSync('device_id')),
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
console.log(res, 'resss');
let flag
if (res.rows) {
res.rows.forEach(item => {
item.checked = false
})
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
item.parts_icon = util.img_url + item.parts_icon
})
that.setData({
PartsList: that.data.PartsList.concat(res.rows || []),
flag,
page_size: that.data.page_size + 1
})
}
})
},
createDeriveOrder() {
let that = this
if (that.data.currentId.length == 0) {
wx.showToast({
title: '请选择商品',
icon: "none"
})
return
}
if (!that.data.name) {
wx.showToast({
title: '请填写收货人',
icon: "none"
})
return
}
if (!that.data.phone) {
wx.showToast({
title: '请填写收货人电话',
icon: "none"
})
return
}
if (!util.isPhone(that.data.phone)) {
wx.showToast({
title: '请填写正确电话',
icon: "none"
})
return
}
if (!that.data.area) {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return
}
if (!that.data.address) {
wx.showToast({
title: '请填写详情地址',
icon: "none"
})
return
}
let parts_ids = that.data.currentId.join()
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.area,
address: that.data.address,
parts_ids,
total_price: String(that.data.price),
customer_name: that.data.name,
customer_phone: that.data.phone,
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.orderMsg.DealerId),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
GoodsMsg: res
})
that.pay()
})
},
pay() {
let that = this
let parts_ids = that.data.currentId.join()
let subject = that.data.currentName.join()
util.postUrl2(PayJs.pay, {
address: that.data.area + that.data.address,
goods_id: parts_ids,
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.orderMsg.OrderNo,
quantity: 1,
remark: that.data.message,
subject,
term_no: that.data.GoodsMsg.term_no,
total_amount: String(that.data.price * 100),
user: String(wx.getStorageSync('userId')),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
console.log(res, 'ssss');
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.OrderId,
type: "3",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.GoodsMsg.merchant_no,
term_no: that.data.GoodsMsg.term_no,
out_trade_no: that.data.orderMsg.order_no || that.data.orderMsg.OrderNo
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
setTimeout(() => {
wx.navigateBack({ delta: 1 })
}, 800)
} else {
wx.showToast({
title: res.msg,
})
}
})
},
account() {
wx.navigateTo({
url: '../payList/payList',
})
},
onClose(e) {
let that = this
that.setData({
show: false
})
},
changeShow() {
let that = this
that.setData({
show: true
})
},
//选择地区
AreaConfirm(e) {
let that = this
let area = ''
if (e.detail.values[0].name == e.detail.values[1].name) {
area = e.detail.values[1].name + e.detail.values[2].name
} else {
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
show: false,
area
})
},
//取消
cancel(e) {
let that = this
that.setData({
show: false
})
},
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getPartsByid()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPartsByid()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,184 +1,185 @@
const apiArr = require("~/api/water_filter");
import util, { postUrl } from '../../../../utils/util';
const app = getApp()
// pages/water_filter/Maintenance/Maintenance.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
tabIndex: 1,
status: '0', //0全部1待处理 2处理中 3已完成
page_num: 1,
page_size: 10,
isLoading: false, // 是否正在加载
hasMore: true, // 是否还有更多数据
statusType: "",
BxList: [] //报修列表
},
async changeTab(e) {
console.log(e);
let that = this
that.setData({
status: e.target.dataset.index
})
const statusType = e.target.dataset.index;
this.setData({
BxList: [],
page_num: 1,
statusType
})
that.getBxList(statusType);
},
repair() {
let that = this
wx.navigateTo({
url: '../repair/repair',
})
},
handleInfoClick(e) {
wx.navigateTo({
url: `../MaintenanceInfo/MaintenanceInfo?repairId=${e.currentTarget.dataset.id}`,
})
},
//报修列表
getBxList(statusType) {
let that = this
const { page_size, page_num, BxList } = this.data;
let params = {};
if (statusType === '0') {
params = {
page_size: page_size,
page_num: page_num,
user_id: Number(wx.getStorageSync('userId'))
}
} else {
params = {
page_size: page_size,
page_num: page_num,
status: Number(statusType),
user_id: Number(wx.getStorageSync('userId'))
}
}
wx.showLoading({
title: '加载中...',
mask: true
})
postUrl(apiArr.BXList, params, res => {
wx.hideLoading()
if (res.rows) {
res.rows.forEach(item => {
item.product_icon = util.img_url + item.product_icon
item.create_time = item.create_time.slice(0, 16)
if (item.fault_imgs) {
item.fault_imgs = util.img_url + item.fault_imgs
}
})
}
if (that.data.page_num == 1) {
that.setData({
BxList: []
})
}
this.setData({
BxList: BxList.concat(res.rows || []),
total: res.total,
page_num: page_num + 1,
isLoading: false,
hasMore: res.total === this.data.page_size,
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// let that = this
// that.getBxList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this;
that.setData({
page_num: 1,
flag: false,
BxList: []
})
setTimeout(() => {
that.getBxList(that.data.statusType)
}, 10)
},
/**
* 生命周期函数--监听页面隐藏
*/
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' // 自定义分享图片路径
}
},
const apiArr = require("~/api/water_filter");
import util, { postUrl } from '../../../../utils/util';
const app = getApp()
// pages/water_filter/Maintenance/Maintenance.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
tabIndex: 1,
status: '0', //0全部1待处理 2处理中 3已完成
page_num: 1,
page_size: 10,
isLoading: false, // 是否正在加载
hasMore: true, // 是否还有更多数据
statusType: "",
BxList: [] //报修列表
},
async changeTab(e) {
console.log(e);
let that = this
that.setData({
status: e.target.dataset.index
})
const statusType = e.target.dataset.index;
this.setData({
BxList: [],
page_num: 1,
statusType
})
that.getBxList(statusType);
},
repair() {
let that = this
wx.navigateTo({
url: '../repair/repair',
})
},
handleInfoClick(e) {
wx.navigateTo({
url: `../MaintenanceInfo/MaintenanceInfo?repairId=${e.currentTarget.dataset.id}`,
})
},
//报修列表
getBxList(statusType) {
let that = this
const { page_size, page_num, BxList } = this.data;
let params = {};
if (statusType === '0') {
params = {
page_size: page_size,
page_num: page_num,
user_id: Number(wx.getStorageSync('userId'))
}
} else {
params = {
page_size: page_size,
page_num: page_num,
status: Number(statusType),
user_id: Number(wx.getStorageSync('userId'))
}
}
wx.showLoading({
title: '加载中...',
mask: true
})
postUrl(apiArr.BXList, params, res => {
wx.hideLoading()
if (res.rows) {
res.rows.forEach(item => {
item.product_icon = util.img_url + item.product_icon
item.create_time = item.create_time.slice(0, 16)
if (item.fault_imgs) {
item.fault_imgs = util.img_url + item.fault_imgs
}
})
}
if (that.data.page_num == 1) {
that.setData({
BxList: []
})
}
this.setData({
BxList: BxList.concat(res.rows || []),
total: res.total,
page_num: page_num + 1,
isLoading: false,
hasMore: res.total === this.data.page_size,
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// let that = this
// that.getBxList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this;
that.setData({
page_num: 1,
flag: false,
BxList: []
})
setTimeout(() => {
that.getBxList(that.data.statusType)
}, 10)
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,51 +1,51 @@
<view class="box">
<!-- <view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
报修记录
</view>
<view class="nav-bar-right"></view>
</view>
</view> -->
<view class="tabList">
<view class="{{status == '0'?'active':''}} tabItem" bindtap="changeTab" data-index="0">全部</view>
<view class="{{status == '1'?'active':''}} tabItem" bindtap="changeTab" data-index='1'>待处理</view>
<view class="{{status == '2'?'active':''}} tabItem" bindtap="changeTab" data-index='2'>处理中</view>
<view class="{{status == '3'?'active':''}} tabItem" bindtap="changeTab" data-index='3'>已完成</view>
<view class="{{status == '4'?'active':''}} tabItem" bindtap="changeTab" data-index='4'>已撤销</view>
</view>
<view class="recordList">
<view class="recordItem" wx:if="{{BxList.length != 0}}" wx:for="{{BxList}}" data-id="{{item.repair_id}}" wx:key="index" bindtap="handleInfoClick">
<view class="recordItem_img" wx:if="{{item.fault_imgs}}">
<image src="{{item.fault_imgs}}" mode="widthFix" />
</view>
<view class="recordItem_Msg">
<view class="recordItem_Msg_left">
<view class="recordItem_Msg_left_tit">{{item.device_code}}</view>
<view class="recordItem_Msg_left_msg">
提交时间:{{item.create_time}}
</view>
<view class="recordItem_Msg_left_msg">
期望上门:{{item.appointment_time}}
</view>
</view>
<view class="recordItem_Msg_right_state1" wx:if="{{item.status == 1}}">待处理</view>
<view class="recordItem_Msg_right_state2" wx:if="{{item.status == 3}}">已完成</view>
<view class="recordItem_Msg_right_state3" wx:if="{{item.status == 2}}">处理中</view>
<view class="recordItem_Msg_right_state4" wx:if="{{item.status == 4}}">已撤销</view>
</view>
</view>
<van-empty wx:if="{{BxList.length == 0}}" description="暂无记录" />
</view>
<view class="btn" bindtap="repair">我要报修</view>
<view class="box">
<!-- <view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://static.hshuishang.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
报修记录
</view>
<view class="nav-bar-right"></view>
</view>
</view> -->
<view class="tabList">
<view class="{{status == '0'?'active':''}} tabItem" bindtap="changeTab" data-index="0">全部</view>
<view class="{{status == '1'?'active':''}} tabItem" bindtap="changeTab" data-index='1'>待处理</view>
<view class="{{status == '2'?'active':''}} tabItem" bindtap="changeTab" data-index='2'>处理中</view>
<view class="{{status == '3'?'active':''}} tabItem" bindtap="changeTab" data-index='3'>已完成</view>
<view class="{{status == '4'?'active':''}} tabItem" bindtap="changeTab" data-index='4'>已撤销</view>
</view>
<view class="recordList">
<view class="recordItem" wx:if="{{BxList.length != 0}}" wx:for="{{BxList}}" data-id="{{item.repair_id}}" wx:key="index" bindtap="handleInfoClick">
<view class="recordItem_img" wx:if="{{item.fault_imgs}}">
<image src="{{item.fault_imgs}}" mode="widthFix" />
</view>
<view class="recordItem_Msg">
<view class="recordItem_Msg_left">
<view class="recordItem_Msg_left_tit">{{item.device_code}}</view>
<view class="recordItem_Msg_left_msg">
提交时间:{{item.create_time}}
</view>
<view class="recordItem_Msg_left_msg">
期望上门:{{item.appointment_time}}
</view>
</view>
<view class="recordItem_Msg_right_state1" wx:if="{{item.status == 1}}">待处理</view>
<view class="recordItem_Msg_right_state2" wx:if="{{item.status == 3}}">已完成</view>
<view class="recordItem_Msg_right_state3" wx:if="{{item.status == 2}}">处理中</view>
<view class="recordItem_Msg_right_state4" wx:if="{{item.status == 4}}">已撤销</view>
</view>
</view>
<van-empty wx:if="{{BxList.length == 0}}" description="暂无记录" />
</view>
<view class="btn" bindtap="repair">我要报修</view>
</view>

View File

@ -1,43 +1,43 @@
<view class="box">
<!-- 维修详情 -->
<view class="InfoList">
<view class="InfoMsg">
<view class="InfoMsg_tit">设备信息</view>
<view class="InfoMsg_info">设备编码: <text>{{repairInfo.device_code}}</text> </view>
</view>
<view class="InfoItem">
<view class="InfoItem_tit">故障信息</view>
<view class="InfoItem_msg"><text>报修单号</text>{{repairInfo.repair_no}}</view>
<view class="InfoItem_msg"><text>故障描述</text>{{repairInfo.fault_desc}}</view>
<view class="InfoItem_msg"><text>报修人</text> {{repairInfo.customer_name}}</view>
<view class="InfoItem_msg dispay">
<view class="InfoItem_msg no_bottom">
<text>报修人电话</text>
<view class="label">{{repairInfo.repairman_phone}}</view>
</view>
<view class="personCall" wx:if="{{item.repairman_phone}}" bindtap="headerTelClick">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/maintenance_phone.png" mode="widthFix" />
</view>
</view>
<view class="InfoItem_msg dispay">
<view class="InfoItem_msg no_bottom">
<text>报修地址</text>
<view class="label">{{repairInfo.region}}{{repairInfo.address}}</view>
</view>
</view>
<!-- <view class="InfoItem_msg"><text>故障时间</text>2022-05-11 09:26</view> -->
<view class="InfoItem_msg"><text>报修时间</text>{{repairInfo.create_time}}</view>
</view>
</view>
<view class="box">
<!-- 维修详情 -->
<view class="InfoList">
<view class="InfoMsg">
<view class="InfoMsg_tit">设备信息</view>
<view class="InfoMsg_info">设备编码: <text>{{repairInfo.device_code}}</text> </view>
</view>
<view class="InfoItem">
<view class="InfoItem_tit">故障信息</view>
<view class="InfoItem_msg"><text>报修单号</text>{{repairInfo.repair_no}}</view>
<view class="InfoItem_msg"><text>故障描述</text>{{repairInfo.fault_desc}}</view>
<view class="InfoItem_msg"><text>报修人</text> {{repairInfo.customer_name}}</view>
<view class="InfoItem_msg dispay">
<view class="InfoItem_msg no_bottom">
<text>报修人电话</text>
<view class="label">{{repairInfo.repairman_phone}}</view>
</view>
<view class="personCall" wx:if="{{item.repairman_phone}}" bindtap="headerTelClick">
<image src="https://static.hshuishang.com/water_filter/maintenance_phone.png" mode="widthFix" />
</view>
</view>
<view class="InfoItem_msg dispay">
<view class="InfoItem_msg no_bottom">
<text>报修地址</text>
<view class="label">{{repairInfo.region}}{{repairInfo.address}}</view>
</view>
</view>
<!-- <view class="InfoItem_msg"><text>故障时间</text>2022-05-11 09:26</view> -->
<view class="InfoItem_msg"><text>报修时间</text>{{repairInfo.create_time}}</view>
</view>
</view>
</view>

View File

@ -1,411 +1,412 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
import { areaList } from '../../data/index';
let PayJs = require('../../../../api/pay')
// pages/water_filter/Recharge/Recharge.js
Page({
/**
* 页面的初始数据
*/
data: {
name: "",
phone: "",
area: "",
address: "",
show: false,
areaList,
active: 0,
page_size: 10,
page_num: 1,
flag: false,
packageList: [],
price: 0,
selectPackage: {
discounted_price: 0
},
orderMsg: "",
goodsMsg: "",
currentDevice: ''
},
//充值记录
RechargeRecord() {
let that = this
wx.navigateTo({
url: '../RechargeRecord/RechargeRecord',
})
},
changelog(e) {
let that = this
that.setData({
active: e.currentTarget.dataset.catlog
})
},
getPackageList() {
wx.showLoading({
title: '加载中...',
mask: true
})
let that = this
that.setData({
currentDevice: wx.getStorageSync('currentDevice')
})
util.postUrl(apiArr.getpackageList, {
device_id: that.data.currentDevice.device_id
}, res => {
wx.hideLoading()
res.package_icon = util.img_url + res.package_icon
that.setData({
packageList: res
})
})
},
onChange(e) {
let that = this
let packageList = that.data.packageList
let selectPackage = that.data.selectPackage
packageList.checked = e.detail
if (e.detail) {
selectPackage.discounted_price = packageList.suggested_price
} else {
selectPackage.discounted_price = 0
}
that.setData({
packageList,
selectPackage
})
},
account2() {
let that = this
if (that.data.selectPackage.discounted_price == '0') {
wx.showToast({
title: '请选择套餐',
icon: "none"
})
return
}
util.postUrl(apiArr.createPackageOrder, {
device_id: that.data.currentDevice.device_id,
package_id: that.data.packageList.package_id
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
account() {
let that = this
console.log(that.data.selectPackage);
if (that.data.selectPackage.discounted_price == '0') {
wx.showToast({
title: '请选择套餐',
icon: "none"
})
return
}
if (!that.data.name) {
wx.showToast({
title: '请填写收货人',
icon: "none"
})
return
}
if (!that.data.phone) {
wx.showToast({
title: '请填写收货人电话',
icon: "none"
})
return
}
if (!util.isPhone(that.data.phone)) {
wx.showToast({
title: '请填写正确电话',
icon: "none"
})
return
}
if (!that.data.area) {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return
}
if (!that.data.address) {
wx.showToast({
title: '请填写详情地址',
icon: "none"
})
return
}
util.postUrl(apiArr.createPackageOrder, {
billing_method: Number(that.data.packageList.package_type),
is_new: 1,
order_name: that.data.packageList.package_name,
total_price: Number(that.data.packageList.suggested_price),
package_id: that.data.packageList.package_id,
device_customer_name: that.data.name,
device_customer_phone: that.data.phone,
device_customer_addr: that.data.area + that.data.address,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
console.log(res, '1123213');
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.packageList.dealer_id),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.area + that.data.address,
goods_id: that.data.orderMsg.order_id,
remark: "",
subject: that.data.orderMsg.order_name,
term_no: that.data.goodsMsg.term_no,
total_amount: String(that.data.packageList.suggested_price * 100),
// total_amount:String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.order_no),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
console.log(fal.errMsg);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.order_no
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
// wx.requestSubscribeMessage({
// tmplIds: ["2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU"],
// success(res) {
// if (res['2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU'] === 'accept') {
// console.log('用户同意订阅');
// // 调用后端接口保存用户订阅状态
// }
// },
// })
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 1500)
} else {
wx.showToast({
title: res.msg,
})
}
})
},
payFail(e){
let that = this
util.postUrl(PayJs.payFail,{
order_id:that.data.orderMsg.order_id,
type:"2",
state:e,
},res=>{
console.log(res);
})
},
changeShow() {
let that = this
that.setData({
show: true
})
},
//选择地区
AreaConfirm(e) {
let that = this
let area = ''
if (e.detail.values[0].name == e.detail.values[1].name) {
area = e.detail.values[1].name + e.detail.values[2].name
} else {
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
show: false,
area
})
},
//取消
cancel(e) {
let that = this
that.setData({
show: false
})
},
ipt1(e) {
let that = this
that.setData({
name: e.detail.value
})
},
ipt2(e) {
let that = this
that.setData({
phone: e.detail.value
})
},
ipt3(e) {
let that = this
that.setData({
address: e.detail.value
})
},
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
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
phone: wx.getStorageSync('phone')
})
that.getPackageList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPackageList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
import { areaList } from '../../data/index';
let PayJs = require('../../../../api/pay')
// pages/water_filter/Recharge/Recharge.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
name: "",
phone: "",
area: "",
address: "",
show: false,
areaList,
active: 0,
page_size: 10,
page_num: 1,
flag: false,
packageList: [],
price: 0,
selectPackage: {
discounted_price: 0
},
orderMsg: "",
goodsMsg: "",
currentDevice: ''
},
//充值记录
RechargeRecord() {
let that = this
wx.navigateTo({
url: '../RechargeRecord/RechargeRecord',
})
},
changelog(e) {
let that = this
that.setData({
active: e.currentTarget.dataset.catlog
})
},
getPackageList() {
wx.showLoading({
title: '加载中...',
mask: true
})
let that = this
that.setData({
currentDevice: wx.getStorageSync('currentDevice')
})
util.postUrl(apiArr.getpackageList, {
device_id: that.data.currentDevice.device_id
}, res => {
wx.hideLoading()
res.package_icon = util.img_url + res.package_icon
that.setData({
packageList: res
})
})
},
onChange(e) {
let that = this
let packageList = that.data.packageList
let selectPackage = that.data.selectPackage
packageList.checked = e.detail
if (e.detail) {
selectPackage.discounted_price = packageList.suggested_price
} else {
selectPackage.discounted_price = 0
}
that.setData({
packageList,
selectPackage
})
},
account2() {
let that = this
if (that.data.selectPackage.discounted_price == '0') {
wx.showToast({
title: '请选择套餐',
icon: "none"
})
return
}
util.postUrl(apiArr.createPackageOrder, {
device_id: that.data.currentDevice.device_id,
package_id: that.data.packageList.package_id
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
account() {
let that = this
console.log(that.data.selectPackage);
if (that.data.selectPackage.discounted_price == '0') {
wx.showToast({
title: '请选择套餐',
icon: "none"
})
return
}
if (!that.data.name) {
wx.showToast({
title: '请填写收货人',
icon: "none"
})
return
}
if (!that.data.phone) {
wx.showToast({
title: '请填写收货人电话',
icon: "none"
})
return
}
if (!util.isPhone(that.data.phone)) {
wx.showToast({
title: '请填写正确电话',
icon: "none"
})
return
}
if (!that.data.area) {
wx.showToast({
title: '请选择所在地区',
icon: "none"
})
return
}
if (!that.data.address) {
wx.showToast({
title: '请填写详情地址',
icon: "none"
})
return
}
util.postUrl(apiArr.createPackageOrder, {
billing_method: Number(that.data.packageList.package_type),
is_new: 1,
order_name: that.data.packageList.package_name,
total_price: Number(that.data.packageList.suggested_price),
package_id: that.data.packageList.package_id,
device_customer_name: that.data.name,
device_customer_phone: that.data.phone,
device_customer_addr: that.data.area + that.data.address,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
console.log(res, '1123213');
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.packageList.dealer_id),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.area + that.data.address,
goods_id: that.data.orderMsg.order_id,
remark: "",
subject: that.data.orderMsg.order_name,
term_no: that.data.goodsMsg.term_no,
total_amount: String(that.data.packageList.suggested_price * 100),
// total_amount:String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.order_no),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
console.log(fal.errMsg);
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.order_no
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
// wx.requestSubscribeMessage({
// tmplIds: ["2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU"],
// success(res) {
// if (res['2BX7Zh5ccLzmHvvbCHuPWiaoZQyDCGfziCruxUct_EU'] === 'accept') {
// console.log('用户同意订阅');
// // 调用后端接口保存用户订阅状态
// }
// },
// })
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 1500)
} else {
wx.showToast({
title: res.msg,
})
}
})
},
payFail(e){
let that = this
util.postUrl(PayJs.payFail,{
order_id:that.data.orderMsg.order_id,
type:"2",
state:e,
},res=>{
console.log(res);
})
},
changeShow() {
let that = this
that.setData({
show: true
})
},
//选择地区
AreaConfirm(e) {
let that = this
let area = ''
if (e.detail.values[0].name == e.detail.values[1].name) {
area = e.detail.values[1].name + e.detail.values[2].name
} else {
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
show: false,
area
})
},
//取消
cancel(e) {
let that = this
that.setData({
show: false
})
},
ipt1(e) {
let that = this
that.setData({
name: e.detail.value
})
},
ipt2(e) {
let that = this
that.setData({
phone: e.detail.value
})
},
ipt3(e) {
let that = this
that.setData({
address: e.detail.value
})
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
phone: wx.getStorageSync('phone')
})
that.getPackageList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPackageList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,288 +1,289 @@
// pages/water_filter/RechargeRecord/RechargeRecord.js
const app = getApp()
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
page_num: 1,
page_size: 10,
flag: false,
List: [],
currentDevice:"",
tab: [
{
name: "全部",
type: "0"
},
{
name: "待支付",
type: "1"
},
{
name: "已支付",
type: "4"
},
{
name: "已取消",
type: "5"
},
],
state: 0,
selectPackage: ""
},
changeTab(e) {
console.log(e);
let that = this
that.setData({
state: e.currentTarget.dataset.tab,
flag: false,
page_num: 1,
List: []
})
that.getPayList()
},
getPayList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getOrderBuyList, {
page_num: that.data.page_num,
page_size: that.data.page_size,
status: that.data.state,
user_id: Number(wx.getStorageSync('userId')),
dealer_id:that.data.currentDevice.dealer_id
}, res => {
wx.hideLoading()
if (res.rows) {
let flag
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
console.log(item, 'item');
if (item.part_list) {
item.part_ids = item.part_list.map(items => items.parts_id).join(',')
}
})
that.setData({
flag,
List: that.data.List.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
pay2(e) {
let that = this
that.setData({
selectPackage: e.currentTarget.dataset.item
})
that.pay3()
},
pay3() {
let that = this
util.postUrl(apiArr.createPackageOrder, {
device_id:that.data.currentDevice.device_id,
package_id:that.data.currentDevice.package_id
}, res => {
console.log(res,'asdasd');
that.setData({
orderMsg: res
})
console.log(that.data.orderMsg.order_no);
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.selectPackage.dealer_id),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: '',
goods_id: that.data.orderMsg.order_name,
remark: "",
subject: that.data.orderMsg.order_name,
term_no: that.data.goodsMsg.term_no,
total_amount:String(that.data.selectPackage.total_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.order_no),
user_id: wx.getStorageSync('openId'),
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.order_id,
type: "2",
state: e,
}, res => {
console.log(res);
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo,
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
flag: false,
page_num: 1,
List: []
})
this.getPayList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
currentDevice:wx.getStorageSync('currentDevice')
})
that.getPayList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPayList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
// pages/water_filter/RechargeRecord/RechargeRecord.js
const app = getApp()
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
page_num: 1,
page_size: 10,
flag: false,
List: [],
currentDevice:"",
tab: [
{
name: "全部",
type: "0"
},
{
name: "待支付",
type: "1"
},
{
name: "已支付",
type: "4"
},
{
name: "已取消",
type: "5"
},
],
state: 0,
selectPackage: ""
},
changeTab(e) {
console.log(e);
let that = this
that.setData({
state: e.currentTarget.dataset.tab,
flag: false,
page_num: 1,
List: []
})
that.getPayList()
},
getPayList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getOrderBuyList, {
page_num: that.data.page_num,
page_size: that.data.page_size,
status: that.data.state,
user_id: Number(wx.getStorageSync('userId')),
dealer_id:that.data.currentDevice.dealer_id
}, res => {
wx.hideLoading()
if (res.rows) {
let flag
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
console.log(item, 'item');
if (item.part_list) {
item.part_ids = item.part_list.map(items => items.parts_id).join(',')
}
})
that.setData({
flag,
List: that.data.List.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
pay2(e) {
let that = this
that.setData({
selectPackage: e.currentTarget.dataset.item
})
that.pay3()
},
pay3() {
let that = this
util.postUrl(apiArr.createPackageOrder, {
device_id:that.data.currentDevice.device_id,
package_id:that.data.currentDevice.package_id
}, res => {
console.log(res,'asdasd');
that.setData({
orderMsg: res
})
console.log(that.data.orderMsg.order_no);
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.selectPackage.dealer_id),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: '',
goods_id: that.data.orderMsg.order_name,
remark: "",
subject: that.data.orderMsg.order_name,
term_no: that.data.goodsMsg.term_no,
total_amount:String(that.data.selectPackage.total_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.order_no),
user_id: wx.getStorageSync('openId'),
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if(fal.errMsg == 'requestPayment:fail cancel'){
that.payFail(2)
}else{
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.order_id,
type: "2",
state: e,
}, res => {
console.log(res);
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.order_no,
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
flag: false,
page_num: 1,
List: []
})
this.getPayList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
currentDevice:wx.getStorageSync('currentDevice')
})
that.getPayList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPayList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,70 +1,70 @@
<view class="box">
<!-- <view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
充值记录
</view>
<view class="nav-bar-right"></view>
</view>
</view> -->
<view class="tabs">
<scroll-view scroll-x class="scroll-view">
<view wx:for="{{tab}}" class="tab {{state == index?'active':''}}" bind:tap="changeTab" data-tab="{{index}}">{{item.name}}</view>
</scroll-view>
</view>
<view class="payList">
<view class="payItem" wx:if="{{List.length > 0}}" wx:for="{{List}}">
<view class="payItem1">
<!-- <view class="payItem1_time">2024-12-20 10:31:48</view> -->
<view class="payItem1_state1" wx:if="{{item.status == 1}}">待支付</view>
<view class="payItem1_state1" wx:if="{{item.status == 4}}">已支付</view>
<view class="payItem1_state1" wx:if="{{item.status == 5}}">已取消</view>
<view class="payItem1_state1" wx:if="{{item.status !== 5 && item.status !== 1 && item.status !== 4}}">其他</view>
</view>
<van-divider />
<view class="payItem_row">
<view class="payItem_title">订单名称</view>
<view class="payItem_con">{{item.order_name}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">订单编号</view>
<view class="payItem_con">{{item.order_no}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">套餐名称</view>
<view class="payItem_con">{{item.package_name}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">支付方式</view>
<view class="payItem_con">{{item.order_source == 1?'微信支付':'线下'}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">计费模式</view>
<view class="payItem_con">{{item.billing_method == 1?'时长':'流量'}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">金额</view>
<view class="payItem_con">¥{{item.total_price}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">支付时间</view>
<view class="payItem_con">{{item.pay_time}}</view>
</view>
<view class="payItem_payBox">
<view class="payItem_pay" bind:tap="pay2" data-item="{{item}}" wx:if="{{item.status == 1}}">
去支付
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{List.length == 0}}" />
</view>
</view>
<view class="box">
<!-- <view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://static.hshuishang.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
充值记录
</view>
<view class="nav-bar-right"></view>
</view>
</view> -->
<view class="tabs">
<scroll-view scroll-x class="scroll-view">
<view wx:for="{{tab}}" class="tab {{state == index?'active':''}}" bind:tap="changeTab" data-tab="{{index}}">{{item.name}}</view>
</scroll-view>
</view>
<view class="payList">
<view class="payItem" wx:if="{{List.length > 0}}" wx:for="{{List}}">
<view class="payItem1">
<!-- <view class="payItem1_time">2024-12-20 10:31:48</view> -->
<view class="payItem1_state1" wx:if="{{item.status == 1}}">待支付</view>
<view class="payItem1_state1" wx:if="{{item.status == 4}}">已支付</view>
<view class="payItem1_state1" wx:if="{{item.status == 5}}">已取消</view>
<view class="payItem1_state1" wx:if="{{item.status !== 5 && item.status !== 1 && item.status !== 4}}">其他</view>
</view>
<van-divider />
<view class="payItem_row">
<view class="payItem_title">订单名称</view>
<view class="payItem_con">{{item.order_name}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">订单编号</view>
<view class="payItem_con">{{item.order_no}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">套餐名称</view>
<view class="payItem_con">{{item.package_name}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">支付方式</view>
<view class="payItem_con">{{item.order_source == 1?'微信支付':'线下'}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">计费模式</view>
<view class="payItem_con">{{item.billing_method == 1?'时长':'流量'}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">金额</view>
<view class="payItem_con">¥{{item.total_price}}</view>
</view>
<view class="payItem_row">
<view class="payItem_title">支付时间</view>
<view class="payItem_con">{{item.pay_time}}</view>
</view>
<view class="payItem_payBox">
<view class="payItem_pay" bind:tap="pay2" data-item="{{item}}" wx:if="{{item.status == 1}}">
去支付
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{List.length == 0}}" />
</view>
</view>

View File

@ -166,10 +166,11 @@ Page({
})
},
replay(e) {
const that = this
wx.showLoading({
title: '重置中...',
})
util.postUrl4(apiArr.resetFilter, {
util.postUrl(apiArr.resetFilterUser, {
part_id: e.currentTarget.dataset.item.id,
device_id: e.currentTarget.dataset.item.device_id,
}, res => {
@ -180,10 +181,10 @@ Page({
title: '重置成功!',
icon: "none"
})
that.getfilterList()
that.getInfo()
} else {
wx.showToast({
title: res.msg,
title: res.msg || '重置失败',
icon: "none"
})
}
@ -440,7 +441,7 @@ Page({
}
wx.showModal({
title: '提示',
content: '确定要将设备转时长?请在设备通电开机状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定要转时长?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {
}
@ -493,7 +494,7 @@ Page({
}
wx.showModal({
title: '提示',
content: '确定要设备转流量?请在设备通电开机状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定要转流量?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {
}
@ -530,7 +531,7 @@ Page({
let that = this
wx.showModal({
title: '提示',
content: '是否确认设置为零售模式?此操作请在设备通电开机的状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定仍设为零售?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {

View File

@ -1,209 +1,209 @@
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status == '2'}}" bind:tap="openOff" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == '1'}}" bind:tap="openOff" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.device_part}}" wx:key="index">
<view class="progress-name">
<view>{{item.parts_name}}</view>
</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="uninstall" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
</van-popup>
<!-- 拆机 -->
<van-popup show="{{ show2 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="createUninstall">确定</view>
</view>
<view class="row">
<view class="row_label">备注:</view>
<view class="row_con">
<textarea placeholder="请输入备注" bindinput="remarksIpt1"></textarea>
</view>
</view>
</van-popup>
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://static.hshuishang.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://static.hshuishang.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status == '2'}}" bind:tap="openOff" src="https://static.hshuishang.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == '1'}}" bind:tap="openOff" src="https://static.hshuishang.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://static.hshuishang.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.device_part}}" wx:key="index">
<view class="progress-name">
<view>{{item.parts_name}}</view>
</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="uninstall" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
</van-popup>
<!-- 拆机 -->
<van-popup show="{{ show2 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="createUninstall">确定</view>
</view>
<view class="row">
<view class="row_label">备注:</view>
<view class="row_con">
<textarea placeholder="请输入备注" bindinput="remarksIpt1"></textarea>
</view>
</view>
</van-popup>

View File

@ -1,262 +1,263 @@
let util = require("../../../../../utils/util")
const apiArr = require('../../../../../api/water_filter')
const apiArr2 = require('../../../../../api/partner')
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
Page({
/**
* 页面的初始数据
*/
data: {
option1: [
{ text: '全部', value: 0 },
{ text: '已安装', value: 1 },
{ text: '待启用', value: 2 },
{ text: '已拆机', value: 3 },
],
option2: [
{ text: '全部', value: 0 },
{ text: '在用', value: 1 },
{ text: '待启用', value: 2 },
{ text: '关机', value: 3 },
{ text: '已拆机', value: 4 },
{ text: '漏水', value: 5 },
{ text: '制水故障', value: 6 }
],
stateType: {
1: '在用',
2: '待启用',
3: '关机',
4: '已拆机',
5: '漏水',
6: '制水故障',
7: '报废',
8: '已欠费',
9: '在库',
10: '激活失败'
},
value1: 0,
value2: 0,
nav_list: {},
foot_width: "",
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
flag: false,
total: '',
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,
})
},
deviceDesc(e) {
wx.navigateTo({
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
})
},
addWorkOrders() {
console.log(123123);
wx.navigateTo({
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
})
},
// 网络状态选择
headerNetWorkClick(e) {
console.log('e', e);
this.setData({
value1: e.detail,
value2: 0,
page_num: 1,
deviceList: []
});
if (e.detail == 0) {
this.getDeviceList(0);
return;
}
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,
page_num: 1,
deviceList: [],
text2
});
if (e.detail == 0) {
this.getDeviceList(0);
return;
}
this.getDeviceList(e.detail);
},
search2(){
let that=this
that.setData({
deviceList:[],
flag:false,
page_num:1
})
that.getDeviceList(that.data.value2)
},
getDeviceList(status) {
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let admin = wx.getStorageSync('admin')
let param = {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
info_id: wx.getStorageSync('info_id'),
status: Number(status),
};
util.postUrl(apiArr.masterDeviceList, param, res => {
wx.hideLoading()
let flag = false
if (res.list && res.list.length == that.data.page_size) {
console.log(123);
flag = true
} else {
console.log(456);
flag = false
}
that.setData({
deviceList: that.data.deviceList.concat(res.rows || []),
total: res.total,
flag,
page_num: that.data.page_num + 1
})
console.log(that.data.flag);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getDeviceList(0);
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
flag:false,
page_num:1,
total:0,
searchText:"",
value1:"",
value2:"",
deviceList:[]
})
that.getDeviceList(0);
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getDeviceList( that.data.value2)
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require("../../../../../utils/util")
const apiArr = require('../../../../../api/water_filter')
const apiArr2 = require('../../../../../api/partner')
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
const __staticUrl = require('../../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
option1: [
{ text: '全部', value: 0 },
{ text: '已安装', value: 1 },
{ text: '待启用', value: 2 },
{ text: '已拆机', value: 3 },
],
option2: [
{ text: '全部', value: 0 },
{ text: '在用', value: 1 },
{ text: '待启用', value: 2 },
{ text: '关机', value: 3 },
{ text: '已拆机', value: 4 },
{ text: '漏水', value: 5 },
{ text: '制水故障', value: 6 }
],
stateType: {
1: '在用',
2: '待启用',
3: '关机',
4: '已拆机',
5: '漏水',
6: '制水故障',
7: '报废',
8: '已欠费',
9: '在库',
10: '激活失败'
},
value1: 0,
value2: 0,
nav_list: {},
foot_width: "",
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
flag: false,
total: '',
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,
})
},
deviceDesc(e) {
wx.navigateTo({
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
})
},
addWorkOrders() {
console.log(123123);
wx.navigateTo({
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
})
},
// 网络状态选择
headerNetWorkClick(e) {
console.log('e', e);
this.setData({
value1: e.detail,
value2: 0,
page_num: 1,
deviceList: []
});
if (e.detail == 0) {
this.getDeviceList(0);
return;
}
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,
page_num: 1,
deviceList: [],
text2
});
if (e.detail == 0) {
this.getDeviceList(0);
return;
}
this.getDeviceList(e.detail);
},
search2(){
let that=this
that.setData({
deviceList:[],
flag:false,
page_num:1
})
that.getDeviceList(that.data.value2)
},
getDeviceList(status) {
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let admin = wx.getStorageSync('admin')
let param = {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
info_id: wx.getStorageSync('info_id'),
status: Number(status),
};
util.postUrl(apiArr.masterDeviceList, param, res => {
wx.hideLoading()
let flag = false
if (res.list && res.list.length == that.data.page_size) {
console.log(123);
flag = true
} else {
console.log(456);
flag = false
}
that.setData({
deviceList: that.data.deviceList.concat(res.rows || []),
total: res.total,
flag,
page_num: that.data.page_num + 1
})
console.log(that.data.flag);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getDeviceList(0);
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
flag:false,
page_num:1,
total:0,
searchText:"",
value1:"",
value2:"",
deviceList:[]
})
that.getDeviceList(0);
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getDeviceList( that.data.value2)
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,67 +1,67 @@
<view class="deviceList" class="page-container {{ dropdownOpen ? 'fixed-page' : '' }}">
<view class="white">
<view class="deviceImg">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deviceList.png?1" mode="widthFix" />
</view>
<view class="deviceText">设备总数:{{total}}</view>
<view class="deviceIpt">
<input type="text" confirm-type="search" bindconfirm="search2" value="{{searchText}}" bindinput="ipt1" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
</view>
</view>
<view class="dropBox">
<van-dropdown-menu>
<!-- <van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{'安装状态'}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" /> -->
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="deviceItem_box">
<view class="deviceItem" wx:if="{{deviceList.length != 0 && item.install_status!= 2}}" wx:for="{{deviceList}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户姓名</view>
<view class="deviceItemCon_con">{{item.customer_info.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户手机</view>
<view class="deviceItemCon_con">{{item.customer_info.phone}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备状态</view>
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.region}}{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
</view>
</view>
<!-- <view class="addBtn" bind:tap="addWorkOrders">新增</view> -->
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
<view class="deviceList" class="page-container {{ dropdownOpen ? 'fixed-page' : '' }}">
<view class="white">
<view class="deviceImg">
<image src="https://static.hshuishang.com/water_filter/dervice/deviceList.png?1" mode="widthFix" />
</view>
<view class="deviceText">设备总数:{{total}}</view>
<view class="deviceIpt">
<input type="text" confirm-type="search" bindconfirm="search2" value="{{searchText}}" bindinput="ipt1" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
</view>
</view>
<view class="dropBox">
<van-dropdown-menu>
<!-- <van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{'安装状态'}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" /> -->
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="deviceItem_box">
<view class="deviceItem" wx:if="{{deviceList.length != 0 && item.install_status!= 2}}" wx:for="{{deviceList}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户姓名</view>
<view class="deviceItemCon_con">{{item.customer_info.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户手机</view>
<view class="deviceItemCon_con">{{item.customer_info.phone}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备状态</view>
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.region}}{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
</view>
</view>
<!-- <view class="addBtn" bind:tap="addWorkOrders">新增</view> -->
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>

View File

@ -1,125 +1,125 @@
<view class="box">
<view class="tabList">
<view class="tab {{tabIndex == 0?'active':''}}" data-index="0" bind:tap="changeTab">设备进货</view>
<view class="tab {{tabIndex == 1?'active':''}}" data-index="1" bind:tap="changeTab">进货记录</view>
</view>
<view wx:if="{{tabIndex == 0}}" style="padding-bottom:180rpx">
<view class="filterList">
<view class="filterItem" wx:for="{{3}}">
<van-checkbox value="{{ checked }}" shape="square" bind:change="onChange" checked-color="#2583FF">
</van-checkbox>
<view class="filterItem_Msg">
<view class="filterItem_Img">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/goods.png" mode="widthFix" />
</view>
<view class="filterItem_Con">
<view class="filterItem_Con_tit">后置活性炭滤芯</view>
<view class="filterItem_Con_tagList">
进货价
<view class="icon">¥</view>
<view class="money">998</view>
</view>
</view>
</view>
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="formItem">
<view class="formItem_ask">收货人</view>
<view class="formItem_con">
<input type="text" value="{{name}}" placeholder="请输入收货人姓名" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">联系方式</view>
<view class="formItem_con">
<input type="text" value="{{phone}}" placeholder="请输入收货人联系方式" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">所属地区</view>
<view class="formItem_con">
<input type="text" value="{{area}}" placeholder="请选择所在地区" disabled bindtap="changeShow" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">收货地址</view>
<view class="formItem_con">
<input type="text" value="{{address}}" placeholder="请输入详细地址" />
</view>
</view>
<view class="formItem2">
<view class="foremItem2_tit">留言</view>
<view class="foremItem2_con">
<textarea value="{{message}}" placeholder="请输入留言" />
</view>
</view>
</view>
<view class="foot">
<view class="foot_mony"> <text>¥</text> 68.00</view>
<view class="foot_btn" bind:tap="account">去结算</view>
</view>
</view>
<view wx:if="{{tabIndex == 1}}" style="background-color: #f9f9f9;">
<view class="payList">
<view class="payItem" wx:for="{{2}}">
<view class="payItem_tit">
<view class="payItem_tit_time">2024-12-20 10:31:48</view>
<view class="payItem_tit_state">未支付</view>
</view>
<view class="payItem_goods">
<view class="payItem_goods_img">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/goods.png" mode="widthFix" />
</view>
<view class="payItem_goods_msg">
<view class="payItem_goods_msg_orderNum">订单编号20250228150122105</view>
<view class="payItem_goods_msg_orderName">滤芯名称:后置活性炭</view>
<view class="payItem_goods_msg_orderPrice">价格58</view>
</view>
</view>
<view class="rows">
<view class="rows_tit">实付款</view>
<view class="rows_con">58</view>
</view>
<view class="rows">
<view class="rows_tit">支付方式</view>
<view class="rows_con">微信</view>
</view>
<view class="rows">
<view class="rows_tit">收货人名称</view>
<view class="rows_con">杜胜男</view>
</view>
<view class="rows">
<view class="rows_tit">收货人手机</view>
<view class="rows_con">15901518415</view>
</view>
<view class="rows">
<view class="rows_tit">收货人地址</view>
<view class="rows_con">河北省衡水市桃城区信合荣景园6号楼</view>
</view>
<view class="buybox">
<view class="buy">
去支付
</view>
</view>
</view>
</view>
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom" bind:>
<view style="width: 100%;">
<van-area area-list="{{ areaList }}" bind:confirm="AreaConfirm" bind:cancel="cancel" value="110101" />
</view>
<view class="box">
<view class="tabList">
<view class="tab {{tabIndex == 0?'active':''}}" data-index="0" bind:tap="changeTab">设备进货</view>
<view class="tab {{tabIndex == 1?'active':''}}" data-index="1" bind:tap="changeTab">进货记录</view>
</view>
<view wx:if="{{tabIndex == 0}}" style="padding-bottom:180rpx">
<view class="filterList">
<view class="filterItem" wx:for="{{3}}">
<van-checkbox value="{{ checked }}" shape="square" bind:change="onChange" checked-color="#2583FF">
</van-checkbox>
<view class="filterItem_Msg">
<view class="filterItem_Img">
<image src="https://static.hshuishang.com/water_filter/goods.png" mode="widthFix" />
</view>
<view class="filterItem_Con">
<view class="filterItem_Con_tit">后置活性炭滤芯</view>
<view class="filterItem_Con_tagList">
进货价
<view class="icon">¥</view>
<view class="money">998</view>
</view>
</view>
</view>
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="formItem">
<view class="formItem_ask">收货人</view>
<view class="formItem_con">
<input type="text" value="{{name}}" placeholder="请输入收货人姓名" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">联系方式</view>
<view class="formItem_con">
<input type="text" value="{{phone}}" placeholder="请输入收货人联系方式" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">所属地区</view>
<view class="formItem_con">
<input type="text" value="{{area}}" placeholder="请选择所在地区" disabled bindtap="changeShow" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">收货地址</view>
<view class="formItem_con">
<input type="text" value="{{address}}" placeholder="请输入详细地址" />
</view>
</view>
<view class="formItem2">
<view class="foremItem2_tit">留言</view>
<view class="foremItem2_con">
<textarea value="{{message}}" placeholder="请输入留言" />
</view>
</view>
</view>
<view class="foot">
<view class="foot_mony"> <text>¥</text> 68.00</view>
<view class="foot_btn" bind:tap="account">去结算</view>
</view>
</view>
<view wx:if="{{tabIndex == 1}}" style="background-color: #f9f9f9;">
<view class="payList">
<view class="payItem" wx:for="{{2}}">
<view class="payItem_tit">
<view class="payItem_tit_time">2024-12-20 10:31:48</view>
<view class="payItem_tit_state">未支付</view>
</view>
<view class="payItem_goods">
<view class="payItem_goods_img">
<image src="https://static.hshuishang.com/water_filter/goods.png" mode="widthFix" />
</view>
<view class="payItem_goods_msg">
<view class="payItem_goods_msg_orderNum">订单编号20250228150122105</view>
<view class="payItem_goods_msg_orderName">滤芯名称:后置活性炭</view>
<view class="payItem_goods_msg_orderPrice">价格58</view>
</view>
</view>
<view class="rows">
<view class="rows_tit">实付款</view>
<view class="rows_con">58</view>
</view>
<view class="rows">
<view class="rows_tit">支付方式</view>
<view class="rows_con">微信</view>
</view>
<view class="rows">
<view class="rows_tit">收货人名称</view>
<view class="rows_con">杜胜男</view>
</view>
<view class="rows">
<view class="rows_tit">收货人手机</view>
<view class="rows_con">15901518415</view>
</view>
<view class="rows">
<view class="rows_tit">收货人地址</view>
<view class="rows_con">河北省衡水市桃城区信合荣景园6号楼</view>
</view>
<view class="buybox">
<view class="buy">
去支付
</view>
</view>
</view>
</view>
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom" bind:>
<view style="width: 100%;">
<van-area area-list="{{ areaList }}" bind:confirm="AreaConfirm" bind:cancel="cancel" value="110101" />
</view>
</van-popup>

View File

@ -1,39 +1,39 @@
<view class="box">
<view wx:for="{{deviceList}}" class="deviceItemBox {{item.is_first == 1?'active':''}}" bind:tap="changeDef" data-id="{{item.device_id}}" >
<view class="deviceItem">
<view class="deviceImg">
<image src="{{item.product_icon}}" mode="aspectFill" />
</view>
<view class="devicemsg">
<view class="deviceTit">{{item.product_name}}</view>
<view class="devicemsg1">
设备编号 <view>{{item.device_code}}</view>
</view>
<view class="devicemsg2">
激活时间 <view>{{item.install_time}}</view>
<view>【已服务 <text>{{item.difDay}}</text> 天】</view>
</view>
<view class="devicemsg3">
<view class="devicemsg3Item">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon1.png" mode=""/>
{{item.status == '8'?'欠费':'在用'}}
</view>
<view class="devicemsg3Item">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon2.png" mode=""/>
{{item.sevice_status == '1'?'在用':'停用'}}
</view>
<view class="devicemsg3Item">
<image wx:if="{{item.network_status == '2'}}" id="wifi" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode=""/>
<image wx:if="{{item.network_status == '1'}}" id="wifi" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon4.png" mode=""/>
{{item.network_status == '1'?'在线':'离线'}}
</view>
</view>
</view>
</view>
<view class="gray"></view>
</view>
<view class="box">
<view wx:for="{{deviceList}}" class="deviceItemBox {{item.is_first == 1?'active':''}}" bind:tap="changeDef" data-id="{{item.device_id}}" >
<view class="deviceItem">
<view class="deviceImg">
<image src="{{item.product_icon}}" mode="aspectFill" />
</view>
<view class="devicemsg">
<view class="deviceTit">{{item.product_name}}</view>
<view class="devicemsg1">
设备编号 <view>{{item.device_code}}</view>
</view>
<view class="devicemsg2">
激活时间 <view>{{item.install_time}}</view>
<view>【已服务 <text>{{item.difDay}}</text> 天】</view>
</view>
<view class="devicemsg3">
<view class="devicemsg3Item">
<image src="https://static.hshuishang.com/water_filter/mdicon1.png" mode=""/>
{{item.status == '8'?'欠费':'在用'}}
</view>
<view class="devicemsg3Item">
<image src="https://static.hshuishang.com/water_filter/mdicon2.png" mode=""/>
{{item.sevice_status == '1'?'在用':'停用'}}
</view>
<view class="devicemsg3Item">
<image wx:if="{{item.network_status == '2'}}" id="wifi" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode=""/>
<image wx:if="{{item.network_status == '1'}}" id="wifi" src="https://static.hshuishang.com/water_filter/mdicon4.png" mode=""/>
{{item.network_status == '1'?'在线':'离线'}}
</view>
</view>
</view>
</view>
<view class="gray"></view>
</view>
</view>

View File

@ -1,405 +1,406 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const app = getApp()
// pages/water_filter/filter/filter.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
filterList: [],
show: false,
currentFilter: "",
currentDevice: '',
sucessMsg: "",
Info: "",
billing_method: "",
},
reset() {
let that = this
util.postUrl4(apiArr.resetFilter, {
device_id: that.data.currentFilter.device_id,
part_id: that.data.currentFilter.id,
}, res => {
console.log(res, 'asdasd');
// if (res.data.msg == '操作成功') {
wx.showToast({
title: '重置成功!',
icon: "none"
})
that.getfilterList()
// } else {
// wx.showToast({
// title: res.data.msg,
// icon: "none"
// })
// }
})
},
getDaysBetweenDates(inputDate) {
const currentDate = new Date();
// 将传入的日期字符串转换为日期对象
const targetDate = new Date(inputDate);
// 计算两个日期之间的时间差(以毫秒为单位)
const timeDifference = currentDate - targetDate;
// 将时间差转换为天数
const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
// 返回天数
return daysDifference;
},
formatPercentage(value) {
return Math.max(0, Number((value || 0).toFixed(0)));
},
getfilterList() {
wx.showLoading({
title: '加载中...',
})
let that = this
// util.headerStorage(that, 'currentDevice', that.data.currentDevice)
util.postUrl(apiArr.getFilterListByid, {
device_id: wx.getStorageSync('device_id')
}, res => {
wx.hideLoading()
if (!res.list || !Array.isArray(res.list)) {
return that.setData({ filterList: [] })
}
res.list.forEach(item => {
console.log(item, 'zzzz');
// 计算已使用天数
item.difDay = that.getDaysBetweenDates(item.start_time || item.create_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.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
})
})
},
getFilterInfo(e) {
let that = this
util.postUrl(apiArr.deviceInfo, {
device_id: e
}, res => {
that.setData({
Info: res
})
})
},
getFilterInfo2(e) {
let that = this
util.postUrl(apiArr.deviceInfo, {
device_id: e.device_id
}, res => {
that.setData({
Info: res
})
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.currentDevice.region,
address: that.data.currentDevice.address,
parts_ids: String(e.parts_id),
total_price: e.unit_price,
remark: "",
customer_name: String(that.data.Info.customer_name),
customer_phone: String(that.data.Info.customer_phone),
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
})
},
showDesc(e) {
let that = this
that.setData({
show: !that.data.show,
currentFilter: e.currentTarget.dataset.item
})
console.log(that.data.currentFilter);
that.getFilterInfo(e.currentTarget.dataset.item.device_id)
},
pay3(e) {
let that = this
that.setData({
currentFilter: e.currentTarget.dataset.item
})
that.getFilterInfo2(e.currentTarget.dataset.item)
},
pay2() {
let that = this
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.currentDevice.region,
address: that.data.currentDevice.address,
parts_ids: String(that.data.currentFilter.parts_id),
total_price: that.data.currentFilter.unit_price,
remark: "",
customer_name: String(that.data.Info.customer_name),
customer_phone: String(that.data.Info.customer_phone),
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.orderMsg.DealerId),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
GoodsMsg: res
})
that.pay()
})
},
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.currentFilter.address,
goods_id: String(that.data.orderMsg.OrderId),
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.orderMsg.OrderNo,
quantity: 1,
remark: that.data.message,
subject: that.data.currentFilter.parts_name,
term_no: that.data.GoodsMsg.term_no,
total_amount: String(that.data.currentFilter.unit_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if (fal.errMsg == 'requestPayment:fail cancel') {
that.payFail(2)
} else {
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.OrderId,
type: "3",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
// merchant_no:that.data.GoodsMsg.merchant_no,
// term_no:that.data.GoodsMsg.term_no,
// out_trade_no:that.data.orderMsg.order_no
merchant_no: that.data.GoodsMsg.merchant_no,
term_no: that.data.GoodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo
}, res => {
console.log(res);
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
show: false
})
// wx.requestSubscribeMessage({
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
// })
that.getfilterList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//变更订单状态
changeOrderState() {
wx.showLoading({
title: '查询中...',
})
let that = this
util.postUrl(apiArr.changeOrderState, {
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.sucessMsg.out_trade_no,
payer_amount: that.data.sucessMsg.payer_amount,
total_amount: that.data.sucessMsg.total_amount,
trade_status: that.data.sucessMsg.trade_state,
trade_time: that.data.sucessMsg.trade_time
}, res => {
wx.hideLoading()
setTimeout(() => {
that.getfilterList()
}, 1500)
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
handleNavigateBack() {
wx.navigateBack({ delta: 1 })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
this.setData({
billing_method: wx.getStorageSync('billing_method'),
currentDevice: wx.getStorageSync('currentDevice')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getfilterList()
},
/**
* 生命周期函数--监听页面隐藏
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const app = getApp()
// pages/water_filter/filter/filter.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
filterList: [],
show: false,
currentFilter: "",
currentDevice: '',
sucessMsg: "",
Info: "",
billing_method: "",
},
reset() {
let that = this
// 用户侧走 wechat 域 + ctoken勿依赖 atoken
util.postUrl(apiArr.resetFilterUser, {
device_id: that.data.currentFilter.device_id,
part_id: that.data.currentFilter.id,
}, res => {
if (res && res.msg == '操作成功') {
wx.showToast({
title: '重置成功!',
icon: "none"
})
that.getfilterList()
} else {
wx.showToast({
title: (res && res.msg) || '重置失败',
icon: "none"
})
}
})
},
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;
},
formatPercentage(value) {
return Math.max(0, Number((value || 0).toFixed(0)));
},
getfilterList() {
wx.showLoading({
title: '加载中...',
})
let that = this
// util.headerStorage(that, 'currentDevice', that.data.currentDevice)
util.postUrl(apiArr.getFilterListByid, {
device_id: wx.getStorageSync('device_id')
}, res => {
wx.hideLoading()
if (!res.list || !Array.isArray(res.list)) {
return that.setData({ filterList: [] })
}
res.list.forEach(item => {
console.log(item, 'zzzz');
// 计算已使用天数
item.difDay = that.getDaysBetweenDates(item.start_time || item.create_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.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
})
})
},
getFilterInfo(e) {
let that = this
util.postUrl(apiArr.deviceInfo, {
device_id: e
}, res => {
that.setData({
Info: res
})
})
},
getFilterInfo2(e) {
let that = this
util.postUrl(apiArr.deviceInfo, {
device_id: e.device_id
}, res => {
that.setData({
Info: res
})
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.currentDevice.region,
address: that.data.currentDevice.address,
parts_ids: String(e.parts_id),
total_price: e.unit_price,
remark: "",
customer_name: String(that.data.Info.customer_name),
customer_phone: String(that.data.Info.customer_phone),
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
})
},
showDesc(e) {
let that = this
that.setData({
show: !that.data.show,
currentFilter: e.currentTarget.dataset.item
})
console.log(that.data.currentFilter);
that.getFilterInfo(e.currentTarget.dataset.item.device_id)
},
pay3(e) {
let that = this
that.setData({
currentFilter: e.currentTarget.dataset.item
})
that.getFilterInfo2(e.currentTarget.dataset.item)
},
pay2() {
let that = this
util.postUrl(apiArr.createDeviceOrder, {
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.currentDevice.region,
address: that.data.currentDevice.address,
parts_ids: String(that.data.currentFilter.parts_id),
total_price: that.data.currentFilter.unit_price,
remark: "",
customer_name: String(that.data.Info.customer_name),
customer_phone: String(that.data.Info.customer_phone),
user_id: Number(wx.getStorageSync('userId')),
is_up_door: 1
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.orderMsg.DealerId),
user_id: Number(wx.getStorageSync('userId')),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
GoodsMsg: res
})
that.pay()
})
},
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.currentFilter.address,
goods_id: String(that.data.orderMsg.OrderId),
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.orderMsg.OrderNo,
quantity: 1,
remark: that.data.message,
subject: that.data.currentFilter.parts_name,
term_no: that.data.GoodsMsg.term_no,
total_amount: String(that.data.currentFilter.unit_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
if (fal.errMsg == 'requestPayment:fail cancel') {
that.payFail(2)
} else {
that.payFail(1)
}
}
})
}
})
},
payFail(e) {
let that = this
util.postUrl(PayJs.payFail, {
order_id: that.data.orderMsg.OrderId,
type: "3",
state: e,
}, res => {
console.log(res);
})
},
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
// merchant_no:that.data.GoodsMsg.merchant_no,
// term_no:that.data.GoodsMsg.term_no,
// out_trade_no:that.data.orderMsg.order_no
merchant_no: that.data.GoodsMsg.merchant_no,
term_no: that.data.GoodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo
}, res => {
console.log(res);
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
show: false
})
// wx.requestSubscribeMessage({
// tmplIds:["5yPg-WOoP9-9ZU1fHjC4zg1KNaPWb76K87JzzKb58f0"]
// })
that.getfilterList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//变更订单状态
changeOrderState() {
wx.showLoading({
title: '查询中...',
})
let that = this
util.postUrl(apiArr.changeOrderState, {
merchant_no: that.data.GoodsMsg.merchant_no,
out_trade_no: that.data.sucessMsg.out_trade_no,
payer_amount: that.data.sucessMsg.payer_amount,
total_amount: that.data.sucessMsg.total_amount,
trade_status: that.data.sucessMsg.trade_state,
trade_time: that.data.sucessMsg.trade_time
}, res => {
wx.hideLoading()
setTimeout(() => {
that.getfilterList()
}, 1500)
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
handleNavigateBack() {
wx.navigateBack({ delta: 1 })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
this.setData({
billing_method: wx.getStorageSync('billing_method'),
currentDevice: wx.getStorageSync('currentDevice')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getfilterList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,93 +1,93 @@
<view class="box">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
滤芯详情
</view>
<view class="nav-bar-right">
</view>
</view>
</view>
<view class="msg">
滤芯状态(滤芯寿命与水温、水质、出水量等相关)
</view>
<view class="blocks"></view>
<view class="filterList" wx:if="{{filterList.length > 0}}">
<view class="filterItem" wx:for="{{filterList}}" bind:tap="showDesc" data-item="{{item}}">
<view class="filter_Item_Info">
<view class="filter_Item_Info_image">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/filter_item_icon.png" mode="widthFix" />
</view>
<view class="filter_Item_Info_msg">
<view class="filter_Item_Info_name">{{item.parts_name}}</view>
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method != 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
{{item.percentageDay}}%
</view>
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
{{item.percentageCapacity}}%
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 1}}">
<!-- <view class="hide"></view> -->
<view class="filter_Item_Info_descText">
预计剩余寿命:{{item.available_days}}天
</view>
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 2}}">
<!-- <view class="hide"></view> -->
<view class="filter_Item_Info_descText">
预计剩余寿命:{{item.remaining_volume}}升
</view>
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 3}}">
<view class="payBtn" catch:tap="pay3" data-item="{{item}}">购买</view>
<view class="filter_Item_Info_descText"> 预计剩余寿命:{{item.available_days}}天</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{filterList.length == 0}}">
<van-empty description="暂无滤芯" />
</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose" round close-on-click-overlay>
<view class="popView">
<view class="pop_cir">
<van-circle wx:if="{{billing_method != 2}}" value="{{currentFilter.percentageDay}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
</van-circle>
<van-circle wx:if="{{billing_method == 2}}" value="{{currentFilter.percentageCapacity}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
</van-circle>
<view class="cir_msg">
<view class="percentage" wx:if="{{billing_method != '2'}}">{{currentFilter.percentageDay}}%</view>
<view class="percentage" wx:if="{{billing_method == '2'}}">{{currentFilter.percentageCapacity}}%</view>
<view class="cir_msg_text">滤芯寿命</view>
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
</view>
</view>
<view class="pop_Tit">{{currentFilter.parts_name}}</view>
<view class="pop_msg">{{currentFilter.introduce}}</view>
<!-- <view class="pop_btn" bind:tap="pay2" wx:if="{{currentFilter.status != 2}}">购买</view> -->
<view class="pop_btn" bind:tap="reset" wx:if="{{currentFilter.status == 2}}">重置</view>
</view>
<view class="box">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://static.hshuishang.com/water_filter/back_black.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
滤芯详情
</view>
<view class="nav-bar-right">
</view>
</view>
</view>
<view class="msg">
滤芯状态(滤芯寿命与水温、水质、出水量等相关)
</view>
<view class="blocks"></view>
<view class="filterList" wx:if="{{filterList.length > 0}}">
<view class="filterItem" wx:for="{{filterList}}" bind:tap="showDesc" data-item="{{item}}">
<view class="filter_Item_Info">
<view class="filter_Item_Info_image">
<image src="https://static.hshuishang.com/water_filter/filter_item_icon.png" mode="widthFix" />
</view>
<view class="filter_Item_Info_msg">
<view class="filter_Item_Info_name">{{item.parts_name}}</view>
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method != 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
{{item.percentageDay}}%
</view>
<view style="display: flex;align-items: center;width: 100%;" wx:if="{{billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
{{item.percentageCapacity}}%
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 1}}">
<!-- <view class="hide"></view> -->
<view class="filter_Item_Info_descText">
预计剩余寿命:{{item.available_days}}天
</view>
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 2}}">
<!-- <view class="hide"></view> -->
<view class="filter_Item_Info_descText">
预计剩余寿命:{{item.remaining_volume}}升
</view>
</view>
<view class="filter_Item_Info_desc" wx:if="{{billing_method == 3}}">
<view class="payBtn" catch:tap="pay3" data-item="{{item}}">购买</view>
<view class="filter_Item_Info_descText"> 预计剩余寿命:{{item.available_days}}天</view>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{filterList.length == 0}}">
<van-empty description="暂无滤芯" />
</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose" round close-on-click-overlay>
<view class="popView">
<view class="pop_cir">
<van-circle wx:if="{{billing_method != 2}}" value="{{currentFilter.percentageDay}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
</van-circle>
<van-circle wx:if="{{billing_method == 2}}" value="{{currentFilter.percentageCapacity}}" size="120" color="#FFD5D5" stroke-width="9" layer-color="#f4f4f4">
</van-circle>
<view class="cir_msg">
<view class="percentage" wx:if="{{billing_method != '2'}}">{{currentFilter.percentageDay}}%</view>
<view class="percentage" wx:if="{{billing_method == '2'}}">{{currentFilter.percentageCapacity}}%</view>
<view class="cir_msg_text">滤芯寿命</view>
<view class="cir_msg_text2">{{currentFilter.available_days}}天</view>
</view>
</view>
<view class="pop_Tit">{{currentFilter.parts_name}}</view>
<view class="pop_msg">{{currentFilter.introduce}}</view>
<!-- <view class="pop_btn" bind:tap="pay2" wx:if="{{currentFilter.status != 2}}">购买</view> -->
<view class="pop_btn" bind:tap="reset" wx:if="{{currentFilter.status == 2}}">重置</view>
</view>
</van-popup>

View File

@ -1,275 +1,276 @@
// pages/water_filter/RechargeRecord/RechargeRecord.js
const app = getApp()
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
page_num: 1,
page_size: 10,
flag: false,
List: [],
tab: [
{
name: "全部",
type: "0"
},
{
name: "待分配",
type: "1"
},
{
name: "待更换",
type: "2"
},
{
name: "已完成",
type: "3"
},
{
name: "已取消",
type: "4"
}
],
state: 0,
selectPackage: ""
},
changeTab(e) {
console.log(e);
let that = this
that.setData({
state: e.currentTarget.dataset.tab,
flag: false,
page_num: 1,
List: []
})
that.getPayList()
},
getPayList() {
wx.showLoading({
title: '加载中...',
mask:true
})
let that = this
util.postUrl(apiArr.getFilterChangeList, {
page_num: that.data.page_num,
page_size: that.data.page_size,
status: that.data.state,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading()
if (res.rows) {
let flag
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
console.log(item, 'item');
if (item.part_list) {
item.part_ids = item.part_list.map(items => items.parts_id).join(',')
}
})
that.setData({
flag,
List: that.data.List.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
pay2(e) {
let that = this
that.setData({
selectPackage: e.currentTarget.dataset.item
})
that.pay3()
},
pay3() {
let that = this
util.postUrl(apiArr.createDeviceOrder, {
customer_name: that.data.selectPackage.customer_name,
customer_phone: that.data.selectPackage.customer_phone,
total_price: Number(that.data.selectPackage.total_price),
parts_ids: that.data.selectPackage.parts_ids,
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.selectPackage.region,
address: that.data.selectPackage.address,
parts_ids: that.data.selectPackage.part_ids,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.selectPackage.dealer_id),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.orderMsg.Region + that.data.orderMsg.Address,
goods_id: that.data.orderMsg.order_name,
remark: "",
subject: that.data.orderMsg.OrderName,
term_no: that.data.goodsMsg.term_no,
total_amount:String(that.data.selectPackage.total_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.OrderNo),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
console.log(fal);
}
})
}
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo,
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
flag: false,
page_num: 1,
List: []
})
this.getPayList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getPayList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPayList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
// pages/water_filter/RechargeRecord/RechargeRecord.js
const app = getApp()
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
page_num: 1,
page_size: 10,
flag: false,
List: [],
tab: [
{
name: "全部",
type: "0"
},
{
name: "待分配",
type: "1"
},
{
name: "待更换",
type: "2"
},
{
name: "已完成",
type: "3"
},
{
name: "已取消",
type: "4"
}
],
state: 0,
selectPackage: ""
},
changeTab(e) {
console.log(e);
let that = this
that.setData({
state: e.currentTarget.dataset.tab,
flag: false,
page_num: 1,
List: []
})
that.getPayList()
},
getPayList() {
wx.showLoading({
title: '加载中...',
mask:true
})
let that = this
util.postUrl(apiArr.getFilterChangeList, {
page_num: that.data.page_num,
page_size: that.data.page_size,
status: that.data.state,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
wx.hideLoading()
if (res.rows) {
let flag
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
res.rows.forEach(item => {
console.log(item, 'item');
if (item.part_list) {
item.part_ids = item.part_list.map(items => items.parts_id).join(',')
}
})
that.setData({
flag,
List: that.data.List.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
pay2(e) {
let that = this
that.setData({
selectPackage: e.currentTarget.dataset.item
})
that.pay3()
},
pay3() {
let that = this
util.postUrl(apiArr.createDeviceOrder, {
customer_name: that.data.selectPackage.customer_name,
customer_phone: that.data.selectPackage.customer_phone,
total_price: Number(that.data.selectPackage.total_price),
parts_ids: that.data.selectPackage.part_ids || that.data.selectPackage.parts_ids,
device_id: Number(wx.getStorageSync('device_id')),
region: that.data.selectPackage.region,
address: that.data.selectPackage.address,
is_up_door: Number(that.data.selectPackage.is_up_door) || 1,
user_id: Number(wx.getStorageSync('userId'))
}, res => {
that.setData({
orderMsg: res
})
that.getGoodsMsg()
})
},
//获取商户id
getGoodsMsg() {
let that = this
util.postUrl(apiArr.getCurrentShopMsg, {
dealer_id: Number(that.data.selectPackage.dealer_id),
shop_id: Number(wx.getStorageSync('shopId')),
}, res => {
that.setData({
goodsMsg: res
})
that.pay()
})
},
//预支付
pay() {
let that = this
util.postUrl2(PayJs.pay, {
address: that.data.orderMsg.Region + that.data.orderMsg.Address,
goods_id: that.data.orderMsg.order_name,
remark: "",
subject: that.data.orderMsg.OrderName,
term_no: that.data.goodsMsg.term_no,
total_amount:String(that.data.selectPackage.total_price * 100),
// total_amount: String(1),
user: String(wx.getStorageSync('userId')),
merchant_no: that.data.goodsMsg.merchant_no,
out_trade_no: String(that.data.orderMsg.OrderNo),
user_id: wx.getStorageSync('openId')
}, res => {
const { resp_data, msg } = res.data.data
if (msg == '成功') {
wx.requestPayment({
timeStamp: String(resp_data.acc_resp_fields.time_stamp),
nonceStr: String(resp_data.acc_resp_fields.nonce_str),
package: String(resp_data.acc_resp_fields.package),
signType: String(resp_data.acc_resp_fields.sign_type),
paySign: String(resp_data.acc_resp_fields.pay_sign),
success(res) {
that.queryPay()
},
fail(fal) {
console.log(fal);
}
})
}
})
},
//查询支付结果
queryPay() {
let that = this
util.postUrl2(PayJs.queryPay, {
merchant_no: that.data.goodsMsg.merchant_no,
term_no: that.data.goodsMsg.term_no,
out_trade_no: that.data.orderMsg.OrderNo,
}, res => {
if (res.statusCode == '200') {
wx.showToast({
title: '支付成功!',
})
that.setData({
flag: false,
page_num: 1,
List: []
})
this.getPayList()
} else {
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getPayList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getPayList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,61 +1,61 @@
<view class="box">
<view class="form">
<view class="form_Tit">基本信息</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯名称</view>
<view class="form_Item_con">后置活性炭</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯编码</view>
<view class="form_Item_con">HXTHLX</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">单价</view>
<view class="form_Item_con">58元</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">数量</view>
<view class="form_Item_con">1个</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯图片</view>
<view class="form_Item_con">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/goods.png" mode="widthFix"/>
</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">设备编号</view>
<view class="form_Item_con">123456785</view>
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="form_Tit2">订单信息</view>
<view class="form_Item">
<view class="form_Item_ask">订单状态</view>
<view class="form_Item_con">待支付</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">订单编号</view>
<view class="form_Item_con">202512541236545266515</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货人</view>
<view class="form_Item_con">杜胜男</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货手机号</view>
<view class="form_Item_con">15901518415</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货地址</view>
<view class="form_Item_con">
河北省衡水市桃城区信合荣景园 6号楼
</view>
</view>
</view>
<view class="box">
<view class="form">
<view class="form_Tit">基本信息</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯名称</view>
<view class="form_Item_con">后置活性炭</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯编码</view>
<view class="form_Item_con">HXTHLX</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">单价</view>
<view class="form_Item_con">58元</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">数量</view>
<view class="form_Item_con">1个</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">滤芯图片</view>
<view class="form_Item_con">
<image src="https://static.hshuishang.com/water_filter/goods.png" mode="widthFix"/>
</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">设备编号</view>
<view class="form_Item_con">123456785</view>
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="form_Tit2">订单信息</view>
<view class="form_Item">
<view class="form_Item_ask">订单状态</view>
<view class="form_Item_con">待支付</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">订单编号</view>
<view class="form_Item_con">202512541236545266515</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货人</view>
<view class="form_Item_con">杜胜男</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货手机号</view>
<view class="form_Item_con">15901518415</view>
</view>
<view class="form_Item">
<view class="form_Item_ask">收货地址</view>
<view class="form_Item_con">
河北省衡水市桃城区信合荣景园 6号楼
</view>
</view>
</view>
</view>

View File

@ -1,51 +1,51 @@
<view class="box">
<view class="payList">
<view class="payItem" wx:for="{{3}}">
<view class="payItem_tit">
<view class="payItem_tit_time">2024-12-20 10:31:48</view>
<view class="payItem_tit_state">未支付</view>
</view>
<view class="payItem_goods">
<view class="payItem_goods_img"><image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/goods.png" mode="widthFix"/></view>
<view class="payItem_goods_msg">
<view class="payItem_goods_msg_orderNum">订单编号20250228150122105</view>
<view class="payItem_goods_msg_orderName">滤芯名称:后置活性炭</view>
<view class="payItem_goods_msg_orderPrice">价格58</view>
</view>
</view>
<view class="rows">
<view class="rows_tit">实付款</view>
<view class="rows_con">58</view>
</view>
<view class="rows">
<view class="rows_tit">支付方式</view>
<view class="rows_con">微信</view>
</view>
<view class="rows">
<view class="rows_tit">收货人名称</view>
<view class="rows_con">杜胜男</view>
</view>
<view class="rows">
<view class="rows_tit">收货人手机</view>
<view class="rows_con">15901518415</view>
</view>
<view class="rows">
<view class="rows_tit">收货人地址</view>
<view class="rows_con">河北省衡水市桃城区信合荣景园6号楼</view>
</view>
<view class="buybox">
<view class="buy">
去支付
</view>
</view>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
<view class="box">
<view class="payList">
<view class="payItem" wx:for="{{3}}">
<view class="payItem_tit">
<view class="payItem_tit_time">2024-12-20 10:31:48</view>
<view class="payItem_tit_state">未支付</view>
</view>
<view class="payItem_goods">
<view class="payItem_goods_img"><image src="https://static.hshuishang.com/water_filter/goods.png" mode="widthFix"/></view>
<view class="payItem_goods_msg">
<view class="payItem_goods_msg_orderNum">订单编号20250228150122105</view>
<view class="payItem_goods_msg_orderName">滤芯名称:后置活性炭</view>
<view class="payItem_goods_msg_orderPrice">价格58</view>
</view>
</view>
<view class="rows">
<view class="rows_tit">实付款</view>
<view class="rows_con">58</view>
</view>
<view class="rows">
<view class="rows_tit">支付方式</view>
<view class="rows_con">微信</view>
</view>
<view class="rows">
<view class="rows_tit">收货人名称</view>
<view class="rows_con">杜胜男</view>
</view>
<view class="rows">
<view class="rows_tit">收货人手机</view>
<view class="rows_con">15901518415</view>
</view>
<view class="rows">
<view class="rows_tit">收货人地址</view>
<view class="rows_con">河北省衡水市桃城区信合荣景园6号楼</view>
</view>
<view class="buybox">
<view class="buy">
去支付
</view>
</view>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +1,114 @@
<view class="box">
<!-- 报修 -->
<view wx:if="{{!sucess}}">
<view class="information">
<view class="title">基本信息</view>
<view class="information_row" bindtap="headerEquipmentPopupClick">
<view class="information_tit">设备型号</view>
<view class="information_ipt">
<input type="text" value="{{selectEquipment.device_code}}" placeholder="请填写您的设备型号" disabled placeholder-class="information_ipt_pla" />
</view>
</view>
<view class="information_row">
<view class="information_tit">联系人</view>
<view class="information_ipt">
<input type="text" placeholder="请填写联系人" placeholder-class="information_ipt_pla" value="{{name}}" bindinput="ipt1" />
</view>
</view>
<view class="information_row">
<view class="information_tit">联系电话</view>
<view class="information_ipt">
<input type="number" maxlength="11" placeholder="请填写您的联系电话" placeholder-class="information_ipt_pla" value="{{phone}}" bindinput="ipt2" />
</view>
</view>
<view class="information_row">
<view class="information_tit">省市区</view>
<view class="information_ipt">
<input type="number" bind:tap="choseRegion" disabled placeholder="请选择省市区" placeholder-class="information_ipt_pla" value="{{region}}" bindinput="ipt2" />
</view>
</view>
<view class="information_row">
<view class="information_tit">详细地址</view>
<view class="information_ipt">
<input type="text" placeholder="请填写您的详细地址" placeholder-class="information_ipt_pla" value="{{address}}" bindinput="ipt4" />
</view>
</view>
<view class="information_row noneBorder">
<view class="information_tit">期望上门时间</view>
<view style="flex: 1;text-align: right;" bindtap="switchShow">
{{time}}
<van-icon name="arrow" size="16" color="#D5AC66" />
</view>
</view>
</view>
<view class="gray"></view>
<view class="containerMsg">
<view class="title">报修内容</view>
<van-field value="{{ message }}" bindinput="ipt3" autosize show-word-limit maxlength="50" type="textarea" placeholder="请输入留言" border="{{ false }}" />
</view>
<view class="gray"></view>
<view class="uploadImg">
<view class="title">图片上传</view>
<view style="margin-top: 20rpx;">
<van-uploader file-list="{{ fileList }}" max-count="1" before-read="beforeRead" bind:after-read="beforeRead" bind:delete="deleteImg" upload-icon="plus" />
</view>
</view>
<view class="btn" bind:tap="submit">
提交
</view>
</view>
<!-- 报修成功 -->
<view wx:if="{{sucess}}" class="sucess">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/maintenance_sucess.png" mode="widthFix" id="sucess" />
<view class="sucess_msgTit">提交成功</view>
</view>
</view>
<van-popup show="{{ DoorTimeShow }}" close-on-click-overlay position="bottom" custom-style="height: 40%;" bind:close="onClose">
<van-datetime-picker formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" bind:cancel="onClose" />
</van-popup>
<van-popup show="{{ equipmentShow }}" close-on-click-overlay position="bottom" round custom-style="height: 40%;" bind:close="onClosePopup">
<view class="equipment">
<view class="equipment_title" bindtap="headerCancelClick">
<text>取消</text>
</view>
<view class="equip_item {{index === equipmentList.length -1 && 'no_bottom'}}" wx:for="{{equipmentList}}" wx:key="index" bindtap="headerSelectClick" data-item="{{item}}">
<image class="equip_pic" src="{{item.product_icon}}" mode="" />
<view class="equip_desc">{{item.device_code}}</view>
</view>
</view>
</van-popup>
<!-- 省市区 -->
<van-popup show="{{ show2 }}" custom-style="height: 40%;" safe-area-inset-bottom lock-scroll bind:close="onClose2" round close-on-click-overlay position="bottom">
<view class="popup_title">
<view class="popup_label" bind:tap="onClose2">取消</view>
<view class="popup_label color_blue" bind:tap="onOk">确认</view>
</view>
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 500rpx;" value="{{value}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{cityList}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{newAreaList}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{newBusiness}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.business_name}}</view>
</picker-view-column>
</picker-view>
<view class="box">
<!-- 报修 -->
<view wx:if="{{!sucess}}">
<view class="information">
<view class="title">基本信息</view>
<view class="information_row" bindtap="headerEquipmentPopupClick">
<view class="information_tit">设备型号</view>
<view class="information_ipt">
<input type="text" value="{{selectEquipment.device_code}}" placeholder="请填写您的设备型号" disabled placeholder-class="information_ipt_pla" />
</view>
</view>
<view class="information_row">
<view class="information_tit">联系人</view>
<view class="information_ipt">
<input type="text" placeholder="请填写联系人" placeholder-class="information_ipt_pla" value="{{name}}" bindinput="ipt1" />
</view>
</view>
<view class="information_row">
<view class="information_tit">联系电话</view>
<view class="information_ipt">
<input type="number" maxlength="11" placeholder="请填写您的联系电话" placeholder-class="information_ipt_pla" value="{{phone}}" bindinput="ipt2" />
</view>
</view>
<view class="information_row">
<view class="information_tit">省市区</view>
<view class="information_ipt">
<input type="number" bind:tap="choseRegion" disabled placeholder="请选择省市区" placeholder-class="information_ipt_pla" value="{{region}}" bindinput="ipt2" />
</view>
</view>
<view class="information_row">
<view class="information_tit">详细地址</view>
<view class="information_ipt">
<input type="text" placeholder="请填写您的详细地址" placeholder-class="information_ipt_pla" value="{{address}}" bindinput="ipt4" />
</view>
</view>
<view class="information_row noneBorder">
<view class="information_tit">期望上门时间</view>
<view style="flex: 1;text-align: right;" bindtap="switchShow">
{{time}}
<van-icon name="arrow" size="16" color="#D5AC66" />
</view>
</view>
</view>
<view class="gray"></view>
<view class="containerMsg">
<view class="title">报修内容</view>
<van-field value="{{ message }}" bindinput="ipt3" autosize show-word-limit maxlength="50" type="textarea" placeholder="请输入留言" border="{{ false }}" />
</view>
<view class="gray"></view>
<view class="uploadImg">
<view class="title">图片上传</view>
<view style="margin-top: 20rpx;">
<van-uploader file-list="{{ fileList }}" max-count="1" before-read="beforeRead" bind:after-read="beforeRead" bind:delete="deleteImg" upload-icon="plus" />
</view>
</view>
<view class="btn" bind:tap="submit">
提交
</view>
</view>
<!-- 报修成功 -->
<view wx:if="{{sucess}}" class="sucess">
<image src="https://static.hshuishang.com/water_filter/maintenance_sucess.png" mode="widthFix" id="sucess" />
<view class="sucess_msgTit">提交成功</view>
</view>
</view>
<van-popup show="{{ DoorTimeShow }}" close-on-click-overlay position="bottom" custom-style="height: 40%;" bind:close="onClose">
<van-datetime-picker formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" bind:cancel="onClose" />
</van-popup>
<van-popup show="{{ equipmentShow }}" close-on-click-overlay position="bottom" round custom-style="height: 40%;" bind:close="onClosePopup">
<view class="equipment">
<view class="equipment_title" bindtap="headerCancelClick">
<text>取消</text>
</view>
<view class="equip_item {{index === equipmentList.length -1 && 'no_bottom'}}" wx:for="{{equipmentList}}" wx:key="index" bindtap="headerSelectClick" data-item="{{item}}">
<image class="equip_pic" src="{{item.product_icon}}" mode="" />
<view class="equip_desc">{{item.device_code}}</view>
</view>
</view>
</van-popup>
<!-- 省市区 -->
<van-popup show="{{ show2 }}" custom-style="height: 40%;" safe-area-inset-bottom lock-scroll bind:close="onClose2" round close-on-click-overlay position="bottom">
<view class="popup_title">
<view class="popup_label" bind:tap="onClose2">取消</view>
<view class="popup_label color_blue" bind:tap="onOk">确认</view>
</view>
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 500rpx;" value="{{value}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{cityList}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{newAreaList}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{newBusiness}}" wx:key="index" style="line-height: 50px; text-align: center;">{{item.business_name}}</view>
</picker-view-column>
</picker-view>
</van-popup>

View File

@ -1,169 +1,170 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/WaterPurifier/pages/shareDerive/shareDerive.js
Page({
/**
* 页面的初始数据
*/
data: {
imagePath:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test_qrcode.jpg",
},
getImg(){
let that = this
util.postUrl(apiArr.createQrcode,{
// page:'packages/WaterPurifier/pages/shareWaterFilter/shareWaterFilter',
page:'/page/index/index',
scene:`device=${wx.getStorageSync('device_id')}`
},res=>{
let img = util.img_url + res.data
that.setData({
imagePath:img
})
return
wx.downloadFile({
url: img, // 网络图片地址
success(res) {
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
console.log(tempFilePath);
that.setData({
imagePath:tempFilePath
})
}
},
fail() {
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
})
},
saveImg(){
const that = this;
wx.downloadFile({
url: that.data.imagePath, // 网络图片地址
success(res) {
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
// 2. 检查用户授权
wx.getSetting({
success(settingRes) {
if (!settingRes.authSetting['scope.writePhotosAlbum']) {
// 未授权,请求授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 授权成功,保存图片
that.saveImageToAlbum(tempFilePath);
},
fail() {
// 授权失败,提示用户手动打开授权
wx.showModal({
title: '提示',
content: '需要授权保存图片到相册,请手动打开授权设置',
success(modalRes) {
if (modalRes.confirm) {
wx.openSetting(); // 打开授权设置页面
}
}
});
}
});
} else {
// 已授权,保存图片
that.saveImageToAlbum(tempFilePath);
}
}
});
}
},
fail() {
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
},
saveImageToAlbum(tempFilePath) {
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
wx.showToast({
title: '保存成功',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
// that.getImg()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/WaterPurifier/pages/shareDerive/shareDerive.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
imagePath:(__staticUrl + '/test_qrcode.jpg'),
},
getImg(){
let that = this
util.postUrl(apiArr.createQrcode,{
// page:'packages/WaterPurifier/pages/shareWaterFilter/shareWaterFilter',
page:'/page/index/index',
scene:`device=${wx.getStorageSync('device_id')}`
},res=>{
let img = util.img_url + res.data
that.setData({
imagePath:img
})
return
wx.downloadFile({
url: img, // 网络图片地址
success(res) {
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
console.log(tempFilePath);
that.setData({
imagePath:tempFilePath
})
}
},
fail() {
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
})
},
saveImg(){
const that = this;
wx.downloadFile({
url: that.data.imagePath, // 网络图片地址
success(res) {
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
// 2. 检查用户授权
wx.getSetting({
success(settingRes) {
if (!settingRes.authSetting['scope.writePhotosAlbum']) {
// 未授权,请求授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 授权成功,保存图片
that.saveImageToAlbum(tempFilePath);
},
fail() {
// 授权失败,提示用户手动打开授权
wx.showModal({
title: '提示',
content: '需要授权保存图片到相册,请手动打开授权设置',
success(modalRes) {
if (modalRes.confirm) {
wx.openSetting(); // 打开授权设置页面
}
}
});
}
});
} else {
// 已授权,保存图片
that.saveImageToAlbum(tempFilePath);
}
}
});
}
},
fail() {
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
},
saveImageToAlbum(tempFilePath) {
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
wx.showToast({
title: '保存成功',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
// that.getImg()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,362 +1,363 @@
import * as echarts from '../../component/ec-canvas/echarts';
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const app = getApp({allowDefault:true})
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
// 功能列表
functional_List: [{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_407.png",
"name": "一键报修",
// "url": "packages/WaterPurifier/pages/repair/repair",
"url": `../../../WaterPurifier/pages/repair/repair`,
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_408.png",
"name": "购买滤芯",
"url": "../Recharge/Recharge",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_409.png",
"name": "充值记录",
"url": "../RechargeRecord/RechargeRecord",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_410.png",
"name": "滤芯详情",
"url": "../filter/filter",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_411.png",
"name": "设备分享",
// "url": "https://zhsq.hshuishang.com/wap/community/order/community_id/0",
"url":"../shareDerive/shareDerive",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_412.png",
"name": "客服中心",
// "url": "https://zhsq.hshuishang.com/user/appoint/index",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_413.png",
"name": "维修工单",
"url": "../upKeep/upKeep",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_414.png",
"name": "滤芯更换记录",
// "url": "https://zhsq.hshuishang.com/user/exchange/index",
"type": "h5"
}
],
// 滤芯寿命
progress_List: [{
"name": "HXTH滤芯",
"progress": 97.41
},
{
"name": "RO膜滤芯",
"progress": 87.41
},
{
"name": "PP+CB滤芯",
"progress": 40.41
},
{
"name": "PP棉滤芯",
"progress": 90.41
}
],
imagePath: '',
ec: {
onInit: initChart
},
imagePath: '',
page_num:1,
page_size:10,
currentDevice:[],
deviceId:"",
},
partner(){
wx.navigateTo({
url: '../../../partner/pages/partner',
})
},
device(){
wx.navigateTo({
url: '../device/myDevice/myDevice',
})
},
handleNavigateBack(){
wx.navigateBack({delta:1})
},
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);
}
});
},
maintenanceList(){
wx.navigateTo({
url: '../Maintenance/Maintenance',
})
},
buyFilter(){
wx.navigateTo({
url: '../Buyfilter/Buyfilter',
})
},
NotOpen(){
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel:false,
complete: (res) => {
if (res.cancel) {
}
}
})
},
jump(e){
if(!e.target.dataset.url){
this.NotOpen()
}
wx.navigateTo({
url: e.target.dataset.url,
})
},
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)
})
})
},
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;
},
//获取用户设备
getDeviceList(){
let that = this
util.postUrl(apiArr.getUserList,{
page_num:that.data.page_num,
page_size:that.data.page_size
},res=>{
let currentDevice = {}
res.rows.forEach(item=>{
if(item.is_first == 1){
currentDevice = item
item.install_time = item.install_time.slice(0,10)
item.difDay = that.getDaysBetweenDates(item.install_time)
wx.setStorageSync('device_id', item.device_id),
wx.setStorageSync('dealer_id', item.dealer_id)
// wx.setStorageSync('device_code', item.)
wx.setStorageSync('currentDevice', item)
}
})
that.setData({
currentDevice
})
})
},
getDeviceInfo(){
let that = this
util.postUrl(apiArr.deviceInfo,{
device_id:Number(that.data.deviceId)
},res=>{
res.device.difDay = that.getDaysBetweenDates(res.device.install_time)
that.setData({
currentDevice:res.device
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
let that = this
that.setData({
deviceId:options.device
})
that.getDeviceInfo()
setTimeout(()=>{
const ecComponent = that.selectComponent("#mychart-dom-bar")
// 将 canvas 内容转换为临时图片文件
ecComponent.canvasToTempFilePath({
// canvasId: 'mychart-dom-bar',
success: (result) => {
this.base64({
url:result.tempFilePath,
type:'png',
}).then((res)=>{
that.setData({
imagePath:res
})
})
// console.log('转换成功,图片路径:', result.tempFilePath);
},
fail: (err) => {
console.error('转换失败:', err);
}
});
},2000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
setTimeout(()=>{
this.convertCanvasToImage()
},5000)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
// that.getDeviceList()
},
/**
* 生命周期函数--监听页面隐藏
*/
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']
},
yAxis: {
type: 'value',
data: ['0ml','560ml']
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'bar',
barWidth: 15,
itemStyle: { //柱状颜色和圆角
color: {
x:0,
y:1,
colorStops:[{
offset: 0,
color: '#FFBBAC',
},{
offset: 1,
color: '#2583FF'
}]
},
barBorderRadius: [5, 5, 0, 0], // (顺时针左上,右上,右下,左下)
},
}]
};
chart.setOption(option);
wx.canvasToTempFilePath({
canvasId: 'mychart-bar',
success: (res) => {
this.setData({
imagePath: res.tempFilePath
});
},
fail: (err) => {
console.error('Canvas to image failed:', err);
},
},this);
return chart;
}
import * as echarts from '../../component/ec-canvas/echarts';
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const app = getApp({allowDefault:true})
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
// 功能列表
functional_List: [{
"image": (__staticUrl + '/water_filter/Group_407.png'),
"name": "一键报修",
// "url": "packages/WaterPurifier/pages/repair/repair",
"url": `../../../WaterPurifier/pages/repair/repair`,
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_408.png'),
"name": "购买滤芯",
"url": "../Recharge/Recharge",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_409.png'),
"name": "充值记录",
"url": "../RechargeRecord/RechargeRecord",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_410.png'),
"name": "滤芯详情",
"url": "../filter/filter",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_411.png'),
"name": "设备分享",
// "url": "https://zhsq.hshuishang.com/wap/community/order/community_id/0",
"url":"../shareDerive/shareDerive",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_412.png'),
"name": "客服中心",
// "url": "https://zhsq.hshuishang.com/user/appoint/index",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_413.png'),
"name": "维修工单",
"url": "../upKeep/upKeep",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_414.png'),
"name": "滤芯更换记录",
// "url": "https://zhsq.hshuishang.com/user/exchange/index",
"type": "h5"
}
],
// 滤芯寿命
progress_List: [{
"name": "HXTH滤芯",
"progress": 97.41
},
{
"name": "RO膜滤芯",
"progress": 87.41
},
{
"name": "PP+CB滤芯",
"progress": 40.41
},
{
"name": "PP棉滤芯",
"progress": 90.41
}
],
imagePath: '',
ec: {
onInit: initChart
},
imagePath: '',
page_num:1,
page_size:10,
currentDevice:[],
deviceId:"",
},
partner(){
wx.navigateTo({
url: '../../../partner/pages/partner',
})
},
device(){
wx.navigateTo({
url: '../device/myDevice/myDevice',
})
},
handleNavigateBack(){
wx.navigateBack({delta:1})
},
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);
}
});
},
maintenanceList(){
wx.navigateTo({
url: '../Maintenance/Maintenance',
})
},
buyFilter(){
wx.navigateTo({
url: '../Buyfilter/Buyfilter',
})
},
NotOpen(){
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel:false,
complete: (res) => {
if (res.cancel) {
}
}
})
},
jump(e){
if(!e.target.dataset.url){
this.NotOpen()
}
wx.navigateTo({
url: e.target.dataset.url,
})
},
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)
})
})
},
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;
},
//获取用户设备
getDeviceList(){
let that = this
util.postUrl(apiArr.getUserList,{
page_num:that.data.page_num,
page_size:that.data.page_size
},res=>{
let currentDevice = {}
res.rows.forEach(item=>{
if(item.is_first == 1){
currentDevice = item
item.install_time = item.install_time.slice(0,10)
item.difDay = that.getDaysBetweenDates(item.install_time)
wx.setStorageSync('device_id', item.device_id),
wx.setStorageSync('dealer_id', item.dealer_id)
// wx.setStorageSync('device_code', item.)
wx.setStorageSync('currentDevice', item)
}
})
that.setData({
currentDevice
})
})
},
getDeviceInfo(){
let that = this
util.postUrl(apiArr.deviceInfo,{
device_id:Number(that.data.deviceId)
},res=>{
res.device.difDay = that.getDaysBetweenDates(res.device.install_time)
that.setData({
currentDevice:res.device
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options);
let that = this
that.setData({
deviceId:options.device
})
that.getDeviceInfo()
setTimeout(()=>{
const ecComponent = that.selectComponent("#mychart-dom-bar")
// 将 canvas 内容转换为临时图片文件
ecComponent.canvasToTempFilePath({
// canvasId: 'mychart-dom-bar',
success: (result) => {
this.base64({
url:result.tempFilePath,
type:'png',
}).then((res)=>{
that.setData({
imagePath:res
})
})
// console.log('转换成功,图片路径:', result.tempFilePath);
},
fail: (err) => {
console.error('转换失败:', err);
}
});
},2000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
setTimeout(()=>{
this.convertCanvasToImage()
},5000)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
// that.getDeviceList()
},
/**
* 生命周期函数--监听页面隐藏
*/
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']
},
yAxis: {
type: 'value',
data: ['0ml','560ml']
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'bar',
barWidth: 15,
itemStyle: { //柱状颜色和圆角
color: {
x:0,
y:1,
colorStops:[{
offset: 0,
color: '#FFBBAC',
},{
offset: 1,
color: '#2583FF'
}]
},
barBorderRadius: [5, 5, 0, 0], // (顺时针左上,右上,右下,左下)
},
}]
};
chart.setOption(option);
wx.canvasToTempFilePath({
canvasId: 'mychart-bar',
success: (res) => {
this.setData({
imagePath: res.tempFilePath
});
},
fail: (err) => {
console.error('Canvas to image failed:', err);
},
},this);
return chart;
}

View File

@ -1,138 +1,138 @@
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_401.png'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
我的设备
</view>
<view class="nav-bar-right"></view>
</view>
</view>
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
<view class="positioning-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Vector_1.png" mode="" class="positioning-icon-right" />
<text class="positioning-text">设备</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_before}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_after}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text">净化后水质:极好</text>
</view>
</view>
</view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size">{{currentDevice.sevice_status == '1'?'在用':'停用'}}</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
</view>
</view>
<van-divider />
<!-- 购买滤芯和报修记录 -->
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view class="lifetime-progress" wx:for="{{progress_List}}">
<text class="progress-name">{{item.name}}</text>
<van-progress percentage="{{item.progress}}" color="linear-gradient(to right, #FFBBAC, #2583FF)" stroke-width="10" show-pivot="{{false}}" track-color="#FFD6D6" />
<text class="progress">{{item.progress}}%</text>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.accumulated_usage}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://static.hshuishang.com/water_filter/Group_401.png'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://static.hshuishang.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
我的设备
</view>
<view class="nav-bar-right"></view>
</view>
</view>
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://static.hshuishang.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
<view class="positioning-right">
<image src="https://static.hshuishang.com/water_filter/Vector_1.png" mode="" class="positioning-icon-right" />
<text class="positioning-text">设备</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://static.hshuishang.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_before}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://static.hshuishang.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_after}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text">净化后水质:极好</text>
</view>
</view>
</view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image src="https://static.hshuishang.com/water_filter/Group_405.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size">{{currentDevice.sevice_status == '1'?'在用':'停用'}}</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == '1'}}" src="https://static.hshuishang.com/water_filter/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
</view>
</view>
<van-divider />
<!-- 购买滤芯和报修记录 -->
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view class="lifetime-progress" wx:for="{{progress_List}}">
<text class="progress-name">{{item.name}}</text>
<van-progress percentage="{{item.progress}}" color="linear-gradient(to right, #FFBBAC, #2583FF)" stroke-width="10" show-pivot="{{false}}" track-color="#FFD6D6" />
<text class="progress">{{item.progress}}%</text>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.accumulated_usage}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>
<Footer/>

View File

@ -1,348 +1,349 @@
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: {
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: "",
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
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)
}
})
})
},
search() {
let that = this
that.setData({
orderList: []
})
this.getOrderList();
},
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,
search: that.data.searchText,
};
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
}
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({
orderList: [],
page_num: 1,
flag: false
}, () => {
this.getOrderList(e.detail.value);
})
},
//师傅列表
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()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
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' // 自定义分享图片路径
}
},
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
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
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: "",
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
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)
}
})
})
},
search() {
let that = this
that.setData({
orderList: []
})
this.getOrderList();
},
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,
search: that.data.searchText,
};
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
}
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({
orderList: [],
page_num: 1,
flag: false
}, () => {
this.getOrderList(e.detail.value);
})
},
//师傅列表
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()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
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: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,125 +1,125 @@
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
维修工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="down">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item
bind:change="headerDropdownClick"
value="{{ value1 }}"
title="工单状态"
options="{{ option1 }}"
/>
</van-dropdown-menu>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:if="{{orderList.length>0}}" bind:tap="desc" data-id="{{item.repair_id}}" wx:for="{{orderList}}" wx:key="index">
<view class="orderItem_tit">工单号:{{item.repair_no}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编号</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户型号</view>
<view class="orderItem_Item_con">{{item.product_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单状态</view>
<view class="orderItem_Item_con2">{{stateType[item.status]}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">故障描述</view>
<view class="orderItem_Item_con">{{item.fault_desc}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址</view>
<view class="orderItem_Item_con">{{item.region + item.address || "暂无数据"}}</view>
</view>
<view class="contral">
<view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status === 1}}">撤回</view>
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
</view>
</view>
<van-empty description="暂无工单" wx:if="{{orderList.length === 0}}" />
</view>
<view class="addBtn" bind:tap="addOrder">
新增
</view>
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" custom-style="height: 60%;" close-on-click-overlay round position="bottom" z-index="9999">
<view class="pop_Tit">
请选择维修师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="widthFix"/>
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}" ></view>
</view>
</view>
</view>
</van-popup>
</view>
</view>
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
维修工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="down">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item
bind:change="headerDropdownClick"
value="{{ value1 }}"
title="工单状态"
options="{{ option1 }}"
/>
</van-dropdown-menu>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:if="{{orderList.length>0}}" bind:tap="desc" data-id="{{item.repair_id}}" wx:for="{{orderList}}" wx:key="index">
<view class="orderItem_tit">工单号:{{item.repair_no}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编号</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户型号</view>
<view class="orderItem_Item_con">{{item.product_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单状态</view>
<view class="orderItem_Item_con2">{{stateType[item.status]}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">故障描述</view>
<view class="orderItem_Item_con">{{item.fault_desc}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址</view>
<view class="orderItem_Item_con">{{item.region + item.address || "暂无数据"}}</view>
</view>
<view class="contral">
<view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status === 1}}">撤回</view>
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
</view>
</view>
<van-empty description="暂无工单" wx:if="{{orderList.length === 0}}" />
</view>
<view class="addBtn" bind:tap="addOrder">
新增
</view>
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" custom-style="height: 60%;" close-on-click-overlay round position="bottom" z-index="9999">
<view class="pop_Tit">
请选择维修师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="widthFix"/>
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}" ></view>
</view>
</view>
</view>
</van-popup>
</view>
</view>

View File

@ -1,356 +1,357 @@
import * as echarts from '../../component/ec-canvas/echarts';
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const app = getApp({allowDefault:true})
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
// 功能列表
functional_List: [{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_407.png",
"name": "一键报修",
// "url": "packages/WaterPurifier/pages/repair/repair",
"url": `../../../WaterPurifier/pages/repair/repair`,
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_408.png",
"name": "购买套餐",
"url": "../Recharge/Recharge",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_409.png",
"name": "滤芯购买记录",
"url": "../RechargeRecord/RechargeRecord",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_410.png",
"name": "滤芯详情",
"url": "../filter/filter",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_411.png",
"name": "设备分享",
// "url":"../shareDerive/shareDerive",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_412.png",
"name": "客服中心",
"url": "../Addfriend/Addfriend",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_413.png",
"name": "维修工单",
"url": "../upKeep/upKeep",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_414.png",
"name": "滤芯更换",
// "url": "https://zhsq.hshuishang.com/user/exchange/index",
"url":"/packages/WaterPurifier/pages/water_change/water_change",
"type": "h5"
}
],
// 滤芯寿命
progress_List: [{
"name": "HXTH滤芯",
"progress": 97.41
},
{
"name": "RO膜滤芯",
"progress": 87.41
},
{
"name": "PP+CB滤芯",
"progress": 40.41
},
{
"name": "PP棉滤芯",
"progress": 90.41
}
],
imagePath: '',
ec: {
onInit: initChart
},
imagePath: '',
page_num:1,
page_size:10,
currentDevice:[],
is_deal:false
},
partner(){
wx.navigateTo({
url: '../../../partner/pages/partner',
})
},
device(){
wx.navigateTo({
url: '../device/myDevice/myDevice',
})
},
handleNavigateBack(){
wx.navigateBack({delta:1})
},
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);
}
});
},
maintenanceList(){
wx.navigateTo({
url: '../Maintenance/Maintenance',
})
},
buyFilter(){
wx.navigateTo({
url: '../Buyfilter/Buyfilter',
})
},
NotOpen(){
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel:false,
complete: (res) => {
if (res.cancel) {
}
}
})
},
jump(e){
if(!e.target.dataset.url){
this.NotOpen()
}
wx.navigateTo({
url: e.target.dataset.url,
})
},
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)
})
})
},
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;
},
//获取用户设备
getDeviceList(){
wx.showLoading({
title: '加载中...',
mask:true
})
let that = this
util.postUrl(apiArr.getUserList,{
page_num:that.data.page_num,
page_size:that.data.page_size,
user_id:Number(wx.getStorageSync('userId'))
},res=>{
wx.hideLoading()
let currentDevice = {}
res.rows.forEach(item=>{
if(item.is_first == 1){
currentDevice = item
item.install_time = item.install_time.slice(0,10)
item.difDay = that.getDaysBetweenDates(item.install_time)
wx.setStorageSync('device_id', item.device_id),
wx.setStorageSync('dealerId', item.dealer_id)
// wx.setStorageSync('device_code', item.)
wx.setStorageSync('currentDevice', item)
}
})
that.setData({
currentDevice
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
let that = this
setTimeout(()=>{
const ecComponent = that.selectComponent("#mychart-dom-bar")
// 将 canvas 内容转换为临时图片文件
ecComponent.canvasToTempFilePath({
// canvasId: 'mychart-dom-bar',
success: (result) => {
this.base64({
url:result.tempFilePath,
type:'png',
}).then((res)=>{
that.setData({
imagePath:res
})
})
// console.log('转换成功,图片路径:', result.tempFilePath);
},
fail: (err) => {
console.error('转换失败:', err);
}
});
},2000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
setTimeout(()=>{
this.convertCanvasToImage()
},5000)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getDeviceList()
that.setData({
is_deal:wx.getStorageSync('is_deal')
})
},
/**
* 生命周期函数--监听页面隐藏
*/
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']
},
yAxis: {
type: 'value',
data: ['0ml','560ml']
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'bar',
barWidth: 15,
itemStyle: { //柱状颜色和圆角
color: {
x:0,
y:1,
colorStops:[{
offset: 0,
color: '#FFBBAC',
},{
offset: 1,
color: '#2583FF'
}]
},
barBorderRadius: [5, 5, 0, 0], // (顺时针左上,右上,右下,左下)
},
}]
};
chart.setOption(option);
wx.canvasToTempFilePath({
canvasId: 'mychart-bar',
success: (res) => {
this.setData({
imagePath: res.tempFilePath
});
},
fail: (err) => {
console.error('Canvas to image failed:', err);
},
},this);
return chart;
}
import * as echarts from '../../component/ec-canvas/echarts';
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const app = getApp({allowDefault:true})
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
// 功能列表
functional_List: [{
"image": (__staticUrl + '/water_filter/Group_407.png'),
"name": "一键报修",
// "url": "packages/WaterPurifier/pages/repair/repair",
"url": `../../../WaterPurifier/pages/repair/repair`,
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_408.png'),
"name": "购买套餐",
"url": "../Recharge/Recharge",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_409.png'),
"name": "滤芯购买记录",
"url": "../RechargeRecord/RechargeRecord",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_410.png'),
"name": "滤芯详情",
"url": "../filter/filter",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_411.png'),
"name": "设备分享",
// "url":"../shareDerive/shareDerive",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_412.png'),
"name": "客服中心",
"url": "../Addfriend/Addfriend",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_413.png'),
"name": "维修工单",
"url": "../upKeep/upKeep",
"type": "h5"
},
{
"image": (__staticUrl + '/water_filter/Group_414.png'),
"name": "滤芯更换",
// "url": "https://zhsq.hshuishang.com/user/exchange/index",
"url":"/packages/WaterPurifier/pages/water_change/water_change",
"type": "h5"
}
],
// 滤芯寿命
progress_List: [{
"name": "HXTH滤芯",
"progress": 97.41
},
{
"name": "RO膜滤芯",
"progress": 87.41
},
{
"name": "PP+CB滤芯",
"progress": 40.41
},
{
"name": "PP棉滤芯",
"progress": 90.41
}
],
imagePath: '',
ec: {
onInit: initChart
},
imagePath: '',
page_num:1,
page_size:10,
currentDevice:[],
is_deal:false
},
partner(){
wx.navigateTo({
url: '../../../partner/pages/partner',
})
},
device(){
wx.navigateTo({
url: '../device/myDevice/myDevice',
})
},
handleNavigateBack(){
wx.navigateBack({delta:1})
},
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);
}
});
},
maintenanceList(){
wx.navigateTo({
url: '../Maintenance/Maintenance',
})
},
buyFilter(){
wx.navigateTo({
url: '../Buyfilter/Buyfilter',
})
},
NotOpen(){
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel:false,
complete: (res) => {
if (res.cancel) {
}
}
})
},
jump(e){
if(!e.target.dataset.url){
this.NotOpen()
}
wx.navigateTo({
url: e.target.dataset.url,
})
},
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)
})
})
},
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;
},
//获取用户设备
getDeviceList(){
wx.showLoading({
title: '加载中...',
mask:true
})
let that = this
util.postUrl(apiArr.getUserList,{
page_num:that.data.page_num,
page_size:that.data.page_size,
user_id:Number(wx.getStorageSync('userId'))
},res=>{
wx.hideLoading()
let currentDevice = {}
res.rows.forEach(item=>{
if(item.is_first == 1){
currentDevice = item
item.install_time = item.install_time.slice(0,10)
item.difDay = that.getDaysBetweenDates(item.install_time)
wx.setStorageSync('device_id', item.device_id),
wx.setStorageSync('dealerId', item.dealer_id)
// wx.setStorageSync('device_code', item.)
wx.setStorageSync('currentDevice', item)
}
})
that.setData({
currentDevice
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
let that = this
setTimeout(()=>{
const ecComponent = that.selectComponent("#mychart-dom-bar")
// 将 canvas 内容转换为临时图片文件
ecComponent.canvasToTempFilePath({
// canvasId: 'mychart-dom-bar',
success: (result) => {
this.base64({
url:result.tempFilePath,
type:'png',
}).then((res)=>{
that.setData({
imagePath:res
})
})
// console.log('转换成功,图片路径:', result.tempFilePath);
},
fail: (err) => {
console.error('转换失败:', err);
}
});
},2000)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
setTimeout(()=>{
this.convertCanvasToImage()
},5000)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getDeviceList()
that.setData({
is_deal:wx.getStorageSync('is_deal')
})
},
/**
* 生命周期函数--监听页面隐藏
*/
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']
},
yAxis: {
type: 'value',
data: ['0ml','560ml']
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'bar',
barWidth: 15,
itemStyle: { //柱状颜色和圆角
color: {
x:0,
y:1,
colorStops:[{
offset: 0,
color: '#FFBBAC',
},{
offset: 1,
color: '#2583FF'
}]
},
barBorderRadius: [5, 5, 0, 0], // (顺时针左上,右上,右下,左下)
},
}]
};
chart.setOption(option);
wx.canvasToTempFilePath({
canvasId: 'mychart-bar',
success: (res) => {
this.setData({
imagePath: res.tempFilePath
});
},
fail: (err) => {
console.error('Canvas to image failed:', err);
},
},this);
return chart;
}

View File

@ -1,176 +1,176 @@
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_401.png'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
我的设备
</view>
<view class="nav-bar-right"></view>
</view>
</view>
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
<view class="positioning-right" bind:tap="device">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Vector_1.png" mode="" class="positioning-icon-right" />
<text class="positioning-text">设备</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_before}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_after}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text">净化后水质:极好</text>
</view>
</view>
</view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size">{{currentDevice.sevice_status == '1'?'在用':'停用'}}</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
</view>
</view>
<van-divider />
<!-- 购买滤芯和报修记录 -->
<view class="equi-contral" wx:if="{{is_deal}}">
<view class="equi-contral-left" bind:tap="partner">
合伙人
<image id="img1" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_left_img1.png" mode="widthFix" />
<image id="img2" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_left_img2.png" mode="widthFix" />
</view>
<view class="equi-contral-right">
<view class="equi-contral-right-btn1" bindtap="maintenanceList">
报修记录
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_MainRecord.png" mode="widthFix" />
</view>
<view class="equi-contral-right-btn2" bind:tap="buyFilter">
滤芯购买
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_buy.png" mode="widthFix" />
</view>
</view>
</view>
<view class="equi-contral equi-contral2" wx:if="{{!is_deal}}">
<view class="equi-contral-right">
<view class="equi-contral-right-btn1" bindtap="maintenanceList">
报修记录
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_MainRecord.png" mode="widthFix" />
</view>
<view class="equi-contral-right-btn2" bind:tap="buyFilter">
滤芯购买
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/contral_buy.png" mode="widthFix" />
</view>
</view>
</view>
</view>
<!-- 功能列表 -->
<van-grid column-num="4" border="{{false}}">
<van-grid-item icon="{{item.image}}" text="{{item.name}}" wx:for="{{ functional_List }}" wx:key="index" link-type="navigateTo" data-url="{{item.url}}" bindtap="jump" />
</van-grid>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view class="lifetime-progress" wx:for="{{progress_List}}" wx:key="index">
<text class="progress-name">{{item.name}}</text>
<van-progress percentage="{{item.progress}}" color="linear-gradient(to right, #FFBBAC, #2583FF)" stroke-width="10" show-pivot="{{false}}" track-color="#FFD6D6" />
<text class="progress">{{item.progress}}%</text>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.accumulated_usage}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://static.hshuishang.com/water_filter/Group_401.png'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bindtap="handleNavigateBack">
<image src="https://static.hshuishang.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;">
我的设备
</view>
<view class="nav-bar-right"></view>
</view>
</view>
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://static.hshuishang.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
<view class="positioning-right" bind:tap="device">
<image src="https://static.hshuishang.com/water_filter/Vector_1.png" mode="" class="positioning-icon-right" />
<text class="positioning-text">设备</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://static.hshuishang.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_before}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://static.hshuishang.com/water_filter/Group_420.png" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.toc_after}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text">净化后水质:极好</text>
</view>
</view>
</view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image src="https://static.hshuishang.com/water_filter/Group_405.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size">{{currentDevice.sevice_status == '1'?'在用':'停用'}}</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == '1'}}" src="https://static.hshuishang.com/water_filter/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
</view>
</view>
<van-divider />
<!-- 购买滤芯和报修记录 -->
<view class="equi-contral" wx:if="{{is_deal}}">
<view class="equi-contral-left" bind:tap="partner">
合伙人
<image id="img1" src="https://static.hshuishang.com/water_filter/contral_left_img1.png" mode="widthFix" />
<image id="img2" src="https://static.hshuishang.com/water_filter/contral_left_img2.png" mode="widthFix" />
</view>
<view class="equi-contral-right">
<view class="equi-contral-right-btn1" bindtap="maintenanceList">
报修记录
<image src="https://static.hshuishang.com/water_filter/contral_MainRecord.png" mode="widthFix" />
</view>
<view class="equi-contral-right-btn2" bind:tap="buyFilter">
滤芯购买
<image src="https://static.hshuishang.com/water_filter/contral_buy.png" mode="widthFix" />
</view>
</view>
</view>
<view class="equi-contral equi-contral2" wx:if="{{!is_deal}}">
<view class="equi-contral-right">
<view class="equi-contral-right-btn1" bindtap="maintenanceList">
报修记录
<image src="https://static.hshuishang.com/water_filter/contral_MainRecord.png" mode="widthFix" />
</view>
<view class="equi-contral-right-btn2" bind:tap="buyFilter">
滤芯购买
<image src="https://static.hshuishang.com/water_filter/contral_buy.png" mode="widthFix" />
</view>
</view>
</view>
</view>
<!-- 功能列表 -->
<van-grid column-num="4" border="{{false}}">
<van-grid-item icon="{{item.image}}" text="{{item.name}}" wx:for="{{ functional_List }}" wx:key="index" link-type="navigateTo" data-url="{{item.url}}" bindtap="jump" />
</van-grid>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view class="lifetime-progress" wx:for="{{progress_List}}" wx:key="index">
<text class="progress-name">{{item.name}}</text>
<van-progress percentage="{{item.progress}}" color="linear-gradient(to right, #FFBBAC, #2583FF)" stroke-width="10" show-pivot="{{false}}" track-color="#FFD6D6" />
<text class="progress">{{item.progress}}%</text>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.accumulated_usage}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">49.03<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>
<Footer />

View File

@ -1,176 +1,177 @@
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
Page({
data: {
avatarUrl: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png?2',
userInfo: {
name: '张三',
phone: '13800138000'
},
stats: {
newInstall: 12,
filterReplace: 8,
repair: 5
},
fileList: [],
sexOptions: ['男', '女'],
avatarUrl2:""
},
SubscribeMessage(){
wx.navigateTo({
url: '/pages/SubscribeMessage/SubscribeMessage',
})
},
changeSex(e) {
const sexIndex = e.detail.value;
this.setData({
sexIndex,
'userInfo.sex': sexIndex + 1 // 更新性别值
});
// 这里可以添加保存性别到服务器的逻辑
},
deviceList(){
wx.navigateTo({
url: '../device/index',
})
},
loginOut(){
wx.removeStorageSync('is_master')
wx.redirectTo({
url:"/pages/newLogin/newLogin"
})
},
editMaster(){
wx.navigateTo({
url: '/packages/master/masterInfo/index',
})
},
getMasterInfo() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.masterInfo, {
user_id: wx.getStorageSync('userId')
}, res => {
wx.hideLoading()
wx.setStorageSync('master', res)
that.setData({
userInfo: res,
sexIndex:res.sex - 1
})
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
})
}
})
},
updateName(e){
let that = this
that.setData({
"userInfo.name":e.detail.value
})
},
updatePhone(e){
let that = this
that.setData({
"userInfo.phone":e.detail.value
})
},
saveUserInfo(){
let that = this
util.postUrl(apiArr.editMasterInfo,{
info_id:that.data.userInfo.info_id,
name:that.data.userInfo.name,
sex:that.data.userInfo.sex,
region:that.data.userInfo.region,
address:that.data.userInfo.address,
avatar:that.data.avatarUrl2,
phone:that.data.userInfo.phone
},res=>{
console.log(res);
if(res.msg == '操作成功'){
wx.showToast({
title: '修改成功!',
})
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
})
},
onLoad(e) {
// 这里可以添加获取用户信息和统计数据的逻辑
let that = this
that.getMasterInfo()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
let obj = {
url: url,
name: 'avatar'
}
fileList.push(obj)
that.setData({
fileList,
avatarUrl: url,
avatarUrl2:url2
})
})
}
});
},
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' // 自定义分享图片路径
}
},
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
const __staticUrl = require('../../../config/env.js').static_url
Page({
data: {
avatarUrl: (__staticUrl + '/person/Group_309.png?2'),
userInfo: {
name: '张三',
phone: '13800138000'
},
stats: {
newInstall: 12,
filterReplace: 8,
repair: 5
},
fileList: [],
sexOptions: ['男', '女'],
avatarUrl2:""
},
SubscribeMessage(){
wx.navigateTo({
url: '/pages/SubscribeMessage/SubscribeMessage',
})
},
changeSex(e) {
const sexIndex = e.detail.value;
this.setData({
sexIndex,
'userInfo.sex': sexIndex + 1 // 更新性别值
});
// 这里可以添加保存性别到服务器的逻辑
},
deviceList(){
wx.navigateTo({
url: '../device/index',
})
},
loginOut(){
wx.removeStorageSync('is_master')
wx.redirectTo({
url:"/pages/newLogin/newLogin"
})
},
editMaster(){
wx.navigateTo({
url: '/packages/master/masterInfo/index',
})
},
getMasterInfo() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.masterInfo, {
user_id: wx.getStorageSync('userId')
}, res => {
wx.hideLoading()
wx.setStorageSync('master', res)
that.setData({
userInfo: res,
sexIndex:res.sex - 1
})
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
})
}
})
},
updateName(e){
let that = this
that.setData({
"userInfo.name":e.detail.value
})
},
updatePhone(e){
let that = this
that.setData({
"userInfo.phone":e.detail.value
})
},
saveUserInfo(){
let that = this
util.postUrl(apiArr.editMasterInfo,{
info_id:that.data.userInfo.info_id,
name:that.data.userInfo.name,
sex:that.data.userInfo.sex,
region:that.data.userInfo.region,
address:that.data.userInfo.address,
avatar:that.data.avatarUrl2,
phone:that.data.userInfo.phone
},res=>{
console.log(res);
if(res.msg == '操作成功'){
wx.showToast({
title: '修改成功!',
})
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
})
},
onLoad(e) {
// 这里可以添加获取用户信息和统计数据的逻辑
let that = this
that.getMasterInfo()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
let obj = {
url: url,
name: 'avatar'
}
fileList.push(obj)
that.setData({
fileList,
avatarUrl: url,
avatarUrl2:url2
})
})
}
});
},
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
});

View File

@ -127,11 +127,13 @@ Page({
})
},
replay(e){
const that = this
wx.showLoading({
title: '重置中...',
})
// part_id 必须是 device_parts 行 id不是滤芯品类 parts_id
util.postUrl(apiArr.resetFilter,{
part_id:e.currentTarget.dataset.item.parts_id,
part_id:e.currentTarget.dataset.item.id,
device_id:e.currentTarget.dataset.item.device_id,
},res=>{
wx.hideLoading()
@ -141,10 +143,10 @@ Page({
title: '重置成功!',
icon:"none"
})
that.getfilterList()
that.getInfo()
}else{
wx.showToast({
title: res.msg,
title: res.msg || '重置失败',
icon:"none"
})
}

View File

@ -1,189 +1,189 @@
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status != 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.parts}}" wx:key="index">
<view class="progress-name">{{item.parts_name}}</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="deleteDevice" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://static.hshuishang.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://static.hshuishang.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status != 1}}" src="https://static.hshuishang.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == 1}}" src="https://static.hshuishang.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://static.hshuishang.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.parts}}" wx:key="index">
<view class="progress-name">{{item.parts_name}}</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="deleteDevice" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
</van-popup>

View File

@ -1,130 +1,131 @@
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() {
}
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
// packages/master/masterIndex/index.js
const __staticUrl = require('../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
funcList: [
{
text: "新装工单",
img: (__staticUrl + '/water_filter/partner/partner_icon3.png?1'),
url: "../order/index?type=0",
},
{
text: "维修工单",
img: (__staticUrl + '/water_filter/partner/partner_icon4.png?1'),
url: "../order/index?type=1",
},
{
text: "拆除工单",
img: (__staticUrl + '/removeIcon.png'),
url: "../order/index?type=3",
},
{
text: "滤芯更换工单",
img: (__staticUrl + '/partsIcon.png'),
url: "../order/index?type=2",
},
{
text: "设备管理",
img: (__staticUrl + '/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() {
}
})

View File

@ -1,162 +1,163 @@
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
// packages/master/masterInfo/index.js
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {},
sexOptions: ['男', '女'],
sexIndex: "",
avatarUrl:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png?2",
avatarUrl2:"",
fileList:[],
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
let obj = {
url: url,
name: 'avatar'
}
fileList.push(obj)
that.setData({
fileList,
avatarUrl: url,
avatarUrl2:url2
})
})
}
});
},
changeSex(e) {
const sexIndex = e.detail.value;
this.setData({
sexIndex,
'userInfo.sex': Number(sexIndex) + 1 // 更新性别值
});
// 这里可以添加保存性别到服务器的逻辑
},
getMasterInfo() {
let that = this
util.postUrl(apiArr.masterInfo, {
user_id: wx.getStorageSync('userId')
}, res => {
wx.setStorageSync('master', res)
that.setData({
userInfo: res,
sexIndex: res.sex - 1
})
if (res.avatar) {
that.setData({
avatarUrl: util.img_url + res.avatar
})
}
})
},
saveMasterInfo() {
let that = this
util.postUrl(apiArr.editMasterInfo,{
info_id:that.data.userInfo.info_id,
name:that.data.userInfo.name,
sex:that.data.userInfo.sex,
region:that.data.userInfo.region,
address:that.data.userInfo.address,
avatar:that.data.avatarUrl2,
phone:that.data.userInfo.phone
},res=>{
console.log(res);
if(res.msg == '操作成功'){
wx.showToast({
title: '修改成功!',
})
setTimeout(()=>{
wx.navigateBack({
delta:1
})
},1500)
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getMasterInfo()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
// packages/master/masterInfo/index.js
const __staticUrl = require('../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {},
sexOptions: ['男', '女'],
sexIndex: "",
avatarUrl:(__staticUrl + '/person/Group_309.png?2'),
avatarUrl2:"",
fileList:[],
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
let obj = {
url: url,
name: 'avatar'
}
fileList.push(obj)
that.setData({
fileList,
avatarUrl: url,
avatarUrl2:url2
})
})
}
});
},
changeSex(e) {
const sexIndex = e.detail.value;
this.setData({
sexIndex,
'userInfo.sex': Number(sexIndex) + 1 // 更新性别值
});
// 这里可以添加保存性别到服务器的逻辑
},
getMasterInfo() {
let that = this
util.postUrl(apiArr.masterInfo, {
user_id: wx.getStorageSync('userId')
}, res => {
wx.setStorageSync('master', res)
that.setData({
userInfo: res,
sexIndex: res.sex - 1
})
if (res.avatar) {
that.setData({
avatarUrl: util.img_url + res.avatar
})
}
})
},
saveMasterInfo() {
let that = this
util.postUrl(apiArr.editMasterInfo,{
info_id:that.data.userInfo.info_id,
name:that.data.userInfo.name,
sex:that.data.userInfo.sex,
region:that.data.userInfo.region,
address:that.data.userInfo.address,
avatar:that.data.avatarUrl2,
phone:that.data.userInfo.phone
},res=>{
console.log(res);
if(res.msg == '操作成功'){
wx.showToast({
title: '修改成功!',
})
setTimeout(()=>{
wx.navigateBack({
delta:1
})
},1500)
}else{
wx.showToast({
title: res.msg,
icon:"none"
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getMasterInfo()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,402 +1,403 @@
const app = getApp({ allowDefault: true })
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
Page({
data: {
newOrderTotal: 200,
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
currentType: "",
option1: [
{ text: '新装工单', value: 0 },
{ text: '维修工单', value: 1 },
{ text: '拆机工单', value: 3 },
{ text: '移机工单', value: 4 },
{ text: '滤芯更换工单', value: 2 },
],
active: 0,
searchText: "",
value1: 0,
page_num: 1,
page_size: 10,
flag: false,
searchCon: "",
NewOrderList: [], //新装工单
RepairOrderList: [],//维修工单
PartOrderList: [],//滤芯跟换工单
UninstallOrderList: [],//拆卸工单
RemoveList: [],//移机工单
info_id: "",//师傅id
},
back(){
wx.reLaunch({
url: '/packages/master/masterIndex/index',
})
},
search() {
let that = this
that.setData({
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
RemoveList: [],
page_num: 1,
flag: false
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if (that.data.active == 3) {
that.getPartOrderList()
} else if (that.data.active == 2) {
this.getUninstallOrder()
}
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value
})
},
changeActive(e) {
let that = this
that.setData({
active: e.currentTarget.dataset.item.value,
page_num: 1,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
})
if (that.data.active == 1) {
that.getNewOrderList()
} else if (that.data.active == 2) {
that.gerRepairOrderList()
} else if (that.data.active == 4) {
that.getPartOrderList()
} else if (that.data.active == 3) {
this.getUninstallOrder()
}
},
// 查看工单详情
viewOrderDetail(e) {
let that = this
const id = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/packages/master/orderDesc/index?id=${id}&type=${that.data.active}`
});
},
// 完成订单
completeOrder(e) {
const orderId = e.currentTarget.dataset.id;
wx.showModal({
title: '提示',
content: '确认完成该订单吗?',
success: (res) => {
if (res.confirm) {
this.removeOrder(orderId);
}
}
});
},
// 移除已完成的订单
removeOrder(orderId) {
const newOrderList = this.data.orderList.filter(item => item.id !== orderId);
this.setData({
orderList: newOrderList
});
wx.showToast({
title: '订单已完成',
icon: 'success'
});
},
onLoad(options) {
let currentType = ''
if (options.type == 0) {
currentType = '新装工单'
wx.setNavigationBarTitle({
title: '新装工单',
})
} else if (options.type == 1) {
currentType = '维修工单'
wx.setNavigationBarTitle({
title: '维修工单',
})
} else if (options.type == 3) {
currentType = '拆除工单'
wx.setNavigationBarTitle({
title: '拆除工单',
})
} else if (options.type == 2) {
currentType = '滤芯更换工单'
wx.setNavigationBarTitle({
title: '滤芯更换工单',
})
}
// 移除原有的wx.setNavigationBarRightButton相关代码
let that = this
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
that.setData({
currentType,
active: options.type
})
},
onShow() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1,
searchText: ""
})
that.getMasterInfo()
},
// 跳转到个人中心
navigateToProfile() {
wx.navigateTo({
url: '/packages/master/PersonCen/index'
});
},
//新装工单
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getNewOrder, {
info_id: that.data.info_id,
search: that.data.searchCon,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText,
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
NewOrderList: that.data.NewOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
newOrderTotal: res.total,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//维修工单
gerRepairOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.gerRepairOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
RepairOrderList: that.data.RepairOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//滤材更换工单
getPartOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getPartOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
PartOrderList: that.data.PartOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//拆除工单
getUninstallOrder() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getUninstallOrder, {
info_id: that.data.info_id,
status: 0,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
UninstallOrderList: that.data.UninstallOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//师傅信息
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)
that.searchIcon()
})
},
searchIcon() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if (that.data.active == 2) {
that.getPartOrderList()
} else if (that.data.active == 3) {
this.getUninstallOrder()
}
},
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' // 自定义分享图片路径
}
},
onReachBottom() {
let that = this
if (that.data.flag) {
that.getMasterInfo()
}
},
onPullDownRefresh() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1,
searchText: ""
})
that.getMasterInfo()
wx.stopPullDownRefresh();
},
//新增维修工单
addWorkOrder(){
wx.navigateTo({
url: '/packages/master/addNewOrder/index',
})
},
const app = getApp({ allowDefault: true })
let util = require('../../../utils/util')
let apiArr = require('../../../api/water_filter')
const __staticUrl = require('../../../config/env.js').static_url
Page({
data: {
newOrderTotal: 200,
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
currentType: "",
option1: [
{ text: '新装工单', value: 0 },
{ text: '维修工单', value: 1 },
{ text: '拆机工单', value: 3 },
{ text: '移机工单', value: 4 },
{ text: '滤芯更换工单', value: 2 },
],
active: 0,
searchText: "",
value1: 0,
page_num: 1,
page_size: 10,
flag: false,
searchCon: "",
NewOrderList: [], //新装工单
RepairOrderList: [],//维修工单
PartOrderList: [],//滤芯跟换工单
UninstallOrderList: [],//拆卸工单
RemoveList: [],//移机工单
info_id: "",//师傅id
},
back(){
wx.reLaunch({
url: '/packages/master/masterIndex/index',
})
},
search() {
let that = this
that.setData({
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
RemoveList: [],
page_num: 1,
flag: false
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if (that.data.active == 3) {
that.getPartOrderList()
} else if (that.data.active == 2) {
this.getUninstallOrder()
}
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value
})
},
changeActive(e) {
let that = this
that.setData({
active: e.currentTarget.dataset.item.value,
page_num: 1,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
})
if (that.data.active == 1) {
that.getNewOrderList()
} else if (that.data.active == 2) {
that.gerRepairOrderList()
} else if (that.data.active == 4) {
that.getPartOrderList()
} else if (that.data.active == 3) {
this.getUninstallOrder()
}
},
// 查看工单详情
viewOrderDetail(e) {
let that = this
const id = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/packages/master/orderDesc/index?id=${id}&type=${that.data.active}`
});
},
// 完成订单
completeOrder(e) {
const orderId = e.currentTarget.dataset.id;
wx.showModal({
title: '提示',
content: '确认完成该订单吗?',
success: (res) => {
if (res.confirm) {
this.removeOrder(orderId);
}
}
});
},
// 移除已完成的订单
removeOrder(orderId) {
const newOrderList = this.data.orderList.filter(item => item.id !== orderId);
this.setData({
orderList: newOrderList
});
wx.showToast({
title: '订单已完成',
icon: 'success'
});
},
onLoad(options) {
let currentType = ''
if (options.type == 0) {
currentType = '新装工单'
wx.setNavigationBarTitle({
title: '新装工单',
})
} else if (options.type == 1) {
currentType = '维修工单'
wx.setNavigationBarTitle({
title: '维修工单',
})
} else if (options.type == 3) {
currentType = '拆除工单'
wx.setNavigationBarTitle({
title: '拆除工单',
})
} else if (options.type == 2) {
currentType = '滤芯更换工单'
wx.setNavigationBarTitle({
title: '滤芯更换工单',
})
}
// 移除原有的wx.setNavigationBarRightButton相关代码
let that = this
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
that.setData({
currentType,
active: options.type
})
},
onShow() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1,
searchText: ""
})
that.getMasterInfo()
},
// 跳转到个人中心
navigateToProfile() {
wx.navigateTo({
url: '/packages/master/PersonCen/index'
});
},
//新装工单
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getNewOrder, {
info_id: that.data.info_id,
search: that.data.searchCon,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText,
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
NewOrderList: that.data.NewOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
newOrderTotal: res.total,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//维修工单
gerRepairOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.gerRepairOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
RepairOrderList: that.data.RepairOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//滤材更换工单
getPartOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getPartOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
PartOrderList: that.data.PartOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//拆除工单
getUninstallOrder() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl(apiArr.getUninstallOrder, {
info_id: that.data.info_id,
status: 0,
page_num: that.data.page_num,
page_size: that.data.page_size,
search: that.data.searchText
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
UninstallOrderList: that.data.UninstallOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//师傅信息
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)
that.searchIcon()
})
},
searchIcon() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if (that.data.active == 2) {
that.getPartOrderList()
} else if (that.data.active == 3) {
this.getUninstallOrder()
}
},
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
onReachBottom() {
let that = this
if (that.data.flag) {
that.getMasterInfo()
}
},
onPullDownRefresh() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList: [],
page_num: 1,
searchText: ""
})
that.getMasterInfo()
wx.stopPullDownRefresh();
},
//新增维修工单
addWorkOrder(){
wx.navigateTo({
url: '/packages/master/addNewOrder/index',
})
},
});

View File

@ -1,265 +1,265 @@
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
{{currentType}}
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<!-- 将van-dropdown-menu和search-bar包裹在一个view中 -->
<view class="fixed-top">
<!-- <view class="navBox">
<view class="{{active == item.value?'navItem active':'navItem'}}" data-item="{{item}}" bind:tap="changeActive" wx:for="{{option1}}">{{item.text}}</view>
</view> -->
<view class="navBox">
<view class="navItem active">{{currentType}}</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<!-- 原有内容包裹在content中 -->
<view class="content">
<!-- 新装工单 -->
<view class="order-list" scroll-y wx:if="{{active == 0 && NewOrderList.length != 0}}">
<block wx:for="{{NewOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.install_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">产品名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">客户备注:</text>
<text class="value">{{item.remark}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待分配</text>
<text class="value " wx:if="{{item.status == '2'}}">安装中</text>
<text class="value " wx:if="{{item.status == '3'}}">待激活</text>
<text class="value " wx:if="{{item.status == '4'}}">已安装</text>
<text class="value " wx:if="{{item.status == '5'}}">已撤销</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 0 && NewOrderList.length == 0}}" />
<!-- 维修工单 -->
<view class="order-list" scroll-y wx:if="{{active == 1 && RepairOrderList.length != 0}}">
<block wx:for="{{RepairOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.repair_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">设备名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}}{{item.address}}</text>
</view>
<view class="order-field">
<text class="label">故障说明:</text>
<text class="value">{{item.fault_desc}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待指派</text>
<text class="value " wx:if="{{item.status == '2'}}">待维修</text>
<text class="value " wx:if="{{item.status == '3'}}">维修完成</text>
<text class="value " wx:if="{{item.status == '4'}}">已取消</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 1 && RepairOrderList.length == 0}}" />
<!-- 滤材更换工单 -->
<view class="order-list" scroll-y wx:if="{{active == 2 && PartOrderList.length != 0}}">
<block wx:for="{{PartOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.replace_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">设备名称:</text>
<text class="value">{{item.device.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">安装说明:</text>
<text class="value">{{item.install_desc}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待分配</text>
<text class="value " wx:if="{{item.status == '2'}}">待更换</text>
<text class="value " wx:if="{{item.status == '3'}}">已更换</text>
<text class="value " wx:if="{{item.status == '4'}}">已忽略</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 2 && PartOrderList.length == 0}}" />
<!-- 拆机工单 -->
<view class="order-list" scroll-y wx:if="{{active == 3 && UninstallOrderList.length != 0}}">
<block wx:for="{{UninstallOrderList}}">
<view class="order-item" wx:key="uninstall_id" data-id="{{item.uninstall_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">产品名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">师傅姓名:</text>
<text class="value">{{item.repairman_name}}</text>
</view>
<view class="order-field">
<text class="label" style="white-space: normal;">师傅电话:</text>
<text class="value">{{item.repairman_phone}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">状态:</text>
<text class="value" wx:if="{{item.status == 1}}">待指派</text>
<text class="value" wx:if="{{item.status == 2}}">待拆机</text>
<text class="value" wx:if="{{item.status == 3}}">待操作 </text>
<text class="value" wx:if="{{item.status == 4}}">巳完成</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 3 && UninstallOrderList.length == 0}}" />
<!-- 移机工单 -->
<van-empty description="暂无数据" wx:if="{{active == 4}}" />
<!-- <view class="addBtn" bind:tap="addWorkOrder" wx:if="{{active == 1}}">新增</view> -->
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
{{currentType}}
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://static.hshuishang.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<!-- 将van-dropdown-menu和search-bar包裹在一个view中 -->
<view class="fixed-top">
<!-- <view class="navBox">
<view class="{{active == item.value?'navItem active':'navItem'}}" data-item="{{item}}" bind:tap="changeActive" wx:for="{{option1}}">{{item.text}}</view>
</view> -->
<view class="navBox">
<view class="navItem active">{{currentType}}</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<!-- 原有内容包裹在content中 -->
<view class="content">
<!-- 新装工单 -->
<view class="order-list" scroll-y wx:if="{{active == 0 && NewOrderList.length != 0}}">
<block wx:for="{{NewOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.install_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">产品名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">客户备注:</text>
<text class="value">{{item.remark}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待分配</text>
<text class="value " wx:if="{{item.status == '2'}}">安装中</text>
<text class="value " wx:if="{{item.status == '3'}}">待激活</text>
<text class="value " wx:if="{{item.status == '4'}}">已安装</text>
<text class="value " wx:if="{{item.status == '5'}}">已撤销</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 0 && NewOrderList.length == 0}}" />
<!-- 维修工单 -->
<view class="order-list" scroll-y wx:if="{{active == 1 && RepairOrderList.length != 0}}">
<block wx:for="{{RepairOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.repair_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">设备名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}}{{item.address}}</text>
</view>
<view class="order-field">
<text class="label">故障说明:</text>
<text class="value">{{item.fault_desc}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待指派</text>
<text class="value " wx:if="{{item.status == '2'}}">待维修</text>
<text class="value " wx:if="{{item.status == '3'}}">维修完成</text>
<text class="value " wx:if="{{item.status == '4'}}">已取消</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 1 && RepairOrderList.length == 0}}" />
<!-- 滤材更换工单 -->
<view class="order-list" scroll-y wx:if="{{active == 2 && PartOrderList.length != 0}}">
<block wx:for="{{PartOrderList}}">
<view class="order-item" wx:key="install_id" data-id="{{item.replace_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">设备名称:</text>
<text class="value">{{item.device.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">安装说明:</text>
<text class="value">{{item.install_desc}}</text>
</view>
<view class="order-field">
<text class="label">工单状态:</text>
<text class="value " wx:if="{{item.status == '1'}}">待分配</text>
<text class="value " wx:if="{{item.status == '2'}}">待更换</text>
<text class="value " wx:if="{{item.status == '3'}}">已更换</text>
<text class="value " wx:if="{{item.status == '4'}}">已忽略</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 2 && PartOrderList.length == 0}}" />
<!-- 拆机工单 -->
<view class="order-list" scroll-y wx:if="{{active == 3 && UninstallOrderList.length != 0}}">
<block wx:for="{{UninstallOrderList}}">
<view class="order-item" wx:key="uninstall_id" data-id="{{item.uninstall_id}}" bind:tap="viewOrderDetail">
<!-- 工单基本信息 -->
<view class="order-info">
<view class="order-field">
<text class="label">产品名称:</text>
<text class="value">{{item.product_name}}</text>
</view>
<view class="order-field">
<text class="label">设备编号:</text>
<text class="value">{{item.device_code}}</text>
</view>
<view class="order-field">
<text class="label">师傅姓名:</text>
<text class="value">{{item.repairman_name}}</text>
</view>
<view class="order-field">
<text class="label" style="white-space: normal;">师傅电话:</text>
<text class="value">{{item.repairman_phone}}</text>
</view>
<view class="order-field">
<text class="label">客户姓名:</text>
<text class="value">{{item.customer_name}}</text>
</view>
<view class="order-field">
<text class="label">客户手机:</text>
<text class="value">{{item.customer_phone}}</text>
</view>
<view class="order-field">
<text class="label">详细地址:</text>
<text class="value">{{item.region}} {{item.address}}</text>
</view>
<view class="order-field">
<text class="label">预约时间:</text>
<text class="value">{{item.appointment_time}}</text>
</view>
<view class="order-field">
<text class="label">状态:</text>
<text class="value" wx:if="{{item.status == 1}}">待指派</text>
<text class="value" wx:if="{{item.status == 2}}">待拆机</text>
<text class="value" wx:if="{{item.status == 3}}">待操作 </text>
<text class="value" wx:if="{{item.status == 4}}">巳完成</text>
</view>
</view>
</view>
</block>
</view>
<van-empty description="暂无数据" wx:if="{{active == 3 && UninstallOrderList.length == 0}}" />
<!-- 移机工单 -->
<van-empty description="暂无数据" wx:if="{{active == 4}}" />
<!-- <view class="addBtn" bind:tap="addWorkOrder" wx:if="{{active == 1}}">新增</view> -->
</view>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,303 +1,304 @@
const app = getApp({ allowDefault: true })
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
Page({
data: {
newOrderTotal: 200,
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
option1: [
{ text: '新装工单', value: 0 },
{ text: '维修工单', value: 1 },
{ text: '拆机工单', value: 3 },
{ text: '移机工单', value: 4 },
{ text: '滤芯更换工单', value: 2 },
],
active:0,
value1: 0,
page_num: 1,
page_size: 10,
flag: false,
searchCon: "",
NewOrderList: [], //新装工单
RepairOrderList: [],//维修工单
PartOrderList: [],//滤芯跟换工单
UninstallOrderList:[],//拆卸工单
RemoveList:[],//移机工单
},
changeActive(e){
let that = this
that.setData({
active:e.currentTarget.dataset.item.value,
page_num: 1,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if(that.data.active == 2){
that.getPartOrderList()
}else if(that.data.active == 3){
this.getUninstallOrder()
}
},
// 查看工单详情
viewOrderDetail(e) {
let that = this
const id = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${id}&type=${that.data.active}`
});
},
// 完成订单
completeOrder(e) {
const orderId = e.currentTarget.dataset.id;
wx.showModal({
title: '提示',
content: '确认完成该订单吗?',
success: (res) => {
if (res.confirm) {
this.removeOrder(orderId);
}
}
});
},
// 移除已完成的订单
removeOrder(orderId) {
const newOrderList = this.data.orderList.filter(item => item.id !== orderId);
this.setData({
orderList: newOrderList
});
wx.showToast({
title: '订单已完成',
icon: 'success'
});
},
onLoad() {
// 移除原有的wx.setNavigationBarRightButton相关代码
let that = this
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
onShow() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
page_num: 1
})
that.searchIcon()
},
// 跳转到个人中心
navigateToProfile() {
console.log(123);
wx.navigateTo({
url: '/packages/master/PersonCen/index'
});
},
//新装工单
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getNewOrder, {
info_id: that.data.info_id,
search: that.data.searchCon,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
console.log(res);
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
NewOrderList: that.data.NewOrderList.concat(res.row || []),
page_num: that.data.page_num + 1,
newOrderTotal: res.total,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//维修工单
gerRepairOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.gerRepairOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
RepairOrderList: that.data.RepairOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//滤材更换工单
getPartOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getPartOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
PartOrderList: that.data.PartOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//拆除工单
getUninstallOrder() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getUninstallOrder, {
info_id: that.data.info_id,
status: 0,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
UninstallOrderList: that.data.UninstallOrderList.concat(res.row || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
searchIcon() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
page_num: 1
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if(that.data.active == 2){
that.getPartOrderList()
}else if(that.data.active == 3){
this.getUninstallOrder()
}
},
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' // 自定义分享图片路径
}
},
onReachBottom() {
let that = this
if (that.data.flag) {
that.searchIcon()
}
},
const app = getApp({ allowDefault: true })
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
const __staticUrl = require('../../../../config/env.js').static_url
Page({
data: {
newOrderTotal: 200,
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
option1: [
{ text: '新装工单', value: 0 },
{ text: '维修工单', value: 1 },
{ text: '拆机工单', value: 3 },
{ text: '移机工单', value: 4 },
{ text: '滤芯更换工单', value: 2 },
],
active:0,
value1: 0,
page_num: 1,
page_size: 10,
flag: false,
searchCon: "",
NewOrderList: [], //新装工单
RepairOrderList: [],//维修工单
PartOrderList: [],//滤芯跟换工单
UninstallOrderList:[],//拆卸工单
RemoveList:[],//移机工单
},
changeActive(e){
let that = this
that.setData({
active:e.currentTarget.dataset.item.value,
page_num: 1,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if(that.data.active == 2){
that.getPartOrderList()
}else if(that.data.active == 3){
this.getUninstallOrder()
}
},
// 查看工单详情
viewOrderDetail(e) {
let that = this
const id = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${id}&type=${that.data.active}`
});
},
// 完成订单
completeOrder(e) {
const orderId = e.currentTarget.dataset.id;
wx.showModal({
title: '提示',
content: '确认完成该订单吗?',
success: (res) => {
if (res.confirm) {
this.removeOrder(orderId);
}
}
});
},
// 移除已完成的订单
removeOrder(orderId) {
const newOrderList = this.data.orderList.filter(item => item.id !== orderId);
this.setData({
orderList: newOrderList
});
wx.showToast({
title: '订单已完成',
icon: 'success'
});
},
onLoad() {
// 移除原有的wx.setNavigationBarRightButton相关代码
let that = this
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
onShow() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
page_num: 1
})
that.searchIcon()
},
// 跳转到个人中心
navigateToProfile() {
console.log(123);
wx.navigateTo({
url: '/packages/master/PersonCen/index'
});
},
//新装工单
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getNewOrder, {
info_id: that.data.info_id,
search: that.data.searchCon,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
console.log(res);
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
NewOrderList: that.data.NewOrderList.concat(res.row || []),
page_num: that.data.page_num + 1,
newOrderTotal: res.total,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//维修工单
gerRepairOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.gerRepairOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
RepairOrderList: that.data.RepairOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//滤材更换工单
getPartOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getPartOrder, {
info_id: that.data.info_id,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
PartOrderList: that.data.PartOrderList.concat(res.rows || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
//拆除工单
getUninstallOrder() {
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl4(apiArr.getUninstallOrder, {
info_id: that.data.info_id,
status: 0,
page_num: that.data.page_num,
page_size: that.data.page_size
}, res => {
wx.hideLoading()
if (res.msg == '操作成功') {
let flag = false
if (res.rows && res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
UninstallOrderList: that.data.UninstallOrderList.concat(res.row || []),
page_num: that.data.page_num + 1,
flag
})
} else {
wx.showToast({
title: res.msg,
})
}
})
},
searchIcon() {
let that = this
that.setData({
flag: false,
NewOrderList: [],
RepairOrderList: [],
PartOrderList: [],
UninstallOrderList:[],
page_num: 1
})
if (that.data.active == 0) {
that.getNewOrderList()
} else if (that.data.active == 1) {
that.gerRepairOrderList()
} else if(that.data.active == 2){
that.getPartOrderList()
}else if(that.data.active == 3){
this.getUninstallOrder()
}
},
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
onReachBottom() {
let that = this
if (that.data.flag) {
that.searchIcon()
}
},
});

File diff suppressed because it is too large Load Diff

View File

@ -1,348 +1,349 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
statusType: {
1: '待分配',
2: '安装中',
3: '待激活',
4: '已安装',
5: '已撤销',
},
option1: [
{ text: '全部', value: 0 },
{ text: '待分配', value: 1 },
{ text: '安装中', value: 2 },
{ text: '待激活', value: 3 },
{ text: '已安装', value: 4 },
{ text: '忽略', value: 5 },
],
option2: [
{ text: '渠道', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
],
value1: 0,
value2: 'a',
show: false,
MasterList: [
],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=0`,
})
},
addWorkOrder() {
wx.navigateTo({
url: '../newWorkOrder/newWorkOrder',
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
dispatch(e) {
let that = this
that.setData({
show: true,
sendOrders: e.currentTarget.dataset.item
})
},
// 下拉列表选择工单状态
headerDropdownClick(e) {
console.log('headerDropdownClickheaderDropdownClick', e);
this.setData({
value1: e.detail,
orderList: [],
page_num: 1,
})
this.getNewOrderList();
},
// 撤回工单
headerRecallClick(e) {
let _this = this;
const { item } = e.currentTarget.dataset;
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl4(apiArr.RecallNewRepair, {
install_id: item.install_id,
}, res => {
wx.hideLoading()
if (res.error) {
wx.showToast({
title: '撤回工单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.msg,
icon: 'none',
success() {
setTimeout(() => {
_this.setData({
deviceList: [],
page_num: 1,
})
_this.getNewOrderList();
}, 1500)
}
})
})
},
ipt1(e) {
let that = this
console.log(e);
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.newOrderList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
dealer_id: that.data.admin.shop_id,
search: that.data.searchText,
}, res => {
wx.hideLoading()
if (res.row) {
let flag = false
if (res.row.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.row || []),
page_num: that.data.page_num + 1
})
}
that.getMasterList()
})
},
// 维修师傅列表
getMasterList() {
let that = this
util.postUrl4(apiArr.MasterList, {
page_num: 1,
page_size: 50,
dealer_id: that.data.admin.shop_id
}, res => {
if (res.rows) {
res.rows.forEach(item => {
item.checked = false
item.avatar =item.avatar.startsWith('http')?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
})
},
cancel() {
let that = this
that.setData({
show: false,
})
},
sure() {
let that = this
that.setData({
show: false
})
const { sendOrders, MasterList } = this.data;
const checkedMaster = MasterList.filter((item) => item.checked)[0];
util.postUrl4(apiArr.newInstallAssign, {
install_id: sendOrders.install_id,
master_id: checkedMaster.info_id,
}, res => {
if (res.error) {
wx.showToast({
title: '派单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.msg,
icon: 'none',
})
that.setData({
page_num: 1,
flag: false,
})
setTimeout(() => {
that.setData({
deviceList: []
})
that.getNewOrderList()
}, 1500)
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
this.setData({
orderList: [],
deviceList:[],
page_num: 1,
})
that.getNewOrderList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
orderList: [],
deviceList:[],
searchText:"",
page_num: 1,
flag:false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
statusType: {
1: '待分配',
2: '安装中',
3: '待激活',
4: '已安装',
5: '已撤销',
},
option1: [
{ text: '全部', value: 0 },
{ text: '待分配', value: 1 },
{ text: '安装中', value: 2 },
{ text: '待激活', value: 3 },
{ text: '已安装', value: 4 },
{ text: '忽略', value: 5 },
],
option2: [
{ text: '渠道', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
],
value1: 0,
value2: 'a',
show: false,
MasterList: [
],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=0`,
})
},
addWorkOrder() {
wx.navigateTo({
url: '../newWorkOrder/newWorkOrder',
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
dispatch(e) {
let that = this
that.setData({
show: true,
sendOrders: e.currentTarget.dataset.item
})
},
// 下拉列表选择工单状态
headerDropdownClick(e) {
console.log('headerDropdownClickheaderDropdownClick', e);
this.setData({
value1: e.detail,
orderList: [],
page_num: 1,
})
this.getNewOrderList();
},
// 撤回工单
headerRecallClick(e) {
let _this = this;
const { item } = e.currentTarget.dataset;
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl4(apiArr.RecallNewRepair, {
install_id: item.install_id,
}, res => {
wx.hideLoading()
if (res.error) {
wx.showToast({
title: '撤回工单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.msg,
icon: 'none',
success() {
setTimeout(() => {
_this.setData({
deviceList: [],
page_num: 1,
})
_this.getNewOrderList();
}, 1500)
}
})
})
},
ipt1(e) {
let that = this
console.log(e);
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.newOrderList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
dealer_id: that.data.admin.shop_id,
search: that.data.searchText,
}, res => {
wx.hideLoading()
if (res.row) {
let flag = false
if (res.row.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.row || []),
page_num: that.data.page_num + 1
})
}
that.getMasterList()
})
},
// 维修师傅列表
getMasterList() {
let that = this
util.postUrl4(apiArr.MasterList, {
page_num: 1,
page_size: 50,
dealer_id: that.data.admin.shop_id
}, res => {
if (res.rows) {
res.rows.forEach(item => {
item.checked = false
item.avatar =item.avatar.startsWith('http')?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
})
},
cancel() {
let that = this
that.setData({
show: false,
})
},
sure() {
let that = this
that.setData({
show: false
})
const { sendOrders, MasterList } = this.data;
const checkedMaster = MasterList.filter((item) => item.checked)[0];
util.postUrl4(apiArr.newInstallAssign, {
install_id: sendOrders.install_id,
master_id: checkedMaster.info_id,
}, res => {
if (res.error) {
wx.showToast({
title: '派单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.msg,
icon: 'none',
})
that.setData({
page_num: 1,
flag: false,
})
setTimeout(() => {
that.setData({
deviceList: []
})
that.getNewOrderList()
}, 1500)
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
this.setData({
orderList: [],
deviceList:[],
page_num: 1,
})
that.getNewOrderList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
orderList: [],
deviceList:[],
searchText:"",
page_num: 1,
flag:false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,114 +1,114 @@
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
新装工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList" wx:if="{{deviceList.length != 0}}">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.install_id}}">
<view class="orderItem_tit">工单号:{{item.install_no}}</view>
<view class="orderItem_Item" wx:if="{{item.status == 3 || item.status == 4 || item.status == 5}}">
<view class="orderItem_Item_tit">设备编号</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单状态</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 1}}">待分配</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 2}}">安装中</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 3}}">待激活</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 4}}">已安装</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 5}}">已撤销</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="contral">
<view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status === 1}}">撤回</view>
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
<!-- <view class="state state3" catch:tap="headerOkClick" wx:if="{{item.status === 4}}">完成</view> -->
</view>
</view>
</view>
<view class="addBtn" bind:tap="addWorkOrder">新增</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
<!-- 新增是根据用户那边来得 下单新套餐 在交易完成后 会生成一个新装工单,不存在新增工单入口 -->
<!-- <view class="addBtn" bind:tap="addWorkOrder">
新增
</view> -->
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" close-on-click-overlay round position="bottom" z-index="99999">
<view class="pop_Tit">
<view class="cancel" bind:tap="cancel">取消</view>
请选择维修师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="aspectFill" />
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}"></view>
</view>
</view>
</view>
</van-popup>
</view>
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
新装工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList" wx:if="{{deviceList.length != 0}}">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.install_id}}">
<view class="orderItem_tit">工单号:{{item.install_no}}</view>
<view class="orderItem_Item" wx:if="{{item.status == 3 || item.status == 4 || item.status == 5}}">
<view class="orderItem_Item_tit">设备编号</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单状态</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 1}}">待分配</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 2}}">安装中</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 3}}">待激活</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 4}}">已安装</view>
<view class="orderItem_Item_con2" wx:if="{{item.status == 5}}">已撤销</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="contral">
<view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status === 1}}">撤回</view>
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
<!-- <view class="state state3" catch:tap="headerOkClick" wx:if="{{item.status === 4}}">完成</view> -->
</view>
</view>
</view>
<view class="addBtn" bind:tap="addWorkOrder">新增</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
<!-- 新增是根据用户那边来得 下单新套餐 在交易完成后 会生成一个新装工单,不存在新增工单入口 -->
<!-- <view class="addBtn" bind:tap="addWorkOrder">
新增
</view> -->
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" close-on-click-overlay round position="bottom" z-index="99999">
<view class="pop_Tit">
<view class="cancel" bind:tap="cancel">取消</view>
请选择维修师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="aspectFill" />
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}"></view>
</view>
</view>
</view>
</van-popup>
</view>
</view>

View File

@ -1,49 +1,49 @@
<view class="container">
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" bindinput="ipt1" type="text" placeholder="请输入设备编码" placeholder-style="color: #999999;font-size: 26rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
<van-icon bind:tap="scanQrcode" name="scan" size="28" />
</view>
</view>
<view class="deviceItem" wx:if="{{deviceList.length != 0}}" wx:for="{{deviceList}}" bind:tap="deviceDesc" data-item="{{item}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">产品名称</view>
<view class="deviceItemCon_con">{{item.product_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">经销商</view>
<view class="deviceItemCon_con">{{item.dealer_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">经销商编码</view>
<view class="deviceItemCon_con">{{item.dealer_code}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
<view class="container">
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" bindinput="ipt1" type="text" placeholder="请输入设备编码" placeholder-style="color: #999999;font-size: 26rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
<van-icon bind:tap="scanQrcode" name="scan" size="28" />
</view>
</view>
<view class="deviceItem" wx:if="{{deviceList.length != 0}}" wx:for="{{deviceList}}" bind:tap="deviceDesc" data-item="{{item}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">产品名称</view>
<view class="deviceItemCon_con">{{item.product_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">经销商</view>
<view class="deviceItemCon_con">{{item.dealer_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">经销商编码</view>
<view class="deviceItemCon_con">{{item.dealer_code}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
</view>

View File

@ -1,200 +1,201 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/desk/desk.js
Page({
/**
* 页面的初始数据
*/
data: {
show:false,
show2:false,
banlance:"",
maxDate: new Date().getTime(),
currentDate:new Date().getTime(),
startTime:"",
endTime:"",
SelectDate:[],
totalMony:"",
formatter(type, value) {
if (type === 'year') {
return `${value}`;
}
if (type === 'month') {
return `${value}`;
}
if (type === 'day') {
return `${value}`;
}
return value;
},
},
endTime(){
let that = this
that.setData({
show2:true
})
},
// getTotalBanlance
getTotalBanlance(){
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getTotalBanlance,{
pay_time:that.data.SelectDate,
dealer_id:wx.getStorageSync('dealer_id')
},res=>{
wx.hideLoading()
that.setData({
totalMony:res
})
})
},
Filter(){
let that = this
let date = []
if(that.data.startTime && that.data.endTime){
date.push(that.data.startTime + ' 00:00:00')
date.push(that.data.endTime+ ' 23:59:59')
}else{
date = []
wx.showToast({
title: '请选择完整日期',
icon:"none"
})
return
}
that.setData({
SelectDate:date
})
wx.setStorageSync('SelectDate', date)
that.getTotalBanlance()
},
startTime(){
let that = this
that.setData({
show:true
})
},
onClose(e){
let that = this
that.setData({
show:false
})
},
onClose2(e){
let that = this
that.setData({
show2:false
})
},
onInput(event){
let that = this
const date = new Date(event.detail); // 获取选中的 Date 对象
const year = date.getFullYear(); // 获取年份
const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1
const day = date.getDate(); // 获取日期
const formattedDate = `${year}-${month}-${day}`;
that.setData({
startTime:formattedDate,
show:false
})
},
onInput2(event){
let that = this
const date = new Date(event.detail); // 获取选中的 Date 对象
const year = date.getFullYear(); // 获取年份
const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1
const day = date.getDate(); // 获取日期
const formattedDate = `${year}-${month}-${day}`;
that.setData({
endTime:formattedDate,
show2:false
})
},
income(){
let that= this
wx.navigateTo({
url: `../income/income`,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getTotalBanlance()
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/desk/desk.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
show:false,
show2:false,
banlance:"",
maxDate: new Date().getTime(),
currentDate:new Date().getTime(),
startTime:"",
endTime:"",
SelectDate:[],
totalMony:"",
formatter(type, value) {
if (type === 'year') {
return `${value}`;
}
if (type === 'month') {
return `${value}`;
}
if (type === 'day') {
return `${value}`;
}
return value;
},
},
endTime(){
let that = this
that.setData({
show2:true
})
},
// getTotalBanlance
getTotalBanlance(){
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getTotalBanlance,{
pay_time:that.data.SelectDate,
dealer_id:wx.getStorageSync('dealer_id')
},res=>{
wx.hideLoading()
that.setData({
totalMony:res
})
})
},
Filter(){
let that = this
let date = []
if(that.data.startTime && that.data.endTime){
date.push(that.data.startTime + ' 00:00:00')
date.push(that.data.endTime+ ' 23:59:59')
}else{
date = []
wx.showToast({
title: '请选择完整日期',
icon:"none"
})
return
}
that.setData({
SelectDate:date
})
wx.setStorageSync('SelectDate', date)
that.getTotalBanlance()
},
startTime(){
let that = this
that.setData({
show:true
})
},
onClose(e){
let that = this
that.setData({
show:false
})
},
onClose2(e){
let that = this
that.setData({
show2:false
})
},
onInput(event){
let that = this
const date = new Date(event.detail); // 获取选中的 Date 对象
const year = date.getFullYear(); // 获取年份
const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1
const day = date.getDate(); // 获取日期
const formattedDate = `${year}-${month}-${day}`;
that.setData({
startTime:formattedDate,
show:false
})
},
onInput2(event){
let that = this
const date = new Date(event.detail); // 获取选中的 Date 对象
const year = date.getFullYear(); // 获取年份
const month = date.getMonth() + 1; // 获取月份(注意月份从 0 开始,需要 +1
const day = date.getDate(); // 获取日期
const formattedDate = `${year}-${month}-${day}`;
that.setData({
endTime:formattedDate,
show2:false
})
},
income(){
let that= this
wx.navigateTo({
url: `../income/income`,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getTotalBanlance()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,86 +1,86 @@
<view class="desk" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/deskBg.png?1);">
<Nav Text="收银台" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<view class="money">
{{banlance}}
</view>
<!-- <view class="moneyText">
总收益(元)
</view> -->
<view class="deskList">
<view class="deskItem" bind:tap="income">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/desk_Icon1.png?1" mode="heightFix" />
<view>我的订单</view>
</view>
<!-- <view class="deskItem" bind:tap="desc">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/desk_Icon1.png" mode="heightFix" />
<view>提现记录</view>
</view>
<view class="deskItem">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/desk_Icon1.png" mode="heightFix" />
<view>收款设置</view>
</view> -->
</view>
<view class="filter">
<view class="filter_start" bind:tap="startTime">
<view wx:if="{{!startTime}}">请选择开始日期</view>
<view wx:if="{{startTime}}">{{startTime}}</view>
</view>
~
<view class="filter_end" bind:tap="endTime">
<view wx:if="{{!endTime}}">请选择结束日期</view>
<view wx:if="{{endTime}}">{{endTime}}</view>
</view>
<view class="filterBtn" bind:tap="Filter">筛选</view>
</view>
<view class="Info">
<view class="Tit">
基本收益
<!-- <view class="subTit">(点击查看明细)</view> -->
</view>
<view class="Info_List">
<view class="Info_item">
<view class="Info_item_text">销售酬金(元)</view>
<view class="Info_item_Num">{{totalMony.sale}}</view>
</view>
<!-- <view class="Info_item" bind:tap="detail">
<view class="Info_item_text">服务酬金(元)</view>
<view class="Info_item_Num">0</view>
</view> -->
<view class="Info_item">
<view class="Info_item_text">进货酬金(元)</view>
<view class="Info_item_Num">{{totalMony.in_goods}}</view>
</view>
<view class="Info_item">
<view class="Info_item_text">新装酬金(元)</view>
<view class="Info_item_Num">{{totalMony.new}}</view>
</view>
</view>
<!-- <view class="Tit">
其他收益
</view>
<view class="Info_List">
<view class="Info_item">
<view class="Info_item_text">管理奖金(元)</view>
<view class="Info_item_Num">60.06</view>
</view>
<view class="Info_item">
<view class="Info_item_text">区域奖金(元)</view>
<view class="Info_item_Num">0</view>
</view>
</view> -->
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker formatter="{{ formatter }}" type="date" max-date="{{ maxDate }}" bind:confirm="onInput" />
</van-popup>
<van-popup show="{{ show2 }}" safe-area-inset-bottom lock-scroll bind:close="onClose2" round close-on-click-overlay position="bottom">
<van-datetime-picker value="{{ currentDate }}" formatter="{{ formatter }}" type="date" max-date="{{ maxDate }}" bind:confirm="onInput2" />
</van-popup>
<view class="desk" style="background-image: url('https://static.hshuishang.com/water_filter/partner/deskBg.png?1');">
<Nav Text="收银台" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<view class="money">
{{banlance}}
</view>
<!-- <view class="moneyText">
总收益(元)
</view> -->
<view class="deskList">
<view class="deskItem" bind:tap="income">
<image src="https://static.hshuishang.com/water_filter/partner/desk_Icon1.png?1" mode="heightFix" />
<view>我的订单</view>
</view>
<!-- <view class="deskItem" bind:tap="desc">
<image src="https://static.hshuishang.com/water_filter/partner/desk_Icon1.png" mode="heightFix" />
<view>提现记录</view>
</view>
<view class="deskItem">
<image src="https://static.hshuishang.com/water_filter/partner/desk_Icon1.png" mode="heightFix" />
<view>收款设置</view>
</view> -->
</view>
<view class="filter">
<view class="filter_start" bind:tap="startTime">
<view wx:if="{{!startTime}}">请选择开始日期</view>
<view wx:if="{{startTime}}">{{startTime}}</view>
</view>
~
<view class="filter_end" bind:tap="endTime">
<view wx:if="{{!endTime}}">请选择结束日期</view>
<view wx:if="{{endTime}}">{{endTime}}</view>
</view>
<view class="filterBtn" bind:tap="Filter">筛选</view>
</view>
<view class="Info">
<view class="Tit">
基本收益
<!-- <view class="subTit">(点击查看明细)</view> -->
</view>
<view class="Info_List">
<view class="Info_item">
<view class="Info_item_text">销售酬金(元)</view>
<view class="Info_item_Num">{{totalMony.sale}}</view>
</view>
<!-- <view class="Info_item" bind:tap="detail">
<view class="Info_item_text">服务酬金(元)</view>
<view class="Info_item_Num">0</view>
</view> -->
<view class="Info_item">
<view class="Info_item_text">进货酬金(元)</view>
<view class="Info_item_Num">{{totalMony.in_goods}}</view>
</view>
<view class="Info_item">
<view class="Info_item_text">新装酬金(元)</view>
<view class="Info_item_Num">{{totalMony.new}}</view>
</view>
</view>
<!-- <view class="Tit">
其他收益
</view>
<view class="Info_List">
<view class="Info_item">
<view class="Info_item_text">管理奖金(元)</view>
<view class="Info_item_Num">60.06</view>
</view>
<view class="Info_item">
<view class="Info_item_text">区域奖金(元)</view>
<view class="Info_item_Num">0</view>
</view>
</view> -->
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker formatter="{{ formatter }}" type="date" max-date="{{ maxDate }}" bind:confirm="onInput" />
</van-popup>
<van-popup show="{{ show2 }}" safe-area-inset-bottom lock-scroll bind:close="onClose2" round close-on-click-overlay position="bottom">
<van-datetime-picker value="{{ currentDate }}" formatter="{{ formatter }}" type="date" max-date="{{ maxDate }}" bind:confirm="onInput2" />
</van-popup>

View File

@ -1,302 +1,303 @@
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const apiArr2 = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
option1: [
{ text: '全部', value: 0 },
{ text: '已安装', value: 1 },
{ text: '空闲', value: 2 },
{ text: '已拆机', value: 3 },
],
option2: [
{ text: '全部', value: 0 },
{ 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 },
],
stateType: {
1: '在用',
2: '待启用',
3: '关机',
4: '已拆机',
5: '漏水',
6: '制水故障',
7: '报废',
8: '已欠费',
9: '在库',
10: '激活失败'
},
value1: 0,
value2: 0,
nav_list: {},
foot_width: "",
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
flag: false,
total: '',
deviceList: [],
dropdownOpen: false,
text1:'安装状态:全部',
text2:"设备状态:全部"
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/mine/mine',
})
},
onDropdownOpen() {
console.log(123);
this.setData({ dropdownOpen: true });
},
onDropdownClose() {
this.setData({ dropdownOpen: false });
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
deviceDesc(e) {
wx.navigateTo({
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
})
},
addWorkOrders() {
console.log(123123);
wx.navigateTo({
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
})
},
//安装状态
headerNetWorkClick(e) {
let that = this
let text1 = ''
if(e.detail == 0){
text1 = '安装状态:全部'
}else if(e.detail == 1){
text1 = '安装状态:已安装'
}else if(e.detail == 2){
text1 = '安装状态:空闲'
}else if(e.detail == 3){
text1 = '安装状态:已拆机'
}
this.setData({
value1: e.detail,
page_num: 1,
deviceList: [],
text1
});
if (e.detail == 0) {
this.getDeviceList(0,that.data.value2);
return;
}
this.getDeviceList(e.detail, that.data.value2);
},
// 设备状态
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,
page_num: 1,
deviceList: [],
text2
});
if (e.detail == 0) {
this.getDeviceList(that.data.value1,0);
return;
}
this.getDeviceList(that.data.value1, e.detail);
},
search2() {
let that = this
that.setData({
deviceList: [],
flag: false,
page_num: 1
})
that.getDeviceList('', '')
},
getDeviceList(networkStatus, status) {
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let admin = wx.getStorageSync('admin')
let param = {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
dealer_id: admin.shop_id
};
// if (networkStatus) {
// param = {
// ...param,
// install_status: networkStatus
// }
// }
// if (status) {
// }
param = {
...param,
status: Number(status),
install_status: networkStatus
}
util.postUrl4(apiArr2.deviceList, param, res => {
wx.hideLoading()
let flag = false
if (res.list && res.list.length == that.data.page_size) {
console.log(123);
flag = true
} else {
console.log(456);
flag = false
}
that.setData({
deviceList: that.data.deviceList.concat(res.list || []),
total: res.total,
flag,
page_num: that.data.page_num + 1
})
console.log(that.data.flag);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getDeviceList();
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
flag: false,
page_num: 1,
total: 0,
searchText: "",
value1: "",
value2: "",
deviceList: []
})
that.getDeviceList();
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getDeviceList('', that.data.value2)
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
const apiArr2 = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/device/deviceList/deviceList.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
option1: [
{ text: '全部', value: 0 },
{ text: '已安装', value: 1 },
{ text: '空闲', value: 2 },
{ text: '已拆机', value: 3 },
],
option2: [
{ text: '全部', value: 0 },
{ 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 },
],
stateType: {
1: '在用',
2: '待启用',
3: '关机',
4: '已拆机',
5: '漏水',
6: '制水故障',
7: '报废',
8: '已欠费',
9: '在库',
10: '激活失败'
},
value1: 0,
value2: 0,
nav_list: {},
foot_width: "",
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
flag: false,
total: '',
deviceList: [],
dropdownOpen: false,
text1:'安装状态:全部',
text2:"设备状态:全部"
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/mine/mine',
})
},
onDropdownOpen() {
console.log(123);
this.setData({ dropdownOpen: true });
},
onDropdownClose() {
this.setData({ dropdownOpen: false });
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
deviceDesc(e) {
wx.navigateTo({
url: `../deviceDesc/deviceDesc?device_id=${e.currentTarget.dataset.device_id}`,
})
},
addWorkOrders() {
console.log(123123);
wx.navigateTo({
url: '/packages/partner/pages/newWorkOrder/newWorkOrder',
})
},
//安装状态
headerNetWorkClick(e) {
let that = this
let text1 = ''
if(e.detail == 0){
text1 = '安装状态:全部'
}else if(e.detail == 1){
text1 = '安装状态:已安装'
}else if(e.detail == 2){
text1 = '安装状态:空闲'
}else if(e.detail == 3){
text1 = '安装状态:已拆机'
}
this.setData({
value1: e.detail,
page_num: 1,
deviceList: [],
text1
});
if (e.detail == 0) {
this.getDeviceList(0,that.data.value2);
return;
}
this.getDeviceList(e.detail, that.data.value2);
},
// 设备状态
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,
page_num: 1,
deviceList: [],
text2
});
if (e.detail == 0) {
this.getDeviceList(that.data.value1,0);
return;
}
this.getDeviceList(that.data.value1, e.detail);
},
search2() {
let that = this
that.setData({
deviceList: [],
flag: false,
page_num: 1
})
that.getDeviceList('', '')
},
getDeviceList(networkStatus, status) {
wx.showLoading({
title: '加载中',
mask: true
})
let that = this
let admin = wx.getStorageSync('admin')
let param = {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
dealer_id: admin.shop_id
};
// if (networkStatus) {
// param = {
// ...param,
// install_status: networkStatus
// }
// }
// if (status) {
// }
param = {
...param,
status: Number(status),
install_status: networkStatus
}
util.postUrl4(apiArr2.deviceList, param, res => {
wx.hideLoading()
let flag = false
if (res.list && res.list.length == that.data.page_size) {
console.log(123);
flag = true
} else {
console.log(456);
flag = false
}
that.setData({
deviceList: that.data.deviceList.concat(res.list || []),
total: res.total,
flag,
page_num: that.data.page_num + 1
})
console.log(that.data.flag);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getDeviceList();
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
flag: false,
page_num: 1,
total: 0,
searchText: "",
value1: "",
value2: "",
deviceList: []
})
that.getDeviceList();
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getDeviceList('', that.data.value2)
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,84 +1,84 @@
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
工单详情
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="deviceList" class="page-container {{ dropdownOpen ? 'fixed-page' : '' }}">
<view class="white">
<view class="deviceImg">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deviceList.png?1" mode="widthFix" />
</view>
<view class="deviceText">设备总数:{{total}}</view>
<view class="deviceIpt">
<input type="text" confirm-type="search" bindconfirm="search2" value="{{searchText}}" bindinput="ipt1" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
</view>
</view>
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="deviceItem_box">
<view class="deviceItem" wx:if="{{deviceList.length != 0}}" wx:for="{{deviceList}}" data-state="{{item.install_status}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户姓名</view>
<view class="deviceItemCon_con">{{item.customer_info.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户手机</view>
<view class="deviceItemCon_con">{{item.customer_info.phone}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备状态</view>
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.region}}{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
</view>
</view>
<view class="addBtn" bind:tap="addWorkOrders">新增</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
工单详情
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="deviceList" class="page-container {{ dropdownOpen ? 'fixed-page' : '' }}">
<view class="white">
<view class="deviceImg">
<image src="https://static.hshuishang.com/water_filter/dervice/deviceList.png?1" mode="widthFix" />
</view>
<view class="deviceText">设备总数:{{total}}</view>
<view class="deviceIpt">
<input type="text" confirm-type="search" bindconfirm="search2" value="{{searchText}}" bindinput="ipt1" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search2">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1?1" mode="widthFix" />
</view>
</view>
</view>
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="deviceItem_box">
<view class="deviceItem" wx:if="{{deviceList.length != 0}}" wx:for="{{deviceList}}" data-state="{{item.install_status}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">设备编码:{{item.device_code}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户姓名</view>
<view class="deviceItemCon_con">{{item.customer_info.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">客户手机</view>
<view class="deviceItemCon_con">{{item.customer_info.phone}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">网络状态</view>
<view class="deviceItemCon_con">{{item.network_status == '1'?'正常':'离线'}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备状态</view>
<view class="deviceItemCon_con">{{stateType[item.status]}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">安装状态</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 1}}">已安装</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 2}}">空闲</view>
<view class="deviceItemCon_con" wx:if="{{item.install_status == 3}}">已拆机</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">设备地址</view>
<view class="deviceItemCon_con">{{item.region}}{{item.address}}</view>
</view>
</view>
<view wx:if="{{deviceList.length == 0}}">
<van-empty description="暂无内容" />
</view>
</view>
</view>
<view class="addBtn" bind:tap="addWorkOrders">新增</view>
<cover-view style="position: fixed;">
<import src="/pages/public/footer.wxml" />
<template is="footer-nav" data="{{nav_list:nav_list,foot_width:foot_width}}" />
</cover-view>

View File

@ -140,6 +140,7 @@ Page({
})
},
replay(e) {
const that = this
wx.showLoading({
title: '重置中...',
})
@ -154,10 +155,10 @@ Page({
title: '重置成功!',
icon: "none"
})
that.getfilterList()
that.getInfo()
} else {
wx.showToast({
title: res.msg,
title: res.msg || '重置失败',
icon: "none"
})
}
@ -439,7 +440,7 @@ Page({
}
wx.showModal({
title: '提示',
content: '确定要将设备转时长?请在设备通电开机状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定要转时长?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {
}
@ -492,7 +493,7 @@ Page({
}
wx.showModal({
title: '提示',
content: '确定要设备转流量?请在设备通电开机状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定要转流量?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {
}
@ -529,7 +530,7 @@ Page({
let that = this
wx.showModal({
title: '提示',
content: '是否确认设置为零售模式?此操作请在设备通电开机的状态下进行操作',
content: '【厂商已废弃】计费模式切换(type=08)默认已拦截。确定仍设为零售?请在设备通电开机状态下操作;紧急需服务端开启 allow_deprecated_iot_cmd。',
complete: (res) => {
if (res.cancel) {

View File

@ -1,298 +1,298 @@
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status == '2'}}" bind:tap="openOff" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == '1'}}" bind:tap="openOff" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.parts}}" wx:key="index">
<view class="progress-name">
<view>{{item.parts_name}}</view>
</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="uninstall" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<view class="btn3" bind:tap="active" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
激活
</view>
<view class="btn4" bind:tap="recharge2" wx:if="{{currentDevice.billing_method == 2}}">
流量充值
</view>
<view class="btn4" bind:tap="recharge1" wx:if="{{currentDevice.billing_method == 1 &&currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
时长充值
</view>
<!-- wx:if="{{currentDevice.billing_method == 1}}" -->
<view class="btn5" bind:tap="timeSet" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转时长
</view>
<!-- wx:if="{{currentDevice.billing_method == 2}}" -->
<view class="btn5" bind:tap="timeSet2" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转流量
</view>
<view class="btn5" bind:tap="retailSet" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转零售
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
</van-popup>
<!-- -->
<van-popup show="{{ show2 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="createUninstall">确定</view>
</view>
<view class="row2">
<view class="row_label">预约时间:</view>
<input class="value" bind:tap="changeUninstallDate" value="{{uninstall_time}}" disabled placeholder="请选择预约时间" />
</view>
<view class="row">
<view class="row_label">备注:</view>
<view class="row_con">
<textarea placeholder="请输入备注" bindinput="remarksIpt1"></textarea>
</view>
</view>
</van-popup>
<!-- 时长充值 -->
<van-popup show="{{ show4 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="deviceDeactivation">确定</view>
</view>
<view class="row">
<view class="row_label">充值天数:</view>
<view class="row_con">
<input type="number" value="{{remainingDays}}" bindinput="changeRemainingDay" placeholder="请输入充值天数" />
</view>
</view>
</van-popup>
<van-popup show="{{ show3 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="deviceDataForce">确定</view>
</view>
<view class="row">
<view class="row_label">设置数额:</view>
<view class="row_con">
<textarea placeholder="请输入数额" value="{{surplusFlow}}" bindinput="changeSurplusFlow"></textarea>
</view>
</view>
</van-popup>
<!-- 转时长 -->
<van-popup show="{{ show5 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="modeToTime">确定</view>
</view>
<view class="row">
<view class="row_label">充值天数:</view>
<view class="row_con">
<input type="number" value="{{remaining_days}}" bindinput="changeRemainingDay2" placeholder="请输入充值天数" />
</view>
</view>
</van-popup>
<!-- 转流量 -->
<van-popup show="{{ show6 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="modeToFlowRate">确定</view>
</view>
<view class="row">
<view class="row_label">设置数额:</view>
<view class="row_con">
<input type="number" value="{{surplus_flow}}" bindinput="changeRemainingDay3" placeholder="请输入数额" />
</view>
</view>
</van-popup>
<van-popup show="{{ UninstallDateShow }}" bind:close="closeUninstallDate" safe-area-inset-bottom position="bottom" close-on-click-overlay>
<van-datetime-picker title="预约时间" bind:cancel="closeUninstallDate" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput2" />
<!--pages/water_filter/water_filter.wxml-->
<!-- 人人爱净水页面 -->
<view class="water-filter">
<view class="top" style="background-image: url('https://static.hshuishang.com/water_filter/Group_401.png?v1'); background-size: 100% 100%; height: 698rpx; width: 100%;">
<!-- 位置定位 -->
<view class="positioning">
<view class="positioning-left">
<image src="https://static.hshuishang.com/water_filter/Group 38.png" mode="" class="positioning-icon-left" />
<text class="positioning-text">{{currentDevice.region + currentDevice.address}}</text>
</view>
</view>
<!-- 净化前后数值 -->
<view class="purification-value">
<view class="purification-value-left">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化前</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.raw_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
<view class="purification-value-left purification-value-right">
<image src="https://static.hshuishang.com/water_filter/Group_420.png?v1" mode="" class="purification-value-icon" />
<view class="purification-value-text">
<text class="front puri-text">净化后</text>
<text class="tds puri-text">水质TDS值</text>
<text class="tds-value puri-text">{{currentDevice.purification_water_value}}</text>
<text class="ppm puri-text">PPM</text>
</view>
</view>
</view>
<!-- 净化前后水质 -->
<view class="water-quality">
<view class="water-quality-left">
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value < 20 }}">净化前水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 20 && currentDevice.raw_water_value < 50 }}">净化前水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 50 && currentDevice.raw_water_value < 150 }}">净化前水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.raw_water_value >= 150 && currentDevice.raw_water_value < 300 }}">净化前水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.raw_water_value >= 300 }}">净化前水质:极差</text>
</view>
<view class="water-quality-right water-quality-left" style="margin-left: 60rpx;">
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value < 20 }}">净化后水质:极好</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 20 && currentDevice.purification_water_value < 50 }}">净化后水质:良好</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 50 && currentDevice.purification_water_value < 150 }}">净化后水质:正常</text>
<text class="water-quality-text" wx:if="{{currentDevice.purification_water_value >= 150 && currentDevice.purification_water_value < 300 }}">净化后水质:较差</text>
<text class="water-quality-text" wx:if="{{ currentDevice.purification_water_value >= 300 }}">净化后水质:极差</text>
</view>
</view>
</view>
<view>
<!-- 我的设备信息 -->
<view class="my-device">
<!-- <text class="mydevice text-color">我的设备</text> -->
<view class="device-info">
<text class="mydevice text-color">我的设备</text>
<view class="info-top">
<view class="device-name">{{currentDevice.product_name}}</view>
<view class="device-state">
<image wx:if="{{currentDevice.sevice_status == '2'}}" bind:tap="openOff" src="https://static.hshuishang.com/water_filter/Group_405.png?v1" mode="" class="switch-icon" />
<image wx:if="{{currentDevice.sevice_status == '1'}}" bind:tap="openOff" src="https://static.hshuishang.com/openBtn.png" mode="" class="switch-icon" />
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '1'}}">开机</text>
<text class="switch-text text-color text-size" bind:tap="openOff" wx:if="{{currentDevice.sevice_status == '2'}}">关机</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '3'}}">制水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '4'}}">漏水故障</text>
<text class="switch-text text-color text-size" wx:if="{{currentDevice.sevice_status == '5'}}">主板故障</text>
<image wx:if="{{currentDevice.network_status != '1'}}" src="https://static.hshuishang.com/water_filter/mdicon3.png" mode="" class="wifi-icon" />
<image wx:if="{{currentDevice.network_status == 1}}" src="https://static.hshuishang.com/mdicon4.png" mode="" class="wifi-icon" />
<text class="wifi-text text-color text-size">{{currentDevice.network_status == '1'?'在线':'离线'}}</text>
</view>
</view>
<view class="info-bottom">
<view class="device-id text-size">
编号:{{currentDevice.device_code}}
</view>
<view class="service-day text-size text-color" wx:if="{{currentDevice.expiration_duration}}">
已服务<span class="day-num">{{currentDevice.difDay}}</span><span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{!currentDevice.expiration_duration}}">
已服务<span class="day-num">0</span><span class="day text-size">天</span>
</view>
<view wx:if="{{currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{currentDevice.status != 8}}">
剩余天数
<span class="day-num2">{{ currentDevice.remainDay}}</span>
<span class="day text-size">天</span>
</view>
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status == 8}}">
<span class="day text-size">已欠费</span>
</view>
</view>
<view wx:if="{{!currentDevice.expiration_duration}}">
<view class="service-day text-size text-color" wx:if="{{ currentDevice.status != 1 && currentDevice.status != 8}}">
剩余天数
<span class="day-num2">0</span>
<span class="day text-size">天</span>
</view>
</view>
</view>
</view>
<van-divider />
</view>
<!-- 滤芯寿命 -->
<view class="lifetime">
<view class="lifetime-title">滤芯寿命</view>
<view class="lifetime-prompt">滤芯寿命用水量和使用时间来综合计算</view>
<view>
<view wx:for="{{currentDevice.parts}}" wx:key="index">
<view class="progress-name">
<view>{{item.parts_name}}</view>
</view>
<view class="lifetime-progress">
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 1}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 2}}">
<van-progress style="width: 100%;" percentage="{{item.percentageCapacity}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageCapacity}}%</text>
</view>
<view style="display: flex;flex: 1;" wx:if="{{currentDevice.billing_method == 3}}">
<van-progress style="width: 100%;" percentage="{{item.percentageDay}}" color="linear-gradient(to right, #FFBBAC, #338BFF)" stroke-width="10" show-pivot="{{false}}" track-color="#F1F1F1" />
<text class="progress">{{item.percentageDay}}%</text>
</view>
<view class="replayBtn" bind:tap="replay" data-item="{{item}}" wx:if="{{currentDevice.billing_method != 3}}">
重置
</view>
</view>
</view>
</view>
</view>
<!-- 用水量 -->
<view class="water-consumption">
<view class="water-consumption-title">用水量</view>
<!-- 用水量统计 -->
<view class="water-consumption-row">
<view class="water-consumption-col">
<view class="water-consumption-col-name">累计用水量</view>
<view class="water-consumption-col-num">{{currentDevice.cumulative_filtration_flow}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col2">
<view class="water-consumption-col-name">今日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.today}}<span class="water-consumption-col-num-size">L</span></view>
</view>
<view class="water-consumption-col col3">
<view class="water-consumption-col-name">昨日用水量</view>
<view class="water-consumption-col-num">{{currentDevice.yesterday}}<span class="water-consumption-col-num-size">L</span></view>
</view>
</view>
<!-- 用水量柱状图 -->
<view class="container">
<ec-canvas id="mychart-dom-bar" canvasId="mychart-dom-bar" type="2d" ec="{{ ec }}" ec="{{ ec }}"></ec-canvas>
<image src="{{imagePath}}" style="width: 100%;height:600rpx;"></image>
</view>
</view>
</view>
</view>
<view class="deleteBtn" bind:tap="uninstall" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
拆机
</view>
<view class="btn3" bind:tap="active" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
激活
</view>
<view class="btn4" bind:tap="recharge2" wx:if="{{currentDevice.billing_method == 2}}">
流量充值
</view>
<view class="btn4" bind:tap="recharge1" wx:if="{{currentDevice.billing_method == 1 &&currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
时长充值
</view>
<!-- wx:if="{{currentDevice.billing_method == 1}}" -->
<view class="btn5" bind:tap="timeSet" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转时长
</view>
<!-- wx:if="{{currentDevice.billing_method == 2}}" -->
<view class="btn5" bind:tap="timeSet2" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转流量
</view>
<view class="btn5" bind:tap="retailSet" wx:if="{{currentDevice.status == 1 || currentDevice.status == 3 || currentDevice.status == 5 || currentDevice.status == 6 || currentDevice.status == 8}}">
转零售
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom">
<van-datetime-picker bind:cancel="onClose" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput" />
</van-popup>
<!-- -->
<van-popup show="{{ show2 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="createUninstall">确定</view>
</view>
<view class="row2">
<view class="row_label">预约时间:</view>
<input class="value" bind:tap="changeUninstallDate" value="{{uninstall_time}}" disabled placeholder="请选择预约时间" />
</view>
<view class="row">
<view class="row_label">备注:</view>
<view class="row_con">
<textarea placeholder="请输入备注" bindinput="remarksIpt1"></textarea>
</view>
</view>
</van-popup>
<!-- 时长充值 -->
<van-popup show="{{ show4 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="deviceDeactivation">确定</view>
</view>
<view class="row">
<view class="row_label">充值天数:</view>
<view class="row_con">
<input type="number" value="{{remainingDays}}" bindinput="changeRemainingDay" placeholder="请输入充值天数" />
</view>
</view>
</van-popup>
<van-popup show="{{ show3 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="deviceDataForce">确定</view>
</view>
<view class="row">
<view class="row_label">设置数额:</view>
<view class="row_con">
<textarea placeholder="请输入数额" value="{{surplusFlow}}" bindinput="changeSurplusFlow"></textarea>
</view>
</view>
</van-popup>
<!-- 转时长 -->
<van-popup show="{{ show5 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="modeToTime">确定</view>
</view>
<view class="row">
<view class="row_label">充值天数:</view>
<view class="row_con">
<input type="number" value="{{remaining_days}}" bindinput="changeRemainingDay2" placeholder="请输入充值天数" />
</view>
</view>
</van-popup>
<!-- 转流量 -->
<van-popup show="{{ show6 }}" position="bottom" safe-area-inset-bottom round bind:close="onClose2">
<view class="tit">
<view class="cancel" bind:close="onClose2">取消</view>
<view class="sub" bind:tap="modeToFlowRate">确定</view>
</view>
<view class="row">
<view class="row_label">设置数额:</view>
<view class="row_con">
<input type="number" value="{{surplus_flow}}" bindinput="changeRemainingDay3" placeholder="请输入数额" />
</view>
</view>
</van-popup>
<van-popup show="{{ UninstallDateShow }}" bind:close="closeUninstallDate" safe-area-inset-bottom position="bottom" close-on-click-overlay>
<van-datetime-picker title="预约时间" bind:cancel="closeUninstallDate" formatter="{{ formatter }}" type="datetime" min-date="{{ minDate }}" bind:confirm="onInput2" />
</van-popup>

View File

@ -1,101 +1,101 @@
<view class="container">
<view class="btns" bind:tap="scanQrcode">扫码添加设备</view>
<view class="iptBox">
<span class="label">设备编码:</span>
<input type="text" confirm-type="search" bindconfirm="search" value="{{deviceInfo.device_code}}" bind:input="iptDeviceCode" placeholder="请输入设备编码" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
<view class="choseJXS">
<view class="label">
经销商:
</view>
<view class="con">
<input type="text" value="{{deal.deal_name}}" placeholder="请选择经销商" bind:tap="choseJXS" disabled />
</view>
</view>
<view class="choseJXS2">
<view class="label">
扫码台数:
</view>
<view class="con">
<input type="text" value="{{deviceList.length}}" placeholder="0" bind:tap="choseJXS" disabled />
</view>
</view>
<view class="deviceList">
<view class="deviceList_tit">
<view class="deviceList_tit_item">产品名称</view>
<view class="deviceList_tit_item">设备编码</view>
<view class="deviceList_tit_item">操作</view>
</view>
<view class="deviceList_item" wx:for="{{deviceList}}">
<view class="deviceList_item_con">{{item.product_name}}</view>
<view class="deviceList_item_con">{{item.device_code}}</view>
<view class="deviceList_item_con dele" bind:tap="deleteItem" data-idx="{{index}}">删除</view>
</view>
<!-- <view class="deviceItem" wx:for="{{deviceList}}">
<view class="row">
<view class="row_label">设备名称:</view>
<view class="row_con">{{item.product_name}}</view>
</view>
<view class="row">
<view class="row_label">设备编码:</view>
<view class="row_con">{{item.device_code}}</view>
</view>
<view class="row">
<view class="row_label">计费方式:</view>
<text class="row_con" wx:if="{{item.billing_method == 1}}">时长模式</text>
<text class="row_con" wx:if="{{item.billing_method == 2}}">流量模式</text>
<text class="row_con" wx:if="{{item.billing_method == 3}}">零售模式</text>
</view>
<view class="row">
<view class="row_label">设备ICCID</view>
<view class="row_con">{{item.device_iccid}}</view>
</view>
<view class="row">
<view class="row_label">设备IMEI</view>
<view class="row_con">{{item.device_imei}}</view>
</view>
<view class="row">
<view class="row_label">安装状态</view>
<text class="row_con" wx:if="{{item.install_status == 1}}">已安装</text>
<text class="row_con" wx:if="{{item.install_status == 2}}">空闲</text>
<text class="row_con" wx:if="{{item.install_status == 3}}">已拆机</text>
</view>
<view class="row">
<view class="row_label">服务状态</view>
<text class="row_con" wx:if="{{item.sevice_status == 1}}">开机</text>
<text class="row_con" wx:if="{{item.sevice_status == 2}}">关机</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">制水故障</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">漏水故障</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">主板故障</text>
</view>
<view class="row2">
<view class="deletes" bind:tap="deleteItem" data-idx="{{index}}">删除</view>
</view>
</view> -->
</view>
<view class="contralList">
<view class="contralBtn2" bind:tap="cancels">取消</view>
<view class="contralBtn1" bind:tap="allocation">分配</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose" position="bottom">
<van-picker value-key="deal_name" bind:cancel="onClose" bind:confirm="onConfirm" show-toolbar columns="{{ columns }}" bind:change="onChange" />
</van-popup>
<view class="container">
<view class="btns" bind:tap="scanQrcode">扫码添加设备</view>
<view class="iptBox">
<span class="label">设备编码:</span>
<input type="text" confirm-type="search" bindconfirm="search" value="{{deviceInfo.device_code}}" bind:input="iptDeviceCode" placeholder="请输入设备编码" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
<view class="choseJXS">
<view class="label">
经销商:
</view>
<view class="con">
<input type="text" value="{{deal.deal_name}}" placeholder="请选择经销商" bind:tap="choseJXS" disabled />
</view>
</view>
<view class="choseJXS2">
<view class="label">
扫码台数:
</view>
<view class="con">
<input type="text" value="{{deviceList.length}}" placeholder="0" bind:tap="choseJXS" disabled />
</view>
</view>
<view class="deviceList">
<view class="deviceList_tit">
<view class="deviceList_tit_item">产品名称</view>
<view class="deviceList_tit_item">设备编码</view>
<view class="deviceList_tit_item">操作</view>
</view>
<view class="deviceList_item" wx:for="{{deviceList}}">
<view class="deviceList_item_con">{{item.product_name}}</view>
<view class="deviceList_item_con">{{item.device_code}}</view>
<view class="deviceList_item_con dele" bind:tap="deleteItem" data-idx="{{index}}">删除</view>
</view>
<!-- <view class="deviceItem" wx:for="{{deviceList}}">
<view class="row">
<view class="row_label">设备名称:</view>
<view class="row_con">{{item.product_name}}</view>
</view>
<view class="row">
<view class="row_label">设备编码:</view>
<view class="row_con">{{item.device_code}}</view>
</view>
<view class="row">
<view class="row_label">计费方式:</view>
<text class="row_con" wx:if="{{item.billing_method == 1}}">时长模式</text>
<text class="row_con" wx:if="{{item.billing_method == 2}}">流量模式</text>
<text class="row_con" wx:if="{{item.billing_method == 3}}">零售模式</text>
</view>
<view class="row">
<view class="row_label">设备ICCID</view>
<view class="row_con">{{item.device_iccid}}</view>
</view>
<view class="row">
<view class="row_label">设备IMEI</view>
<view class="row_con">{{item.device_imei}}</view>
</view>
<view class="row">
<view class="row_label">安装状态</view>
<text class="row_con" wx:if="{{item.install_status == 1}}">已安装</text>
<text class="row_con" wx:if="{{item.install_status == 2}}">空闲</text>
<text class="row_con" wx:if="{{item.install_status == 3}}">已拆机</text>
</view>
<view class="row">
<view class="row_label">服务状态</view>
<text class="row_con" wx:if="{{item.sevice_status == 1}}">开机</text>
<text class="row_con" wx:if="{{item.sevice_status == 2}}">关机</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">制水故障</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">漏水故障</text>
<text class="row_con" wx:if="{{item.sevice_status == 3}}">主板故障</text>
</view>
<view class="row2">
<view class="deletes" bind:tap="deleteItem" data-idx="{{index}}">删除</view>
</view>
</view> -->
</view>
<view class="contralList">
<view class="contralBtn2" bind:tap="cancels">取消</view>
<view class="contralBtn1" bind:tap="allocation">分配</view>
</view>
<van-popup show="{{ show }}" bind:close="onClose" position="bottom">
<van-picker value-key="deal_name" bind:cancel="onClose" bind:confirm="onConfirm" show-toolbar columns="{{ columns }}" bind:change="onChange" />
</van-popup>
</view>

View File

@ -1,195 +1,196 @@
import { areaList } from '../../data/index';
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
// packages/master/masterInfo/index.js
Page({
/**
* 页面的初始数据
*/
data: {
areaList,
Info: {},
sexOptions: ['男', '女'],
sexIndex: "",
avatarUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png?2",
avatarUrl2: "",
fileList: [],
show: "",
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
that.setData({
"Info.deal_img": url,
"Info.deal_icon": url2
})
})
}
});
},
changeLegal(e) {
let that = this
that.setData({
"Info.legal": e.detail.value
})
},
changeDealName(e) {
let that = this
that.setData({
"Info.deal_name": e.detail.value
})
},
changePhone(e) {
let that = this
that.setData({
"Info.phone": e.detail.value
})
},
changeCustomerPhone(e) {
let that = this
that.setData({
"Info.customer_phone": e.detail.value
})
},
changeAddress(e){
let that = this
that.setData({
"Info.address": e.detail.value
})
},
choseRegion() {
let that = this
that.setData({
show: true
})
},
changeAddress(e){
let that = this
that.setData({
"Info.address": e.detail.value
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
AreaConfirm(e){
let that = this
let region
if(e.detail.values[0].name == e.detail.values[1].name){
region = e.detail.values[0].name + e.detail.values[2].name
}else{
region = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
"Info.region":region,
show:false
})
},
getAdminInfo() {
let that = this
util.postUrl4(apiArr.getPartner, { deal_id: wx.getStorageSync('admin').shop_id }, res => {
console.log(res);
res.deal_icon = res.deal_icon.startsWith('http') ? res.deal_icon : util.img_url + res.deal_icon
that.setData({
Info: res
})
})
},
saveMasterInfo(){
let that = this
wx.showLoading({
title: '修改中...',
})
util.postUrl4(apiArr.editPartner,that.data.Info,res=>{
wx.hideLoading()
wx.showToast({
title: '修改成功',
icon:"none"
})
that.getAdminInfo()
})
},
exit(){
wx.removeStorageSync('atoken')
wx.removeStorageSync('admin')
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getAdminInfo()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
import { areaList } from '../../data/index';
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
// packages/master/masterInfo/index.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
areaList,
Info: {},
sexOptions: ['男', '女'],
sexIndex: "",
avatarUrl: (__staticUrl + '/person/Group_309.png?2'),
avatarUrl2: "",
fileList: [],
show: "",
},
// 选择头像
chooseAvatar() {
let that = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// 这里可以添加上传头像到服务器的逻辑
util.uploadFileUrl(tempFilePath, (res) => {
let datas = JSON.parse(res)
console.log(datas.data);
let url = util.img_url + datas.data.path
let url2 = datas.data.path
let fileList = that.data.fileList
that.setData({
"Info.deal_img": url,
"Info.deal_icon": url2
})
})
}
});
},
changeLegal(e) {
let that = this
that.setData({
"Info.legal": e.detail.value
})
},
changeDealName(e) {
let that = this
that.setData({
"Info.deal_name": e.detail.value
})
},
changePhone(e) {
let that = this
that.setData({
"Info.phone": e.detail.value
})
},
changeCustomerPhone(e) {
let that = this
that.setData({
"Info.customer_phone": e.detail.value
})
},
changeAddress(e){
let that = this
that.setData({
"Info.address": e.detail.value
})
},
choseRegion() {
let that = this
that.setData({
show: true
})
},
changeAddress(e){
let that = this
that.setData({
"Info.address": e.detail.value
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
AreaConfirm(e){
let that = this
let region
if(e.detail.values[0].name == e.detail.values[1].name){
region = e.detail.values[0].name + e.detail.values[2].name
}else{
region = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
}
that.setData({
"Info.region":region,
show:false
})
},
getAdminInfo() {
let that = this
util.postUrl4(apiArr.getPartner, { deal_id: wx.getStorageSync('admin').shop_id }, res => {
console.log(res);
res.deal_icon = res.deal_icon.startsWith('http') ? res.deal_icon : util.img_url + res.deal_icon
that.setData({
Info: res
})
})
},
saveMasterInfo(){
let that = this
wx.showLoading({
title: '修改中...',
})
util.postUrl4(apiArr.editPartner,that.data.Info,res=>{
wx.hideLoading()
wx.showToast({
title: '修改成功',
icon:"none"
})
that.getAdminInfo()
})
},
exit(){
wx.removeStorageSync('atoken')
wx.removeStorageSync('admin')
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getAdminInfo()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,157 +1,158 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/income/income.js
Page({
/**
* 页面的初始数据
*/
data: {
tabIndex:0,
SelectDate:[],
page_size:10,
page_num:1,
flag:false,
orderList:[],
},
getBanlance(){
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getOrderBuyList,{
pay_time:that.data.SelectDate,
dealer_id:wx.getStorageSync('dealer_id'),
page_size:that.data.page_size,
page_num:that.data.page_num
},res=>{
wx.hideLoading()
console.log(res);
let flag = false
if(!res.rows){
return
}
if(that.data.page_size == res.rows.length){
flag = true
}else{
flag = false
}
that.setData({
orderList:that.data.orderList.concat(res.rows || []),
page_num:that.data.page_num + 1,
flag,
})
})
},
changeIndex(e){
let that = this
let SelectDate
if(e.currentTarget.dataset.index == '0'){
if(wx.getStorageSync('SelectDate')){
SelectDate = wx.getStorageSync('SelectDate')
}else{
SelectDate = []
}
}else{
SelectDate = []
}
that.setData({
tabIndex:e.currentTarget.dataset.index,
SelectDate,
page_num:1,
flag:false,
orderList:[]
})
that.getBanlance()
},
detail(){
wx.navigateTo({
url: '../incomeDetail/incomeDetail',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
let SelectDate = wx.getStorageSync('SelectDate')
if(SelectDate){
that.setData({
SelectDate
})
}
that.getBanlance()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
console.log(123);
let that = this
if(that.data.flag){
that.getBanlance()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/income/income.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
tabIndex:0,
SelectDate:[],
page_size:10,
page_num:1,
flag:false,
orderList:[],
},
getBanlance(){
let that = this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.getOrderBuyList,{
pay_time:that.data.SelectDate,
dealer_id:wx.getStorageSync('dealer_id'),
page_size:that.data.page_size,
page_num:that.data.page_num
},res=>{
wx.hideLoading()
console.log(res);
let flag = false
if(!res.rows){
return
}
if(that.data.page_size == res.rows.length){
flag = true
}else{
flag = false
}
that.setData({
orderList:that.data.orderList.concat(res.rows || []),
page_num:that.data.page_num + 1,
flag,
})
})
},
changeIndex(e){
let that = this
let SelectDate
if(e.currentTarget.dataset.index == '0'){
if(wx.getStorageSync('SelectDate')){
SelectDate = wx.getStorageSync('SelectDate')
}else{
SelectDate = []
}
}else{
SelectDate = []
}
that.setData({
tabIndex:e.currentTarget.dataset.index,
SelectDate,
page_num:1,
flag:false,
orderList:[]
})
that.getBanlance()
},
detail(){
wx.navigateTo({
url: '../incomeDetail/incomeDetail',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
let SelectDate = wx.getStorageSync('SelectDate')
if(SelectDate){
that.setData({
SelectDate
})
}
that.getBanlance()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
console.log(123);
let that = this
if(that.data.flag){
that.getBanlance()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,70 +1,70 @@
<view class="income" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/incomeBg.png?1);">
<Nav Text="我的订单" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<!-- <view class="incomeList">
<view class="incomeItem">
<view class="incomeItem_Num">27596.27</view>
<view class="incomeItem_text">可提现(元)</view>
</view>
<view class="incomeItem border">
<view class="incomeItem_Num">0</view>
<view class="incomeItem_text">提现中(元)</view>
</view>
<view class="incomeItem">
<view class="incomeItem_Num">27596.27</view>
<view class="incomeItem_text">已提现(元)</view>
</view>
</view> -->
<view class="orderTab">
<view class="tabItem {{tabIndex == '0'?'active':''}}" bind:tap="changeIndex" data-index="0">当前订单</view>
<view class="tabItem {{tabIndex == '1'?'active':''}}" bind:tap="changeIndex" data-index="1">历史订单</view>
</view>
<view class="orderList">
<view class="orderItem" wx:if="{{orderList.length != 0}}" wx:for="{{orderList}}" bind:tap="detail">
<view class="orderItem_row">
<view class="orderItem_row_tit">
订单名称
</view>
<view class="orderItem_row_con">
{{item.order_name}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
订单号
</view>
<view class="orderItem_row_con">
{{item.order_no}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
金额
</view>
<view class="orderItem_row_con">
{{item.total_price}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
支付时间
</view>
<view class="orderItem_row_con">
{{item.pay_time}}
</view>
</view>
<!-- <view class="orderItem_row">
<view class="orderItem_row_tit">
推广收入
</view>
<view class="orderItem_row_con">
50元
</view>
</view> -->
</view>
<van-empty wx:if="{{orderList.length == 0}}" description="暂无订单" />
</view>
</view>
<view class="income" style="background-image: url('https://static.hshuishang.com/water_filter/partner/incomeBg.png?1');">
<Nav Text="我的订单" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<!-- <view class="incomeList">
<view class="incomeItem">
<view class="incomeItem_Num">27596.27</view>
<view class="incomeItem_text">可提现(元)</view>
</view>
<view class="incomeItem border">
<view class="incomeItem_Num">0</view>
<view class="incomeItem_text">提现中(元)</view>
</view>
<view class="incomeItem">
<view class="incomeItem_Num">27596.27</view>
<view class="incomeItem_text">已提现(元)</view>
</view>
</view> -->
<view class="orderTab">
<view class="tabItem {{tabIndex == '0'?'active':''}}" bind:tap="changeIndex" data-index="0">当前订单</view>
<view class="tabItem {{tabIndex == '1'?'active':''}}" bind:tap="changeIndex" data-index="1">历史订单</view>
</view>
<view class="orderList">
<view class="orderItem" wx:if="{{orderList.length != 0}}" wx:for="{{orderList}}" bind:tap="detail">
<view class="orderItem_row">
<view class="orderItem_row_tit">
订单名称
</view>
<view class="orderItem_row_con">
{{item.order_name}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
订单号
</view>
<view class="orderItem_row_con">
{{item.order_no}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
金额
</view>
<view class="orderItem_row_con">
{{item.total_price}}
</view>
</view>
<view class="orderItem_row">
<view class="orderItem_row_tit">
支付时间
</view>
<view class="orderItem_row_con">
{{item.pay_time}}
</view>
</view>
<!-- <view class="orderItem_row">
<view class="orderItem_row_tit">
推广收入
</view>
<view class="orderItem_row_con">
50元
</view>
</view> -->
</view>
<van-empty wx:if="{{orderList.length == 0}}" description="暂无订单" />
</view>
</view>

View File

@ -1,29 +1,29 @@
<view class="invite">
<Nav Text="邀请情况" backColor="#ffffff" color="#ffffff" NavPosition="relative"></Nav>
<view class="text">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/invite_text.png" mode="widthFix"/>
</view>
<view class="after">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/invite.png" mode="widthFix"/>
</view>
<view class="phb">
<view class="phbTit">
<view class="pbhTit_40">用户名</view>
<view class="pbhTit_15">一级</view>
<view class="pbhTit_15">二级</view>
<view class="pbhTit_15">天使</view>
</view>
<view class="phb_item" wx:for="{{25}}">
<view class="pbhTit_40">总部直销团队</view>
<view class="pbhTit_15">84</view>
<view class="pbhTit_15">80</view>
<view class="pbhTit_15">60</view>
</view>
</view>
</view>
<Footer></Footer>
<view class="invite">
<Nav Text="邀请情况" backColor="#ffffff" color="#ffffff" NavPosition="relative"></Nav>
<view class="text">
<image src="https://static.hshuishang.com/water_filter/partner/invite_text.png" mode="widthFix"/>
</view>
<view class="after">
<image src="https://static.hshuishang.com/water_filter/partner/invite.png" mode="widthFix"/>
</view>
<view class="phb">
<view class="phbTit">
<view class="pbhTit_40">用户名</view>
<view class="pbhTit_15">一级</view>
<view class="pbhTit_15">二级</view>
<view class="pbhTit_15">天使</view>
</view>
<view class="phb_item" wx:for="{{25}}">
<view class="pbhTit_40">总部直销团队</view>
<view class="pbhTit_15">84</view>
<view class="pbhTit_15">80</view>
<view class="pbhTit_15">60</view>
</view>
</view>
</view>
<Footer></Footer>

View File

@ -1,40 +1,40 @@
<!--pages/login/login.wxml-->
<view class="login" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/login/Group_491_jingshui.png);">
<view class="login-title">
<view class="login-tip" style="font-size: 40rpx; color: #000000;">欢迎来到【人人爱净水】</view>
<!-- <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验,请选择登录方式</view> -->
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;" wx:if="{{loginType === 'phone'}}">为了更好的体验,申请获取您的公开信息</view>
<!-- 登录方式切换 -->
<view class="agreement">
<van-checkbox value="{{ checked }}" bind:change="onChange"></van-checkbox>
<text>我已阅读并同意</text>
<text class="link" bindtap="navigateToAgreement">《用户服务协议和隐私政策》</text>
</view>
<!-- 账号密码登录 -->
<view>
<view class="login-form">
<input class="login-input" value="{{account}}" bindinput="accountIpt" placeholder="请输入账号" />
<input class="login-input" password value="{{password}}" bindinput="passwordIpt" placeholder="请输入密码" />
</view>
<view class="login-button">
<button class="login-btn" wx:if="{{checked}}" bindtap="accountLogin">
登录
</button>
<button class="login-btn" wx:if="{{!checked}}" bind:tap="showTo">
登录
</button>
</view>
</view>
<view class="login-to-home">
<text class="login-to-home-text" bindtap='tohome'>
返回首页>>
</text>
</view>
</view>
<!--pages/login/login.wxml-->
<view class="login" style="background-image: url('https://static.hshuishang.com/login/Group_491_jingshui.png');">
<view class="login-title">
<view class="login-tip" style="font-size: 40rpx; color: #000000;">欢迎来到【人人爱净水】</view>
<!-- <view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;">为了更好的体验,请选择登录方式</view> -->
<view class="login-tip" style="font-size: 28rpx; color: #555555; margin-top: 30rpx;" wx:if="{{loginType === 'phone'}}">为了更好的体验,申请获取您的公开信息</view>
<!-- 登录方式切换 -->
<view class="agreement">
<van-checkbox value="{{ checked }}" bind:change="onChange"></van-checkbox>
<text>我已阅读并同意</text>
<text class="link" bindtap="navigateToAgreement">《用户服务协议和隐私政策》</text>
</view>
<!-- 账号密码登录 -->
<view>
<view class="login-form">
<input class="login-input" value="{{account}}" bindinput="accountIpt" placeholder="请输入账号" />
<input class="login-input" password value="{{password}}" bindinput="passwordIpt" placeholder="请输入密码" />
</view>
<view class="login-button">
<button class="login-btn" wx:if="{{checked}}" bindtap="accountLogin">
登录
</button>
<button class="login-btn" wx:if="{{!checked}}" bind:tap="showTo">
登录
</button>
</view>
</view>
<view class="login-to-home">
<text class="login-to-home-text" bindtap='tohome'>
返回首页>>
</text>
</view>
</view>
</view>

View File

@ -1,65 +1,65 @@
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
</view>

View File

@ -1,66 +1,66 @@
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
</view>

View File

@ -1,152 +1,153 @@
const util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
// packages/partner/pages/master/master.js
Page({
/**
* 页面的初始数据
*/
data: {
nav_list:{},
foot_width:"",
page_num:1,
page_size:10,
total:'',
flag:false,
MasterList:[],
admin:""
},
creatMaster(){
wx.navigateTo({
url: '../creatMaster/creatMaster',
})
},
desc(e){
console.log(e);
wx.navigateTo({
url: `../masterDesc/masterDesc?info_id=${e.currentTarget.dataset.id}`,
})
},
getMasterList(){
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl4(apiArr.MasterList,{
page_num:that.data.page_num,
page_size:that.data.page_size,
dealer_id:that.data.admin.shop_id
},res=>{
wx.hideLoading()
let flag = false;
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
res.rows.forEach(item=>{
// item.avatar = util.img_url + item.avatar
item.avatar = item.avatar.startsWith('http')?item.avatar: util.img_url + item.avatar
})
that.setData({
MasterList:that.data.MasterList.concat(res.rows || []),
page_num:that.data.page_num + 1,
flag
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.setData({
MasterList:[],
page_num:1,
flag:true
})
that.getMasterList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that= this
that.setData({
flag:false,
page_num:1,
MasterList:[],
})
that.getMasterList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if(that.data.flag){
this.getMasterList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
const util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
// packages/partner/pages/master/master.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
nav_list:{},
foot_width:"",
page_num:1,
page_size:10,
total:'',
flag:false,
MasterList:[],
admin:""
},
creatMaster(){
wx.navigateTo({
url: '../creatMaster/creatMaster',
})
},
desc(e){
console.log(e);
wx.navigateTo({
url: `../masterDesc/masterDesc?info_id=${e.currentTarget.dataset.id}`,
})
},
getMasterList(){
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl4(apiArr.MasterList,{
page_num:that.data.page_num,
page_size:that.data.page_size,
dealer_id:that.data.admin.shop_id
},res=>{
wx.hideLoading()
let flag = false;
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
res.rows.forEach(item=>{
// item.avatar = util.img_url + item.avatar
item.avatar = item.avatar.startsWith('http')?item.avatar: util.img_url + item.avatar
})
that.setData({
MasterList:that.data.MasterList.concat(res.rows || []),
page_num:that.data.page_num + 1,
flag
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.setData({
MasterList:[],
page_num:1,
flag:true
})
that.getMasterList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that= this
that.setData({
flag:false,
page_num:1,
MasterList:[],
})
that.getMasterList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if(that.data.flag){
this.getMasterList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,206 +1,207 @@
let util = require('../../../../utils/util')
// const apiArr = require('../../../api/water_filter')
const apiArr = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/partner/pages/partner.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
nav_list:{},
foot_width:"",
funcList:[
{
text:"设备管理",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon2.png?1",
url:"/packages/partner/pages/device/device",
},
{
text:"师傅管理",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon6.png?1",
url:"../master/master",
},
{
text:"收银台",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon7.png?1",
// url:"../pages/desk/desk",
},
{
text:"分配经销商",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/partner_icon_new1.png",
url:"/packages/partner/pages/distributor/distributor",
},
{
text:"设备库存",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/equipmentStock.png",
url:"/packages/partner/pages/equipmentStock/equipmentStock",
},
{
text:"滤芯库存",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url:"/packages/partner/pages/filterStock/filterStock",
},
{
text:"消息订阅",
img:"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/SubscribeMessageIcon.png",
url:"/pages/SubscribeMessage/SubscribeMessage",
},
],
Info:"",
order:"",
},
back(){
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
editAdmin(){
wx.navigateTo({
url: '/packages/partner/pages/editAdmin/editAdmin',
})
},
padToEightDigits(number) {
// 将数字转换为字符串,并使用 padStart 补足到 8 位
return String(number).padStart(8, '0');
},
getOrderList(){
let that = this
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartnerOrder,{
dealer_id:admin.shop_id
},res=>{
that.setData({
order:res
})
})
},
getParter(){
let that =this
wx.showLoading({
title: '加载中...',
mask:true
})
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartner,{
deal_id:admin.shop_id
},res=>{
wx.hideLoading()
res.No = that.padToEightDigits(res.deal_id)
if(res.deal_icon){
res.deal_icon = res.deal_icon.startsWith('http')?res.deal_icon:util.img_url + res.deal_icon
}
console.log(admin.shop_id);
if(admin.shop_id != 1){
let funcList = that.data.funcList
funcList.splice(7,1)
that.setData({
funcList
})
}
that.setData({
Info:res
})
})
},
jump(e){
console.log(e);
if(!e.currentTarget.dataset.url){
return wx.showToast({
title: '功能暂未开通',
icon:"none"
})
}
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
// that.getOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getParter()
},
/**
* 生命周期函数--监听页面隐藏
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
// const apiArr = require('../../../api/water_filter')
const apiArr = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/partner/pages/partner.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
nav_list:{},
foot_width:"",
funcList:[
{
text:"设备管理",
img:(__staticUrl + '/water_filter/partner/partner_icon2.png?1'),
url:"/packages/partner/pages/device/device",
},
{
text:"师傅管理",
img:(__staticUrl + '/water_filter/partner/partner_icon6.png?1'),
url:"../master/master",
},
{
text:"收银台",
img:(__staticUrl + '/water_filter/partner/partner_icon7.png?1'),
// url:"../pages/desk/desk",
},
{
text:"分配经销商",
img:(__staticUrl + '/partner_icon_new1.png'),
url:"/packages/partner/pages/distributor/distributor",
},
{
text:"设备库存",
img:(__staticUrl + '/equipmentStock.png'),
url:"/packages/partner/pages/equipmentStock/equipmentStock",
},
{
text:"滤芯库存",
img:(__staticUrl + '/filterStock.png'),
url:"/packages/partner/pages/filterStock/filterStock",
},
{
text:"消息订阅",
img:(__staticUrl + '/SubscribeMessageIcon.png'),
url:"/pages/SubscribeMessage/SubscribeMessage",
},
],
Info:"",
order:"",
},
back(){
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
editAdmin(){
wx.navigateTo({
url: '/packages/partner/pages/editAdmin/editAdmin',
})
},
padToEightDigits(number) {
// 将数字转换为字符串,并使用 padStart 补足到 8 位
return String(number).padStart(8, '0');
},
getOrderList(){
let that = this
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartnerOrder,{
dealer_id:admin.shop_id
},res=>{
that.setData({
order:res
})
})
},
getParter(){
let that =this
wx.showLoading({
title: '加载中...',
mask:true
})
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartner,{
deal_id:admin.shop_id
},res=>{
wx.hideLoading()
res.No = that.padToEightDigits(res.deal_id)
if(res.deal_icon){
res.deal_icon = res.deal_icon.startsWith('http')?res.deal_icon:util.img_url + res.deal_icon
}
console.log(admin.shop_id);
if(admin.shop_id != 1){
let funcList = that.data.funcList
funcList.splice(7,1)
that.setData({
funcList
})
}
that.setData({
Info:res
})
})
},
jump(e){
console.log(e);
if(!e.currentTarget.dataset.url){
return wx.showToast({
title: '功能暂未开通',
icon:"none"
})
}
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
// that.getOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getParter()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,62 +1,62 @@
<view class="partner">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="20px" />
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<view class="UserInfo">
<view class="UserInfo_msg">
<view class="UserInfo_ava">
<image wx:if="{{!Info.deal_icon}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_person.png" mode="widthFix" />
<image wx:if="{{Info.deal_icon}}" src="{{Info.deal_icon}}" mode="widthFix" />
</view>
<view class="UserInfo_Info">
<view class="UserInfo_Info_name">{{Info.deal_name}}</view>
<view class="UserInfo_Info_company">编码:{{Info.deal_code}}</view>
<view class="UserInfo_Info_company">手机号:{{Info.owner_phone}}</view>
</view>
</view>
<view class="UserInfo_level ">
<!-- <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_level.png" mode="widthFix"/>
<view>{{Info.invite_dealer_id?'初级合伙人':'高级合伙人'}}</view> -->
<view class="edit" bind:tap="editAdmin">修改</view>
</view>
</view>
<!-- <view class="text1">NO.{{Info.No}}</view>
<view class="text1">智能净水管家</view> -->
<!-- <view class="orderList">
<view class="orderItem">
<view class="orderNum">{{order.wait_pay}}</view>
<view class="orderText">待支付</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_audit}}</view>
<view class="orderText">待审核</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_send}}</view>
<view class="orderText">待发货</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_goods}}</view>
<view class="orderText">待收货</view>
</view>
</view> -->
<view class="Tit">功能服务</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
</view>
<view class="partner">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="20px" />
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://static.hshuishang.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<view class="UserInfo">
<view class="UserInfo_msg">
<view class="UserInfo_ava">
<image wx:if="{{!Info.deal_icon}}" src="https://static.hshuishang.com/water_filter/partner/partner_person.png" mode="widthFix" />
<image wx:if="{{Info.deal_icon}}" src="{{Info.deal_icon}}" mode="widthFix" />
</view>
<view class="UserInfo_Info">
<view class="UserInfo_Info_name">{{Info.deal_name}}</view>
<view class="UserInfo_Info_company">编码:{{Info.deal_code}}</view>
<view class="UserInfo_Info_company">手机号:{{Info.owner_phone}}</view>
</view>
</view>
<view class="UserInfo_level ">
<!-- <image src="https://static.hshuishang.com/water_filter/partner/partner_level.png" mode="widthFix"/>
<view>{{Info.invite_dealer_id?'初级合伙人':'高级合伙人'}}</view> -->
<view class="edit" bind:tap="editAdmin">修改</view>
</view>
</view>
<!-- <view class="text1">NO.{{Info.No}}</view>
<view class="text1">智能净水管家</view> -->
<!-- <view class="orderList">
<view class="orderItem">
<view class="orderNum">{{order.wait_pay}}</view>
<view class="orderText">待支付</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_audit}}</view>
<view class="orderText">待审核</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_send}}</view>
<view class="orderText">待发货</view>
</view>
<view class="orderItem">
<view class="orderNum">{{order.wait_goods}}</view>
<view class="orderText">待收货</view>
</view>
</view> -->
<view class="Tit">功能服务</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
</view>
<Footer></Footer>

View File

@ -1,66 +1,66 @@
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
<view class="container">
<view class="dropBox">
<van-dropdown-menu>
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text1}}" value="{{ value1 }}" options="{{ option1 }}" bind:change="headerNetWorkClick" />
<van-dropdown-item bind:open="onDropdownOpen" bind:close="onDropdownClose" title="{{text2}}" value="{{ value2 }}" options="{{ option2 }}" bind:change="headerEquipmentClick" />
</van-dropdown-menu>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
</view>

View File

@ -1,57 +1,57 @@
<view class="container">
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty" wx:if="{{false}}">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
<view class="container">
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="empty" wx:if="{{false}}">
<van-empty description="暂无内容" />
</view>
<view class="pack">
<view class="PackageItem">
<view class="packItem_tit">
<view class="packItem_tit_left">
套餐编号:123123
</view>
<view class="packItem_tit_right">
订单状态:已完成
</view>
</view>
<view class="packItem">
<view class="packItem_left">
<image src=""></image>
</view>
<view class="packItem_right">
<view class="row">
<view class="row_label">套餐名称:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">套餐类型:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">客户姓名:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">实付价格:</view>
<view class="row_con">xxxx</view>
</view>
<view class="row">
<view class="row_label">支付时间:</view>
<view class="row_con">xxxx</view>
</view>
</view>
</view>
<view class="packInfo">查看套餐详情</view>
</view>
</view>
</view>

View File

@ -1,234 +1,235 @@
let util = require('../../../utils/util')
// const apiArr = require('../../../api/water_filter')
const apiArr = require('../../../api/partner')
const apiArr2 = require('../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/partner/pages/partner.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
nav_list: {},
foot_width: "",
funcList: [
{
text: "新装工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon3.png?1",
url: "../pages/WorkOrder/WorkOrder",
},
{
text: "维修工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/partner_icon4.png?1",
url: "../../WaterPurifier/pages/upKeep/upKeep",
},
{
text: "拆除工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/removeIcon.png",
url: "../pages/removeOrder/removeOrder",
},
{
text: "滤芯更换工单",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/partsIcon.png",
url: "../pages/partsOrder/partsOrder",
},
],
funcList2: [
{
text: "滤芯预警营销",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url: "/packages/partner/pages/marketingOrder1/marketingOrder1",
},
{
text: "套餐预警营销",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url: "/packages/partner/pages/marketingOrder2/marketingOrder2",
},
],
funcList3: [
{
text: "滤芯订单(零售)",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url: "/packages/partner/pages/order1/order1",
},
{
text: "套餐订单(租赁)",
img: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/filterStock.png",
url: "/packages/partner/pages/order2/order2",
},
],
Info: "",
order: "",
serverInfo: ""
},
callPhone() {
let that = this
wx.makePhoneCall({
phoneNumber: that.data.serverInfo.customer_phone,
})
},
getServerInfo() {
let that = this
util.postUrl(apiArr2.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
})
})
},
back() {
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
editAdmin() {
wx.navigateTo({
url: '/packages/partner/pages/editAdmin/editAdmin',
})
},
padToEightDigits(number) {
// 将数字转换为字符串,并使用 padStart 补足到 8 位
return String(number).padStart(8, '0');
},
getOrderList() {
let that = this
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartnerOrder, {
dealer_id: admin.shop_id
}, res => {
that.setData({
order: res
})
})
},
getParter() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartner, {
deal_id: admin.shop_id
}, res => {
wx.hideLoading()
res.No = that.padToEightDigits(res.deal_id)
if (res.deal_icon) {
res.deal_icon = res.deal_icon.startsWith('http') ? res.deal_icon : util.img_url + res.deal_icon
}
console.log(admin.shop_id);
if (admin.shop_id != 1) {
let funcList = that.data.funcList
funcList.splice(7, 1)
that.setData({
funcList
})
}
that.setData({
Info: res
})
})
},
jump(e) {
console.log(e);
if (!e.currentTarget.dataset.url) {
return wx.showToast({
title: '功能暂未开通',
icon: "none"
})
}
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getServerInfo()
// that.getOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getParter()
},
/**
* 生命周期函数--监听页面隐藏
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../utils/util')
// const apiArr = require('../../../api/water_filter')
const apiArr = require('../../../api/partner')
const apiArr2 = require('../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/partner/pages/partner.js
const __staticUrl = require('../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
nav_list: {},
foot_width: "",
funcList: [
{
text: "新装工单",
img: (__staticUrl + '/water_filter/partner/partner_icon3.png?1'),
url: "../pages/WorkOrder/WorkOrder",
},
{
text: "维修工单",
img: (__staticUrl + '/water_filter/partner/partner_icon4.png?1'),
url: "../../WaterPurifier/pages/upKeep/upKeep",
},
{
text: "拆除工单",
img: (__staticUrl + '/removeIcon.png'),
url: "../pages/removeOrder/removeOrder",
},
{
text: "滤芯更换工单",
img: (__staticUrl + '/partsIcon.png'),
url: "../pages/partsOrder/partsOrder",
},
],
funcList2: [
{
text: "滤芯预警营销",
img: (__staticUrl + '/filterStock.png'),
url: "/packages/partner/pages/marketingOrder1/marketingOrder1",
},
{
text: "套餐预警营销",
img: (__staticUrl + '/filterStock.png'),
url: "/packages/partner/pages/marketingOrder2/marketingOrder2",
},
],
funcList3: [
{
text: "滤芯订单(零售)",
img: (__staticUrl + '/filterStock.png'),
url: "/packages/partner/pages/order1/order1",
},
{
text: "套餐订单(租赁)",
img: (__staticUrl + '/filterStock.png'),
url: "/packages/partner/pages/order2/order2",
},
],
Info: "",
order: "",
serverInfo: ""
},
callPhone() {
let that = this
wx.makePhoneCall({
phoneNumber: that.data.serverInfo.customer_phone,
})
},
getServerInfo() {
let that = this
util.postUrl(apiArr2.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
})
})
},
back() {
wx.reLaunch({
url: '/pages/newLogin/newLogin',
})
},
editAdmin() {
wx.navigateTo({
url: '/packages/partner/pages/editAdmin/editAdmin',
})
},
padToEightDigits(number) {
// 将数字转换为字符串,并使用 padStart 补足到 8 位
return String(number).padStart(8, '0');
},
getOrderList() {
let that = this
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartnerOrder, {
dealer_id: admin.shop_id
}, res => {
that.setData({
order: res
})
})
},
getParter() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
let admin = wx.getStorageSync('admin')
util.postUrl4(apiArr.getPartner, {
deal_id: admin.shop_id
}, res => {
wx.hideLoading()
res.No = that.padToEightDigits(res.deal_id)
if (res.deal_icon) {
res.deal_icon = res.deal_icon.startsWith('http') ? res.deal_icon : util.img_url + res.deal_icon
}
console.log(admin.shop_id);
if (admin.shop_id != 1) {
let funcList = that.data.funcList
funcList.splice(7, 1)
that.setData({
funcList
})
}
that.setData({
Info: res
})
})
},
jump(e) {
console.log(e);
if (!e.currentTarget.dataset.url) {
return wx.showToast({
title: '功能暂未开通',
icon: "none"
})
}
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getServerInfo()
// that.getOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let that = this
that.getParter()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,67 +1,67 @@
<view class="partner">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="20px" />
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<view class="swiper">
<swiper>
<swiper-item></swiper-item>
</swiper>
</view>
<view class="Tit">工单管理</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="Tit2">营销管理</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList2}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="Tit2">订单管理</view>
<view class="func">
<view class="funcItem3" wx:for="{{funcList3}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="orderMsg">
<view class="Tit">平台客服</view>
<view class="orderMsgBox">
<view class="orderMsgBox_left">
<view class="orderMsgBox_left1">
<view>平台电话</view>
<view bind:tap="callPhone">{{serverInfo.customer_phone}}
<van-icon name="phone-o" />
</view>
</view>
<view class="orderMsgBox_left2">
<view>工作时间</view>
<view>{{serverInfo.business_hours}}</view>
</view>
</view>
<view class="orderMsgBox_right">
<image show-menu-by-longpress src="{{serverInfo.qr_code}}" mode="widthFix" />
<span>长按保存二维码</span>
</view>
</view>
</view>
</view>
<view class="partner">
<view class="nav-box" style="padding-top: {{ t }}px;;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="20px" />
</view>
<view class="nav-bar-right">
<image style="opacity: 0;" src="https://static.hshuishang.com/water_filter/back.png" mode="widthFix" style="width:16rpx;height:28rpx" />
</view>
</view>
</view>
<view class="swiper">
<swiper>
<swiper-item></swiper-item>
</swiper>
</view>
<view class="Tit">工单管理</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="Tit2">营销管理</view>
<view class="func">
<view class="funcItem" wx:for="{{funcList2}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="Tit2">订单管理</view>
<view class="func">
<view class="funcItem3" wx:for="{{funcList3}}" bind:tap="jump" data-url="{{item.url}}">
<image src="{{item.img}}" mode="heightFix" />
<view>{{item.text}}</view>
</view>
</view>
<view class="orderMsg">
<view class="Tit">平台客服</view>
<view class="orderMsgBox">
<view class="orderMsgBox_left">
<view class="orderMsgBox_left1">
<view>平台电话</view>
<view bind:tap="callPhone">{{serverInfo.customer_phone}}
<van-icon name="phone-o" />
</view>
</view>
<view class="orderMsgBox_left2">
<view>工作时间</view>
<view>{{serverInfo.business_hours}}</view>
</view>
</view>
<view class="orderMsgBox_right">
<image show-menu-by-longpress src="{{serverInfo.qr_code}}" mode="widthFix" />
<span>长按保存二维码</span>
</view>
</view>
</view>
</view>
<Footer></Footer>

View File

@ -1,279 +1,280 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
value1: 0,
value2: 'a',
show: false,
MasterList: [
],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false,
admin: "",
show: false,
show2: false,
masterList: [],
currentMaster: "",
radio: "",
currentOrder: "",
radio: "",
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
onConfirms() {
let that = this
if (!that.data.currentMaster && !that.data.currentMaster.info_id) {
return wx.showToast({
title: '请选择师傅',
icon: "none"
})
}
util.postUrl4(apiArr.assignPartReplaceMaster, {
replace_id: that.data.currentOrder.replace_id,
master_id: that.data.currentMaster.info_id,
is_up: that.data.radio,
address: that.data.address,
}, res => {
wx.showToast({
title: '分配师傅成功',
icon: "none"
})
that.setData({
show: false
})
setTimeout(() => {
that.getNewOrderList()
}, 1500)
})
},
onChange2(e) {
let that = this
that.setData({
radio: e.detail
})
},
onConfirm(e) {
console.log(e);
let that = this
that.setData({
currentMaster: e.detail.value,
show2: false
})
},
onClose2() {
let that = this
that.setData({
show2: false
})
},
getMasterList() {
let that = this
util.postUrl4(apiArr.masterSelect, {
dealer_id: that.data.admin.shop_id
}, res => {
console.log(res.rows);
that.setData({
masterList: res.rows
})
})
},
chooseMaster() {
let that = this
that.setData({
show2: true
})
},
dispatch(e) {
let that = this
console.log(e);
that.setData({
show: true,
currentOrder: e.currentTarget.dataset.item,
address: e.currentTarget.dataset.item.address,
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=2`,
})
// wx.navigateTo({
// url: `../partsOrderInfo/partsOrderInfo?id=${e.currentTarget.dataset.id}`,
// })
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.getPartList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
dealer_id: that.data.admin.shop_id,
search:that.data.searchText
}, res => {
wx.hideLoading()
that.getMasterList()
if (res.rows) {
let flag = false
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
that.getNewOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
page_num: 1,
deviceList: [],
searchText:"",
flag: false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
value1: 0,
value2: 'a',
show: false,
MasterList: [
],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false,
admin: "",
show: false,
show2: false,
masterList: [],
currentMaster: "",
radio: "",
currentOrder: "",
radio: "",
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
onConfirms() {
let that = this
if (!that.data.currentMaster && !that.data.currentMaster.info_id) {
return wx.showToast({
title: '请选择师傅',
icon: "none"
})
}
util.postUrl4(apiArr.assignPartReplaceMaster, {
replace_id: that.data.currentOrder.replace_id,
master_id: that.data.currentMaster.info_id,
is_up: that.data.radio,
address: that.data.address,
}, res => {
wx.showToast({
title: '分配师傅成功',
icon: "none"
})
that.setData({
show: false
})
setTimeout(() => {
that.getNewOrderList()
}, 1500)
})
},
onChange2(e) {
let that = this
that.setData({
radio: e.detail
})
},
onConfirm(e) {
console.log(e);
let that = this
that.setData({
currentMaster: e.detail.value,
show2: false
})
},
onClose2() {
let that = this
that.setData({
show2: false
})
},
getMasterList() {
let that = this
util.postUrl4(apiArr.masterSelect, {
dealer_id: that.data.admin.shop_id
}, res => {
console.log(res.rows);
that.setData({
masterList: res.rows
})
})
},
chooseMaster() {
let that = this
that.setData({
show2: true
})
},
dispatch(e) {
let that = this
console.log(e);
that.setData({
show: true,
currentOrder: e.currentTarget.dataset.item,
address: e.currentTarget.dataset.item.address,
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=2`,
})
// wx.navigateTo({
// url: `../partsOrderInfo/partsOrderInfo?id=${e.currentTarget.dataset.id}`,
// })
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.getPartList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
dealer_id: that.data.admin.shop_id,
search:that.data.searchText
}, res => {
wx.hideLoading()
that.getMasterList()
if (res.rows) {
let flag = false
if (res.rows.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.rows || []),
page_num: that.data.page_num + 1
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
that.getNewOrderList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
page_num: 1,
deviceList: [],
searchText:"",
flag: false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,134 +1,134 @@
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
滤芯更换工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.replace_id}}">
<view class="orderItem_tit">工单名称:{{item.replace_name}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单号:</view>
<view class="orderItem_Item_con">{{item.replace_no}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">产品名称:</view>
<view class="orderItem_Item_con">{{item.device.product_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编码:</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">处理状态:</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 1}}">待分配</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 2}}">待更换</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 3}}">已更换</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 4}}">已忽略</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅名称:</view>
<view class="orderItem_Item_con">{{item.replace_man_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅手机:</view>
<view class="orderItem_Item_con">{{item.replace_man_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">计费方式:</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 1}}">时长模式</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 2}}">流量模式</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 3}}">零售模式</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称:</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机:</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址:</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="contral">
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">指派</view>
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
</view>
<van-popup show="{{ show }}" bind:close="onClose" close-on-click-overlay round position="bottom" z-index="99999">
<view class="popup-content">
<view class="popup-title">工单指派</view>
<!-- 是否上门 -->
<view class="form-item">
<text class="label">是否上门</text>
<radio-group class="radio-group" bindchange="onVisitChange">
<van-radio-group value="{{ radio }}" bind:change="onChange2" custom-class="horizontal-radio">
<van-radio name="1" class="radio-item">上门</van-radio>
<van-radio name="2" class="radio-item">邮寄</van-radio>
</van-radio-group>
</radio-group>
</view>
<!-- 师傅姓名 -->
<view class="form-item">
<text class="label">师傅姓名:</text>
<van-field value="{{ currentMaster.name }}" bind:tap="chooseMaster" placeholder="请选择师傅" border="{{ false }}" bind:change="onChange" />
</view>
<!-- 师傅地址 -->
<view class="form-item">
<text class="label">地址:</text>
<van-field value="{{ address }}" placeholder="请选择填写地址" border="{{ false }}" bind:change="onChange" />
</view>
<!-- 操作按钮 -->
<view class="btn-group">
<button class="btn cancel" bindtap="onClose">取消</button>
<button class="btn confirm" bindtap="onConfirms">确认指派</button>
</view>
</view>
</van-popup>
<van-popup show="{{ show2 }}" bind:close="onClose2" close-on-click-overlay round position="bottom" z-index="999999">
<van-picker bind:cancel="onClose2" bind:confirm="onConfirm" show-toolbar value-key="name" columns="{{ masterList }}" bind:change="onChange" />
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
滤芯更换工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.replace_id}}">
<view class="orderItem_tit">工单名称:{{item.replace_name}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">工单号:</view>
<view class="orderItem_Item_con">{{item.replace_no}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">产品名称:</view>
<view class="orderItem_Item_con">{{item.device.product_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编码:</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">处理状态:</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 1}}">待分配</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 2}}">待更换</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 3}}">已更换</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 4}}">已忽略</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅名称:</view>
<view class="orderItem_Item_con">{{item.replace_man_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅手机:</view>
<view class="orderItem_Item_con">{{item.replace_man_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">计费方式:</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 1}}">时长模式</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 2}}">流量模式</view>
<view class="orderItem_Item_con" wx:if="{{item.billing_method == 3}}">零售模式</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称:</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机:</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址:</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="contral">
<view class="state" wx:if="{{item.status === 1}}" data-item="{{item}}" catch:tap="dispatch">指派</view>
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
</view>
<van-popup show="{{ show }}" bind:close="onClose" close-on-click-overlay round position="bottom" z-index="99999">
<view class="popup-content">
<view class="popup-title">工单指派</view>
<!-- 是否上门 -->
<view class="form-item">
<text class="label">是否上门</text>
<radio-group class="radio-group" bindchange="onVisitChange">
<van-radio-group value="{{ radio }}" bind:change="onChange2" custom-class="horizontal-radio">
<van-radio name="1" class="radio-item">上门</van-radio>
<van-radio name="2" class="radio-item">邮寄</van-radio>
</van-radio-group>
</radio-group>
</view>
<!-- 师傅姓名 -->
<view class="form-item">
<text class="label">师傅姓名:</text>
<van-field value="{{ currentMaster.name }}" bind:tap="chooseMaster" placeholder="请选择师傅" border="{{ false }}" bind:change="onChange" />
</view>
<!-- 师傅地址 -->
<view class="form-item">
<text class="label">地址:</text>
<van-field value="{{ address }}" placeholder="请选择填写地址" border="{{ false }}" bind:change="onChange" />
</view>
<!-- 操作按钮 -->
<view class="btn-group">
<button class="btn cancel" bindtap="onClose">取消</button>
<button class="btn confirm" bindtap="onConfirms">确认指派</button>
</view>
</view>
</van-popup>
<van-popup show="{{ show2 }}" bind:close="onClose2" close-on-click-overlay round position="bottom" z-index="999999">
<van-picker bind:cancel="onClose2" bind:confirm="onConfirm" show-toolbar value-key="name" columns="{{ masterList }}" bind:change="onChange" />
</van-popup>

View File

@ -1,454 +1,454 @@
import { areaList } from '../../data/index';
const app = getApp()
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
Page({
/**
* 页面的初始数据
*/
data: {
checked:false,
areaList,
show:false, //弹出层
name:"",
phone:"",
area:"",
region:"",
address:"",
message:"",
tabIndex:1,
flag:false,
page_size:10,
page_num:1,
option2: [
{ text: '默认排序', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
],
value2: 'a',
buyProductList:[],
price:0,
deviceList:[],
orderMsg:"",
GoodsMsg:"",
delId:"",
},
iptMt(e){
let that =this
that.setData({
delId:e.detail.value,
page_num:1,
flag:false,
buyProductList:[]
})
that.getBuyProList()
},
//进货记录
getBuyProList(){
let that =this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.buyProductList,{
dealer_id:wx.getStorageSync('dealer_id'),
order_no:that.data.delId,
page_num:that.data.page_num,
page_size:that.data.page_size
},res=>{
console.log(res);
wx.hideLoading()
if( res.rows){
let flag = false
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
that.setData({
flag,
page_num:that.data.page_num +1,
buyProductList:that.data.buyProductList.concat(res.rows || [])
})
}
})
},
changeTab(e){
console.log('e111', e);
let that = this
that.setData({
tabIndex:e.currentTarget.dataset.index,
flag:false,
page_num:1,
buyProductList:[]
})
if (e.currentTarget.dataset.index === '1') {
console.log(123);
that.getBuyProList()
}
},
ipt1(e){
let that = this
that.setData({
name:e.detail.value
})
},
ipt2(e){
let that = this
that.setData({
phone:e.detail.value
})
},
ipt3(e){
let that = this
that.setData({
address:e.detail.value
})
},
ipt4(e){
let that = this
that.setData({
message:e.detail.value
})
},
account(){
wx.navigateTo({
url: '../payList/payList',
})
},
onClose(e){
let that = this
that.setData({
show:false
})
},
changeShow(){
let that = this
that.setData({
show:true
})
},
//选择地区
AreaConfirm(e){
let that = this
let region = ''
let area = ''
if(e.detail.values[0].name == e.detail.values[1].name){
area = e.detail.values[1].name + e.detail.values[2].name
region = e.detail.values[1].name +"/" + e.detail.values[2].name
}else{
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
region = e.detail.values[0].name +"/" + e.detail.values[1].name +"/" + e.detail.values[2].name
}
that.setData({
show:false,
area,
region
})
},
//取消
cancel(e){
let that = this
that.setData({
show:false
})
},
onChange(e){
let that = this
let item = e.currentTarget.dataset.item
let deviceList = that.data.deviceList
deviceList.forEach(items=>{
if(item.product_id == items.product_id){
items.num = e.detail
}
})
that.setData({
deviceList
})
let price = Number(0)
that.data.deviceList.forEach(item=>{
if(item.num != 0){
// price += util.floatCalculate(item.num,item.suggested_price,'*')
let currentMony = util.floatCalculate(item.num,item.suggested_price,'*')
price = util.floatCalculate(price,currentMony,'+=')
}
})
that.setData({
price
})
},
//设备列表
getProductList(){
let that =this
util.postUrl(apiArr.getProduct,{
dealer_id:wx.getStorageSync('dealer_id'),
page_num:that.data.page_num,
page_size:that.data.page_size,
status:1,
},res=>{
if(res.rows){
let flag =false
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
res.rows.forEach(item=>{
item.num = 0
item.product_icon = util.img_url + item.product_icon
})
that.setData({
deviceList:that.data.deviceList.concat(res.rows || []),
flag,
page_num:that.data.page_num + 1
})
}
})
},
//创建进货订单
createOrder(){
let that =this
let products = []
that.data.deviceList.forEach(item=>{
if(item.num > 0){
products.push({
number:item.num,
product_id:item.product_id
})
}
})
if(products.length == 0){
wx.showToast({
title: '请选择进货设备',
icon:"none"
})
return
}
if(!that.data.name){
wx.showToast({
title: '请填写收货人',
icon:"none"
})
return
}
if(!that.data.phone){
wx.showToast({
title: '请填写收货人联系方式',
icon:"none"
})
return
}
if(!util.isPhone(that.data.phone)){
wx.showToast({
title: '请填写正确联系方式',
icon:"none"
})
return
}
if(!that.data.region){
wx.showToast({
title: '请选择所在地区',
icon:"none"
})
return
}
if(!that.data.address){
wx.showToast({
title: '请填写详细地址',
icon:"none"
})
return
}
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.createPartnerOrder,{
address:that.data.address,
dealer_id:wx.getStorageSync('dealer_id'),
mobile:that.data.phone,
name:that.data.name,
region:that.data.region,
products,
// total_price:Number(that.data.price)
total_price:Number(1)
},res=>{
that.setData({
orderMsg:res
})
that.getGoodsMsg()
})
},
getGoodsMsg(){
let that = this
util.postUrl(apiArr.getCurrentShopMsg,{
dealer_id:Number(that.data.orderMsg.dealer_id)
},res=>{
that.setData({
GoodsMsg:res
})
that.pay()
})
},
pay(){
let that = this
util.postUrl2(PayJs.pay,{
address:that.data.area + that.data.address,
goods_id:String(that.data.orderMsg.order_id),
merchant_no:that.data.GoodsMsg.merchant_no,
out_trade_no:that.data.orderMsg.order_no,
quantity:1,
remark:that.data.message,
subject:that.data.orderMsg.order_name,
term_no:that.data.GoodsMsg.term_no,
total_amount:String(that.data.price * 100),
// total_amount:String(1),
user:String(wx.getStorageSync('userId')),
user_id:wx.getStorageSync('openId')
},res=>{
const {resp_data,msg} = res.data.data
wx.hideLoading()
if(msg == '成功'){
wx.requestPayment({
timeStamp:String(resp_data.acc_resp_fields.time_stamp),
nonceStr:String(resp_data.acc_resp_fields.nonce_str),
package:String(resp_data.acc_resp_fields.package),
signType:String(resp_data.acc_resp_fields.sign_type),
paySign:String(resp_data.acc_resp_fields.pay_sign),
success(res){
that.queryPay()
},
fail(fal){
console.log(fal);
}
})
}
})
},
queryPay(){
let that = this
util.postUrl2(PayJs.queryPay,{
merchant_no:that.data.GoodsMsg.merchant_no,
term_no:that.data.GoodsMsg.term_no,
out_trade_no:that.data.orderMsg.order_no
},res=>{
console.log(res,23);
if(res.statusCode == '200'){
wx.showToast({
title: '支付成功!',
})
setTimeout(()=>{
that.getBuyProList()
},1500)
}else{
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getBuyProList()
that.getProductList()
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' // 自定义分享图片路径
}
},
import { areaList } from '../../data/index';
const app = getApp()
let util = require('../../../../utils/util')
const apiArr = require('../../../../api/water_filter')
let PayJs = require('../../../../api/pay')
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
checked:false,
areaList,
show:false, //弹出层
name:"",
phone:"",
area:"",
region:"",
address:"",
message:"",
tabIndex:1,
flag:false,
page_size:10,
page_num:1,
option2: [
{ text: '默认排序', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
],
value2: 'a',
buyProductList:[],
price:0,
deviceList:[],
orderMsg:"",
GoodsMsg:"",
delId:"",
},
iptMt(e){
let that =this
that.setData({
delId:e.detail.value,
page_num:1,
flag:false,
buyProductList:[]
})
that.getBuyProList()
},
//进货记录
getBuyProList(){
let that =this
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.buyProductList,{
dealer_id:wx.getStorageSync('dealer_id'),
order_no:that.data.delId,
page_num:that.data.page_num,
page_size:that.data.page_size
},res=>{
console.log(res);
wx.hideLoading()
if( res.rows){
let flag = false
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
that.setData({
flag,
page_num:that.data.page_num +1,
buyProductList:that.data.buyProductList.concat(res.rows || [])
})
}
})
},
changeTab(e){
console.log('e111', e);
let that = this
that.setData({
tabIndex:e.currentTarget.dataset.index,
flag:false,
page_num:1,
buyProductList:[]
})
if (e.currentTarget.dataset.index === '1') {
console.log(123);
that.getBuyProList()
}
},
ipt1(e){
let that = this
that.setData({
name:e.detail.value
})
},
ipt2(e){
let that = this
that.setData({
phone:e.detail.value
})
},
ipt3(e){
let that = this
that.setData({
address:e.detail.value
})
},
ipt4(e){
let that = this
that.setData({
message:e.detail.value
})
},
account(){
wx.navigateTo({
url: '../payList/payList',
})
},
onClose(e){
let that = this
that.setData({
show:false
})
},
changeShow(){
let that = this
that.setData({
show:true
})
},
//选择地区
AreaConfirm(e){
let that = this
let region = ''
let area = ''
if(e.detail.values[0].name == e.detail.values[1].name){
area = e.detail.values[1].name + e.detail.values[2].name
region = e.detail.values[1].name +"/" + e.detail.values[2].name
}else{
area = e.detail.values[0].name + e.detail.values[1].name + e.detail.values[2].name
region = e.detail.values[0].name +"/" + e.detail.values[1].name +"/" + e.detail.values[2].name
}
that.setData({
show:false,
area,
region
})
},
//取消
cancel(e){
let that = this
that.setData({
show:false
})
},
onChange(e){
let that = this
let item = e.currentTarget.dataset.item
let deviceList = that.data.deviceList
deviceList.forEach(items=>{
if(item.product_id == items.product_id){
items.num = e.detail
}
})
that.setData({
deviceList
})
let price = Number(0)
that.data.deviceList.forEach(item=>{
if(item.num != 0){
// price += util.floatCalculate(item.num,item.suggested_price,'*')
let currentMony = util.floatCalculate(item.num,item.suggested_price,'*')
price = util.floatCalculate(price,currentMony,'+=')
}
})
that.setData({
price
})
},
//设备列表
getProductList(){
let that =this
util.postUrl(apiArr.getProduct,{
dealer_id:wx.getStorageSync('dealer_id'),
page_num:that.data.page_num,
page_size:that.data.page_size,
status:1,
},res=>{
if(res.rows){
let flag =false
if(res.rows.length == that.data.page_size){
flag = true
}else{
flag = false
}
res.rows.forEach(item=>{
item.num = 0
item.product_icon = util.img_url + item.product_icon
})
that.setData({
deviceList:that.data.deviceList.concat(res.rows || []),
flag,
page_num:that.data.page_num + 1
})
}
})
},
//创建进货订单
createOrder(){
let that =this
let products = []
that.data.deviceList.forEach(item=>{
if(item.num > 0){
products.push({
number:item.num,
product_id:item.product_id
})
}
})
if(products.length == 0){
wx.showToast({
title: '请选择进货设备',
icon:"none"
})
return
}
if(!that.data.name){
wx.showToast({
title: '请填写收货人',
icon:"none"
})
return
}
if(!that.data.phone){
wx.showToast({
title: '请填写收货人联系方式',
icon:"none"
})
return
}
if(!util.isPhone(that.data.phone)){
wx.showToast({
title: '请填写正确联系方式',
icon:"none"
})
return
}
if(!that.data.region){
wx.showToast({
title: '请选择所在地区',
icon:"none"
})
return
}
if(!that.data.address){
wx.showToast({
title: '请填写详细地址',
icon:"none"
})
return
}
wx.showLoading({
title: '加载中...',
mask:true
})
util.postUrl(apiArr.createPartnerOrder,{
address:that.data.address,
dealer_id:wx.getStorageSync('dealer_id'),
mobile:that.data.phone,
name:that.data.name,
region:that.data.region,
products,
total_price:Number(that.data.price)
},res=>{
that.setData({
orderMsg:res
})
that.getGoodsMsg()
})
},
getGoodsMsg(){
let that = this
util.postUrl(apiArr.getCurrentShopMsg,{
dealer_id:Number(that.data.orderMsg.dealer_id)
},res=>{
that.setData({
GoodsMsg:res
})
that.pay()
})
},
pay(){
let that = this
util.postUrl2(PayJs.pay,{
address:that.data.area + that.data.address,
goods_id:String(that.data.orderMsg.order_id),
merchant_no:that.data.GoodsMsg.merchant_no,
out_trade_no:that.data.orderMsg.order_no,
quantity:1,
remark:that.data.message,
subject:that.data.orderMsg.order_name,
term_no:that.data.GoodsMsg.term_no,
total_amount:String(that.data.price * 100),
// total_amount:String(1),
user:String(wx.getStorageSync('userId')),
user_id:wx.getStorageSync('openId')
},res=>{
const {resp_data,msg} = res.data.data
wx.hideLoading()
if(msg == '成功'){
wx.requestPayment({
timeStamp:String(resp_data.acc_resp_fields.time_stamp),
nonceStr:String(resp_data.acc_resp_fields.nonce_str),
package:String(resp_data.acc_resp_fields.package),
signType:String(resp_data.acc_resp_fields.sign_type),
paySign:String(resp_data.acc_resp_fields.pay_sign),
success(res){
that.queryPay()
},
fail(fal){
console.log(fal);
}
})
}
})
},
queryPay(){
let that = this
util.postUrl2(PayJs.queryPay,{
merchant_no:that.data.GoodsMsg.merchant_no,
term_no:that.data.GoodsMsg.term_no,
out_trade_no:that.data.orderMsg.order_no
},res=>{
console.log(res,23);
if(res.statusCode == '200'){
wx.showToast({
title: '支付成功!',
})
setTimeout(()=>{
that.getBuyProList()
},1500)
}else{
wx.showToast({
title: res.msg,
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getBuyProList()
that.getProductList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,161 +1,161 @@
<view class="box">
<view class="tabList">
<view class="tab {{tabIndex == 0?'active':''}}" data-index="0" bind:tap="changeTab">设备进货</view>
<view class="tab {{tabIndex == 1?'active':''}}" data-index="1" bind:tap="changeTab">进货记录</view>
</view>
<view wx:if="{{tabIndex == 0}}" style="padding-bottom:180rpx">
<view class="filterList">
<view class="filterItem" wx:for="{{deviceList}}" wx:key="index">
<view class="filterItem_Msg">
<view class="filterItem_Img">
<image src="{{item.product_icon}}" mode="widthFix" />
</view>
<view class="filterItem_Con">
<view class="filterItem_Con_tit">{{item.product_name}}</view>
<view class="filterItem_Con_tagList">
进货价
<view class="icon">¥</view>
<view class="money">{{item.suggested_price}}</view>
</view>
</view>
</view>
<van-stepper value="{{ item.num }}" long-press="{{ false }}" disable-input min="0" data-item="{{item}}" bind:change="onChange" />
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="formItem">
<view class="formItem_ask">收货人</view>
<view class="formItem_con">
<input type="text" value="{{name}}" placeholder="请输入收货人姓名" bindinput="ipt1" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">联系方式</view>
<view class="formItem_con">
<input type="number" maxlength="11" value="{{phone}}" placeholder="请输入收货人联系方式" bindinput="ipt2" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">所属地区</view>
<view class="formItem_con">
<input type="text" value="{{area}}" placeholder="请选择所在地区" disabled bindtap="changeShow" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">收货地址</view>
<view class="formItem_con">
<input type="text" value="{{address}}" placeholder="请输入详细地址" bindinput="ipt3" />
</view>
</view>
<view class="formItem2">
<view class="foremItem2_tit">留言</view>
<view class="foremItem2_con">
<textarea value="{{message}}" placeholder="请输入留言" bindinput="ipt4" />
</view>
</view>
</view>
<view class="foot">
<view class="foot_mony"> <text>¥</text>{{price}}</view>
<view class="foot_btn" bind:tap="createOrder">去结算</view>
</view>
</view>
<view wx:if="{{tabIndex == 1}}" style="background-color: #f9f9f9;">
<view class="iptBox">
<view class="ipt">
<input type="text" value="{{delId}}" bindinput="iptMt" placeholder="输订单编号" placeholder-style="color: #999999;font-size: 24rpx;" />
<view class="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
<!-- <view class="select">
<van-dropdown-menu>
<van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" />
</van-dropdown-menu>
</view> -->
</view>
<view class="payList">
<view class="deviceItem" wx:for="{{buyProductList}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">订单编号:{{item.order_no}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">报联系人</view>
<view class="deviceItemCon_con">{{item.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">收货地址</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货类型</view>
<view class="deviceItemCon_con">云库</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">货贷总价</view>
<view class="deviceItemCon_con">{{item.total_price}}</view>
</view>
<!-- <view class="deviceItemCon">
<view class="deviceItemCon_tit">快递公司</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">快递单号</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view> -->
<view class="deviceItemCon">
<view class="deviceItemCon_tit">创建者</view>
<view class="deviceItemCon_con">{{item.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">创建时间</view>
<view class="deviceItemCon_con">{{item.create_time}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货状态</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="product">
购买产品
</view>
<view wx:for="{{item.products}}" wx:for-item="items">
<view class="deviceItemCon">
<view class="deviceItemCon_tit">产品名称</view>
<view class="deviceItemCon_con">{{items.product_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货数量</view>
<view class="deviceItemCon_con">{{items.number}}</view>
</view>
</view>
<!-- <view class="deviceItemCon">
<view class="deviceItemCon_tit">取消说明</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view> -->
</view>
</view>
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom" bind:>
<view style="width: 100%;">
<van-area area-list="{{ areaList }}" bind:confirm="AreaConfirm" bind:cancel="cancel" value="110101" />
</view>
</van-popup>
<view class="box">
<view class="tabList">
<view class="tab {{tabIndex == 0?'active':''}}" data-index="0" bind:tap="changeTab">设备进货</view>
<view class="tab {{tabIndex == 1?'active':''}}" data-index="1" bind:tap="changeTab">进货记录</view>
</view>
<view wx:if="{{tabIndex == 0}}" style="padding-bottom:180rpx">
<view class="filterList">
<view class="filterItem" wx:for="{{deviceList}}" wx:key="index">
<view class="filterItem_Msg">
<view class="filterItem_Img">
<image src="{{item.product_icon}}" mode="widthFix" />
</view>
<view class="filterItem_Con">
<view class="filterItem_Con_tit">{{item.product_name}}</view>
<view class="filterItem_Con_tagList">
进货价
<view class="icon">¥</view>
<view class="money">{{item.suggested_price}}</view>
</view>
</view>
</view>
<van-stepper value="{{ item.num }}" long-press="{{ false }}" disable-input min="0" data-item="{{item}}" bind:change="onChange" />
</view>
</view>
<view class="gray"></view>
<view class="form">
<view class="formItem">
<view class="formItem_ask">收货人</view>
<view class="formItem_con">
<input type="text" value="{{name}}" placeholder="请输入收货人姓名" bindinput="ipt1" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">联系方式</view>
<view class="formItem_con">
<input type="number" maxlength="11" value="{{phone}}" placeholder="请输入收货人联系方式" bindinput="ipt2" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">所属地区</view>
<view class="formItem_con">
<input type="text" value="{{area}}" placeholder="请选择所在地区" disabled bindtap="changeShow" />
</view>
</view>
<view class="formItem">
<view class="formItem_ask">收货地址</view>
<view class="formItem_con">
<input type="text" value="{{address}}" placeholder="请输入详细地址" bindinput="ipt3" />
</view>
</view>
<view class="formItem2">
<view class="foremItem2_tit">留言</view>
<view class="foremItem2_con">
<textarea value="{{message}}" placeholder="请输入留言" bindinput="ipt4" />
</view>
</view>
</view>
<view class="foot">
<view class="foot_mony"> <text>¥</text>{{price}}</view>
<view class="foot_btn" bind:tap="createOrder">去结算</view>
</view>
</view>
<view wx:if="{{tabIndex == 1}}" style="background-color: #f9f9f9;">
<view class="iptBox">
<view class="ipt">
<input type="text" value="{{delId}}" bindinput="iptMt" placeholder="输订单编号" placeholder-style="color: #999999;font-size: 24rpx;" />
<view class="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
<!-- <view class="select">
<van-dropdown-menu>
<van-dropdown-item value="{{ value2 }}" options="{{ option2 }}" />
</van-dropdown-menu>
</view> -->
</view>
<view class="payList">
<view class="deviceItem" wx:for="{{buyProductList}}" bind:tap="deviceDesc" data-device_id="{{item.device_id}}">
<view class="deviceItem_Tit">订单编号:{{item.order_no}}</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">报联系人</view>
<view class="deviceItemCon_con">{{item.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">收货地址</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货类型</view>
<view class="deviceItemCon_con">云库</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">货贷总价</view>
<view class="deviceItemCon_con">{{item.total_price}}</view>
</view>
<!-- <view class="deviceItemCon">
<view class="deviceItemCon_tit">快递公司</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">快递单号</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view> -->
<view class="deviceItemCon">
<view class="deviceItemCon_tit">创建者</view>
<view class="deviceItemCon_con">{{item.name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">创建时间</view>
<view class="deviceItemCon_con">{{item.create_time}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货状态</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view>
<view class="product">
购买产品
</view>
<view wx:for="{{item.products}}" wx:for-item="items">
<view class="deviceItemCon">
<view class="deviceItemCon_tit">产品名称</view>
<view class="deviceItemCon_con">{{items.product_name}}</view>
</view>
<view class="deviceItemCon">
<view class="deviceItemCon_tit">进货数量</view>
<view class="deviceItemCon_con">{{items.number}}</view>
</view>
</view>
<!-- <view class="deviceItemCon">
<view class="deviceItemCon_tit">取消说明</view>
<view class="deviceItemCon_con">{{item.region + item.address}}</view>
</view> -->
</view>
</view>
</view>
</view>
<van-popup show="{{ show }}" safe-area-inset-bottom lock-scroll bind:close="onClose" round close-on-click-overlay position="bottom" bind:>
<view style="width: 100%;">
<van-area area-list="{{ areaList }}" bind:confirm="AreaConfirm" bind:cancel="cancel" value="110101" />
</view>
</van-popup>
<!-- <Footer></Footer> -->

View File

@ -1,101 +1,102 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/ranking/ranking.js
Page({
/**
* 页面的初始数据
*/
data: {
rankingList: []
},
getRankingList() {
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl(apiArr.rankingList, {
dealer_id: wx.getStorageSync('dealer_id')
}, res => {
wx.hideLoading()
console.log(res);
that.setData({
rankingList: res.rows
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getRankingList()
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/ranking/ranking.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
rankingList: []
},
getRankingList() {
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl(apiArr.rankingList, {
dealer_id: wx.getStorageSync('dealer_id')
}, res => {
wx.hideLoading()
console.log(res);
that.setData({
rankingList: res.rows
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getRankingList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,26 +1,26 @@
<view class="invite">
<Nav Text="销售排行" backColor="#ffffff" color="#ffffff" NavPosition="relative"></Nav>
<view class="text">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/ranking_text.png" mode="widthFix"/>
</view>
<view class="after">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/ranking_img.png" mode="widthFix"/>
</view>
<view class="phb">
<view class="phbTit">
<view class="pbhTit_15">排行</view>
<view class="pbhTit_30">用户名</view>
<view class="pbhTit_15">销量</view>
<view class="pbhTit_40">充值金额</view>
</view>
<view class="phb_item" wx:for="{{rankingList}}">
<view class="pbhTit_15">{{index + 1}}</view>
<view class="pbhTit_30">{{item.dealer_name}}</view>
<view class="pbhTit_15">{{item.num}}</view>
<view class="pbhTit_40">{{item.total}}</view>
</view>
</view>
</view>
<view class="invite">
<Nav Text="销售排行" backColor="#ffffff" color="#ffffff" NavPosition="relative"></Nav>
<view class="text">
<image src="https://static.hshuishang.com/water_filter/partner/ranking_text.png" mode="widthFix"/>
</view>
<view class="after">
<image src="https://static.hshuishang.com/water_filter/partner/ranking_img.png" mode="widthFix"/>
</view>
<view class="phb">
<view class="phbTit">
<view class="pbhTit_15">排行</view>
<view class="pbhTit_30">用户名</view>
<view class="pbhTit_15">销量</view>
<view class="pbhTit_40">充值金额</view>
</view>
<view class="phb_item" wx:for="{{rankingList}}">
<view class="pbhTit_15">{{index + 1}}</view>
<view class="pbhTit_30">{{item.dealer_name}}</view>
<view class="pbhTit_15">{{item.num}}</view>
<view class="pbhTit_40">{{item.total}}</view>
</view>
</view>
</view>

View File

@ -1,269 +1,270 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
let apiArr2 = require('../../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
value1: 0,
value2: 'a',
show: false,
MasterList: [],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
dispatch(e) {
let that = this
that.setData({
show: true,
sendOrders: e.currentTarget.dataset.item
})
},
//师傅列表
getMasterList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl4(apiArr2.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
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
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.UninstallAllocation, {
repairman_id: checkedMaster.info_id,
uninstall_id: sendOrders.uninstall_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)
}
})
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=3`,
})
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.getUninstallList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
dealer_id: that.data.admin.shop_id
}, res => {
wx.hideLoading()
if (res.row) {
let flag = false
if (res.row.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.row || []),
page_num: that.data.page_num + 1
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
that.getNewOrderList()
that.getMasterList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
page_num: 1,
deviceList: [],
searchText: "",
flag: false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/partner')
let apiArr2 = require('../../../../api/water_filter')
const app = getApp({ allowDefault: true })
// packages/WaterPurifier/pages/upKeep/upKeep.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
s: app.system.statusBarHeight, // 状态栏高度
n: (app.menu.top - app.system.statusBarHeight) * 2 + app.menu.height, // 导航栏高度
t: app.menu.top, // 胶囊局顶部距离
h: app.menu.height, // 胶囊高度
admin: "",
value1: 0,
value2: 'a',
show: false,
MasterList: [],
searchText: "",//搜索文字
page_num: 1,
page_size: 10,
total: '',
deviceList: [],
sendOrders: {}, // 派单订单
flag: false
},
back(){
wx.reLaunch({
url: '/packages/partner/pages/partner',
})
},
dispatch(e) {
let that = this
that.setData({
show: true,
sendOrders: e.currentTarget.dataset.item
})
},
//师傅列表
getMasterList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true
})
util.postUrl4(apiArr2.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
})
},
onClose() {
let that = this
that.setData({
show: false
})
},
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.UninstallAllocation, {
repairman_id: checkedMaster.info_id,
uninstall_id: sendOrders.uninstall_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)
}
})
})
},
desc(e) {
let that = this
wx.navigateTo({
url: `/packages/partner/pages/OrderMsgInfo/OrderMsgInfo?id=${e.currentTarget.dataset.id}&type=3`,
})
},
ipt1(e) {
let that = this
that.setData({
searchText: e.detail.value,
})
},
search() {
let that = this
that.setData({
page_num: 1,
flag: false,
deviceList: []
})
that.getNewOrderList()
},
//工单列表
getNewOrderList() {
let that = this
wx.showLoading({
title: '加载中...',
mask: true,
})
//设置加载状态
util.postUrl4(apiArr.getUninstallList, {
page_size: that.data.page_size,
page_num: that.data.page_num,
search: that.data.searchText,
dealer_id: that.data.admin.shop_id
}, res => {
wx.hideLoading()
if (res.row) {
let flag = false
if (res.row.length == that.data.page_size) {
flag = true
} else {
flag = false
}
that.setData({
flag,
deviceList: that.data.deviceList.concat(res.row || []),
page_num: that.data.page_num + 1
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.setData({
admin: wx.getStorageSync('admin')
})
that.getNewOrderList()
that.getMasterList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
let that = this
that.setData({
page_num: 1,
deviceList: [],
searchText: "",
flag: false
})
that.getNewOrderList()
wx.stopPullDownRefresh();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
let that = this
if (that.data.flag) {
that.getNewOrderList()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,119 +1,119 @@
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
拆除工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.uninstall_id}}">
<view class="orderItem_tit">工单名称:{{item.uninstall_name}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">订单编号:</view>
<view class="orderItem_Item_con">{{item.uninstall_no}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编号:</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">产品状态:</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 1}}">待指派</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 2}}">待拆机</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 3}}">待操作</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 4}}">已完成</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称:</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机:</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址:</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">预约时间:</view>
<view class="orderItem_Item_con">{{item.appointment_time}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅名称:</view>
<view class="orderItem_Item_con">{{item.repairman_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅手机号:</view>
<view class="orderItem_Item_con">{{item.repairman_phone}}</view>
</view>
<view class="contral" >
<!-- <view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status == 4}}">撤回</view> -->
<!-- -->
<view class="state" wx:if="{{item.status == 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" custom-style="height: 60%;" close-on-click-overlay round position="bottom" z-index="9999">
<view class="pop_Tit">
请选择拆除师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="widthFix" />
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}"></view>
</view>
</view>
</view>
</van-popup>
</view>
<view class="upkeep">
<view class="nav-box" style="padding-top: {{ t }}px;">
<view class="nav-bar" style="height: {{ h }}px;">
<view class="nav-bar-left" bind:tap="back">
<van-icon name="arrow-left" size="24px" />
</view>
<view class="nav-bar-title" style="height: {{ h }}px;line-height: {{ h }}px;color: {{color}};font-size: 28rpx;">
拆除工单
</view>
<view class="nav-bar-right">
<van-icon name="arrow-left" size="24px" />
</view>
</view>
</view>
<view class="upkeep_select">
<view class="ipt">
<input value="{{searchText}}" confirm-type="search" bindconfirm="search" confirm-type="search" bindconfirm="search" bindinput="ipt1" type="text" placeholder="设备编号/客户名称/客户手机/客户地址" placeholder-style="color: #999999;font-size: 28rpx;" />
<view class="searchBox" bind:tap="search">
<image src="https://static.hshuishang.com/water_filter/dervice/deriveSearch.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="orderList">
<view class="orderItem" wx:for="{{deviceList}}" wx:key="index" bind:tap="desc" data-id="{{item.uninstall_id}}">
<view class="orderItem_tit">工单名称:{{item.uninstall_name}}</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">订单编号:</view>
<view class="orderItem_Item_con">{{item.uninstall_no}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">设备编号:</view>
<view class="orderItem_Item_con">{{item.device_code}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">产品状态:</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 1}}">待指派</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 2}}">待拆机</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 3}}">待操作</view>
<view class="orderItem_Item_con" wx:if="{{item.status == 4}}">已完成</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户名称:</view>
<view class="orderItem_Item_con">{{item.customer_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">客户手机:</view>
<view class="orderItem_Item_con">{{item.customer_phone}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">详细地址:</view>
<view class="orderItem_Item_con">{{item.region + item.address || '暂无数据'}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">预约时间:</view>
<view class="orderItem_Item_con">{{item.appointment_time}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅名称:</view>
<view class="orderItem_Item_con">{{item.repairman_name}}</view>
</view>
<view class="orderItem_Item">
<view class="orderItem_Item_tit">师傅手机号:</view>
<view class="orderItem_Item_con">{{item.repairman_phone}}</view>
</view>
<view class="contral" >
<!-- <view class="state state2" catchtap="headerRecallClick" data-item="{{item}}" wx:if="{{item.status == 4}}">撤回</view> -->
<!-- -->
<view class="state" wx:if="{{item.status == 1}}" data-item="{{item}}" catch:tap="dispatch">派单</view>
</view>
</view>
</view>
<van-empty description="暂无内容" wx:if="{{deviceList.length == 0}}" />
<view class="selectMaster">
<van-popup show="{{ show }}" bind:close="onClose" custom-style="height: 60%;" close-on-click-overlay round position="bottom" z-index="9999">
<view class="pop_Tit">
请选择拆除师傅
<view class="sure" bind:tap="sure">确定</view>
</view>
<view class="master">
<view class="popItemMaster" wx:for="{{MasterList}}" wx:key="index" bind:tap="selectMaster" data-index="{{index}}">
<view class="popItem_left">
<view class="MasterAva">
<image src="{{item.avatar}}" mode="widthFix" />
</view>
<view class="MasterMsg">
<view class="MasterMsg1">
<view>师傅姓名</view>
{{item.name}}
</view>
<view class="MasterMsg1">
<view>师傅手机号</view>
{{item.phone}}
</view>
</view>
</view>
<view class="popItem_right">
<view class="cir1" wx:if="{{item.checked}}"></view>
<view class="cir2" wx:if="{{!item.checked}}"></view>
</view>
</view>
</view>
</van-popup>
</view>
</view>

View File

@ -1,113 +1,114 @@
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/team/team.js
Page({
/**
* 页面的初始数据
*/
data: {
Invite:""
},
getInviteList(){
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl(apiArr.MyinviteList,{
dealer_id:wx.getStorageSync('dealer_id')
},res=>{
wx.hideLoading()
console.log(res);
that.setData({
Invite:res
})
})
},
Jump(){
wx.navigateTo({
url: '../ranking/ranking',
})
},
Jump2(){
wx.navigateTo({
url: '../invite/invite',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getInviteList()
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' // 自定义分享图片路径
}
},
let util = require('../../../../utils/util')
let apiArr = require('../../../../api/water_filter')
// packages/partner/pages/team/team.js
const __staticUrl = require('../../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
Invite:""
},
getInviteList(){
let that = this
wx.showLoading({
title: '加载中...',
})
util.postUrl(apiArr.MyinviteList,{
dealer_id:wx.getStorageSync('dealer_id')
},res=>{
wx.hideLoading()
console.log(res);
that.setData({
Invite:res
})
})
},
Jump(){
wx.navigateTo({
url: '../ranking/ranking',
})
},
Jump2(){
wx.navigateTo({
url: '../invite/invite',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this
that.getInviteList()
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage(){
return {
title: '人人爱净水', // 分享卡片标题(必填)
path: '/pages/water_filter/water_filter', // 用户点击后跳转的路径(可选,默认当前页)
imageUrl: (__staticUrl + '/share.png') // 自定义图片(可选,比例建议 5:4
}
},
onShareTimeline() {
return {
title: '人人爱净水', // 自定义标题
query: '', // 自定义页面路径中的参数
imageUrl: (__staticUrl + '/share.png') // 自定义分享图片路径
}
},
})

View File

@ -1,47 +1,47 @@
<view class="team">
<Nav Text="我的团队" backColor="#333333" NavPosition="relative"></Nav>
<view class="team_tit" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_img.png?1);">
<view class="team_tit_item">
<view class="team_tit_item_num">{{Invite.city_operator_count}}</view>
<view class="team_tit_item_text">一级代理(位)</view>
</view>
<view class="team_tit_item">
<view class="team_tit_item_num">{{Invite.city_partner_count}}</view>
<view class="team_tit_item_text">二级代理(位)</view>
</view>
</view>
<view class="teamMsg_List">
<view class="teamMsg_item">
<view class="teamMsg_item_left">
<view class="teamMsg_item_left_text1">我邀请的</view>
<view class="teamMsg_item_left_text2">{{Invite.quilt_invite_total}}</view>
</view>
<view class="teamMsg_item_right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_icon1.png?1" mode="widthFix" />
</view>
</view>
<view class="teamMsg_item">
<view class="teamMsg_item_left">
<view class="teamMsg_item_left_text1">邀请我的</view>
<view class="teamMsg_item_left_text2">{{Invite.invite_name}}</view>
</view>
<view class="teamMsg_item_right">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_icon2.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="team_form" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_img2.png?1);" bind:tap="Jump">
销售排行榜
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_icon3.png?1" mode="widthFix"/>
</view>
<!-- <view class="team_form mr10" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_img3.png);" bind:tap="Jump2">
邀请排行榜
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/water_filter/partner/team_icon3.png" mode="widthFix"/>
</view> -->
</view>
<view class="team">
<Nav Text="我的团队" backColor="#333333" NavPosition="relative"></Nav>
<view class="team_tit" style="background-image: url('https://static.hshuishang.com/water_filter/partner/team_img.png?1');">
<view class="team_tit_item">
<view class="team_tit_item_num">{{Invite.city_operator_count}}</view>
<view class="team_tit_item_text">一级代理(位)</view>
</view>
<view class="team_tit_item">
<view class="team_tit_item_num">{{Invite.city_partner_count}}</view>
<view class="team_tit_item_text">二级代理(位)</view>
</view>
</view>
<view class="teamMsg_List">
<view class="teamMsg_item">
<view class="teamMsg_item_left">
<view class="teamMsg_item_left_text1">我邀请的</view>
<view class="teamMsg_item_left_text2">{{Invite.quilt_invite_total}}</view>
</view>
<view class="teamMsg_item_right">
<image src="https://static.hshuishang.com/water_filter/partner/team_icon1.png?1" mode="widthFix" />
</view>
</view>
<view class="teamMsg_item">
<view class="teamMsg_item_left">
<view class="teamMsg_item_left_text1">邀请我的</view>
<view class="teamMsg_item_left_text2">{{Invite.invite_name}}</view>
</view>
<view class="teamMsg_item_right">
<image src="https://static.hshuishang.com/water_filter/partner/team_icon2.png?1" mode="widthFix" />
</view>
</view>
</view>
<view class="team_form" style="background-image: url('https://static.hshuishang.com/water_filter/partner/team_img2.png?1');" bind:tap="Jump">
销售排行榜
<image src="https://static.hshuishang.com/water_filter/partner/team_icon3.png?1" mode="widthFix"/>
</view>
<!-- <view class="team_form mr10" style="background-image: url('https://static.hshuishang.com/water_filter/partner/team_img3.png');" bind:tap="Jump2">
邀请排行榜
<image src="https://static.hshuishang.com/water_filter/partner/team_icon3.png" mode="widthFix"/>
</view> -->
</view>

View File

@ -1,60 +1,60 @@
<view>
<!-- <view class="search-bar"> -->
<!-- <view class="search-bar__city"> -->
<!-- <image style="width: 33rpx; height: 33rpx;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/location.png"></image> -->
<!-- <text style="margin: 0 10rpx;">{{ '衡水市' }}</text> -->
<!-- <image -->
<!-- style="width: 12rpx; height: 22rpx; transform: rotate(90deg);" -->
<!-- src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/more.primary.12x22.png" -->
<!-- > -->
<!-- </image> -->
<!-- </view> -->
<!-- <view class="search-bar__input"> -->
<!-- <image style="width: 33rpx; height: 33rpx;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/search.png"></image> -->
<!-- <input class="search-bar__input-inner" placeholder="输入要搜索的社区名称"></input> -->
<!-- </view> -->
<!-- </view> -->
<view class="community-list">
<view
wx:for="{{list}}"
wx:for-item="item"
wx:key="item.id"
class="community-list-item"
>
<view class="community-list-item__cover">
<image class="community-list-item__image" mode="aspectFill" src="{{item.cover}}"></image>
</view>
<view class="community-list-item__content">
<view class="community-list-item__title">
<text>{{ item.title }}</text>
<text>{{ item.distance }}</text>
</view>
<view class="community-list-item__property">
<text>物业公司:</text>
<text>{{ item.property_company }}</text>
</view>
<view class="community-list-item__address">
<!-- <image src=""></image> -->
<text>{{ item.address }}</text>
</view>
<view class="community-list-item__actions">
<view class="community-list-item__action community-list-item__nav">
<image style="width: 24rpx; height: 24rpx;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/send.png"></image>
<text style="margin-left: 9rpx;">导航</text>
</view>
<view class="community-list-item__action community-list-item__call">
<image style="width: 24rpx; height: 24rpx;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/phone.png"></image>
<text style="margin-left: 9rpx;">电话</text>
</view>
<view style="flex: 1;"></view>
<navigator class="community-list-item__detail" url="{{'/pages/community/detail?id=' + item.id}}">
进入小区
</navigator>
</view>
</view>
</view>
<view wx:if="{{!loading && !list.length}}" style="padding: 100rpx 30rpx; text-align: center;">
暂无数据
</view>
</view>
</view>
<view>
<!-- <view class="search-bar"> -->
<!-- <view class="search-bar__city"> -->
<!-- <image style="width: 33rpx; height: 33rpx;" src="https://static.hshuishang.com/User/_assets/location.png"></image> -->
<!-- <text style="margin: 0 10rpx;">{{ '衡水市' }}</text> -->
<!-- <image -->
<!-- style="width: 12rpx; height: 22rpx; transform: rotate(90deg);" -->
<!-- src="https://static.hshuishang.com/User/_assets/more.primary.12x22.png" -->
<!-- > -->
<!-- </image> -->
<!-- </view> -->
<!-- <view class="search-bar__input"> -->
<!-- <image style="width: 33rpx; height: 33rpx;" src="https://static.hshuishang.com/User/_assets/search.png"></image> -->
<!-- <input class="search-bar__input-inner" placeholder="输入要搜索的社区名称"></input> -->
<!-- </view> -->
<!-- </view> -->
<view class="community-list">
<view
wx:for="{{list}}"
wx:for-item="item"
wx:key="item.id"
class="community-list-item"
>
<view class="community-list-item__cover">
<image class="community-list-item__image" mode="aspectFill" src="{{item.cover}}"></image>
</view>
<view class="community-list-item__content">
<view class="community-list-item__title">
<text>{{ item.title }}</text>
<text>{{ item.distance }}</text>
</view>
<view class="community-list-item__property">
<text>物业公司:</text>
<text>{{ item.property_company }}</text>
</view>
<view class="community-list-item__address">
<!-- <image src=""></image> -->
<text>{{ item.address }}</text>
</view>
<view class="community-list-item__actions">
<view class="community-list-item__action community-list-item__nav">
<image style="width: 24rpx; height: 24rpx;" src="https://static.hshuishang.com/User/_assets/send.png"></image>
<text style="margin-left: 9rpx;">导航</text>
</view>
<view class="community-list-item__action community-list-item__call">
<image style="width: 24rpx; height: 24rpx;" src="https://static.hshuishang.com/User/_assets/phone.png"></image>
<text style="margin-left: 9rpx;">电话</text>
</view>
<view style="flex: 1;"></view>
<navigator class="community-list-item__detail" url="{{'/pages/community/detail?id=' + item.id}}">
进入小区
</navigator>
</view>
</view>
</view>
<view wx:if="{{!loading && !list.length}}" style="padding: 100rpx 30rpx; text-align: center;">
暂无数据
</view>
</view>
</view>

View File

@ -1,4 +1,5 @@
// packages/user/coupon/component/couponCard/index.js
const env = require('../../../../config/env.js')
Component({
/**
@ -15,7 +16,7 @@ Component({
* 组件的初始数据
*/
data: {
staticUrl: env.static_url,
},
/**

View File

@ -1,20 +1,20 @@
<view class="container">
<view class="main">
<view class="left">
<view class="left_price">
<text class="symbol">¥</text>
<text class="price">{{item.price}}</text>
</view>
<view class="left_desc">满{{item.priceDesc}}可用</view>
</view>
<view class="center">
<view class="title">新人{{item.price}}元大红包</view>
<view class="deadline">{{item.bg_date}} - {{item.end_date}}</view>
<view class="type_mode">全品类通用</view>
</view>
<view wx:if="{{item.state === 'usable'}}" class="right_btn" bindtap="headerUseClick">去使用</view>
<image wx:if="{{item.state === 'used'}}" class="icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_783.png" mode=""/>
<image wx:if="{{item.state === 'no'}}" class="icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_787.png" mode=""/>
</view>
<view class="container">
<view class="main">
<view class="left">
<view class="left_price">
<text class="symbol">¥</text>
<text class="price">{{item.price}}</text>
</view>
<view class="left_desc">满{{item.priceDesc}}可用</view>
</view>
<view class="center">
<view class="title">新人{{item.price}}元大红包</view>
<view class="deadline">{{item.bg_date}} - {{item.end_date}}</view>
<view class="type_mode">全品类通用</view>
</view>
<view wx:if="{{item.state === 'usable'}}" class="right_btn" bindtap="headerUseClick">去使用</view>
<image wx:if="{{item.state === 'used'}}" class="icon" src="https://static.hshuishang.com/User/_assets/Group_783.png" mode=""/>
<image wx:if="{{item.state === 'no'}}" class="icon" src="https://static.hshuishang.com/User/_assets/Group_787.png" mode=""/>
</view>
</view>

View File

@ -1,22 +1,22 @@
<view class="container">
<block wx:if="{{couponList.length === 0}}">
<image class="no_coupon_pic" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_no_coupon.png" mode=""/>
<view class="no_coupon_desc">您还没有可使用的优惠券~</view>
</block>
<block wx:if="{{couponList.length !== 0}}">
<van-tabs active="{{checked}}" bind:change="onChange">
<van-tab title="{{tabs.all}}" name="usable"></van-tab>
<van-tab title="{{tabs.state1}}" name="used"></van-tab>
<van-tab title="{{tabs.state2}}" name="no"></van-tab>
</van-tabs>
<view class="main">
<couponCard
wx:for="{{couponList}}"
wx:key="index"
item="{{item}}"
/>
</view>
</block>
</view>
<view class="container">
<block wx:if="{{couponList.length === 0}}">
<image class="no_coupon_pic" src="https://static.hshuishang.com/User/_assets/Group_no_coupon.png" mode=""/>
<view class="no_coupon_desc">您还没有可使用的优惠券~</view>
</block>
<block wx:if="{{couponList.length !== 0}}">
<van-tabs active="{{checked}}" bind:change="onChange">
<van-tab title="{{tabs.all}}" name="usable"></van-tab>
<van-tab title="{{tabs.state1}}" name="used"></van-tab>
<van-tab title="{{tabs.state2}}" name="no"></van-tab>
</van-tabs>
<view class="main">
<couponCard
wx:for="{{couponList}}"
wx:key="index"
item="{{item}}"
/>
</view>
</block>
</view>
<footer />

View File

@ -1,60 +1,60 @@
<view class="container">
<!-- 用户信息 -->
<view class="header">
<view class="header_item">
<view class="desc">支付单号</view>
<view class="desc">{{shopInfo.order_sn}}</view>
</view>
<view class="header_item">
<view class="desc">购物费用</view>
<view class="desc">¥{{shopInfo.total_price}}</view>
</view>
<view class="header_item">
<view class="desc">实际支付</view>
<view class="desc color_red">¥{{shopInfo.total_price}}</view>
</view>
</view>
<view class="line"></view>
<view class="user_info" bindtap="headerPositionClick">
<view class="left">
<view class="left_header">
<image class="left_header_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Vector.png" mode=""/>
<view class="desc">{{addAress.real_name}}</view>
<van-icon class="contact_icon" name="phone-circle-o" />
<view class="desc">{{addAress.mobile}}</view>
</view>
<view class="left_bottom">{{addAress.optionAddr}}</view>
</view>
<image class="right_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Vector1.png" mode="" />
</view>
<view class="payment_method">
<view class="payment">
<image class="payment_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Frame.png" mode=""/>
<view class="payment_right">
<view class="payment_right_left">
<view class="payment_title">微信支付</view>
<view class="payment_desc">推荐已经安装微信支付客户端的用户使用</view>
</view>
<view class="payment_right_radio">
<radio value="r1" data-name="wx" checked="{{checked === 'wx'}}" bindtap="headerPaySelectClick"/>
</view>
</view>
</view>
<!-- <view class="payment balance">
<image class="payment_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Frame1.png" mode=""/>
<view class="payment_right">
<view class="payment_right_left">
<view class="payment_title">余额支付</view>
<view class="payment_desc">推荐已经安装余额支付客户端的用户使用</view>
</view>
<view class="payment_right_radio">
<radio value="r1" data-name='yue' checked="{{checked === 'yue'}}" bindtap="headerPaySelectClick"/>
</view>
</view>
</view> -->
</view>
<view class="bottom">
<view class="price">¥<text>{{shopInfo.total_price}}</text></view>
<button disabled="{{checked === ''}}" class="payment_btn" bindtap="headersubmitOrderClick">确认支付</button>
</view>
<view class="container">
<!-- 用户信息 -->
<view class="header">
<view class="header_item">
<view class="desc">支付单号</view>
<view class="desc">{{shopInfo.order_sn}}</view>
</view>
<view class="header_item">
<view class="desc">购物费用</view>
<view class="desc">¥{{shopInfo.total_price}}</view>
</view>
<view class="header_item">
<view class="desc">实际支付</view>
<view class="desc color_red">¥{{shopInfo.total_price}}</view>
</view>
</view>
<view class="line"></view>
<view class="user_info" bindtap="headerPositionClick">
<view class="left">
<view class="left_header">
<image class="left_header_icon" src="https://static.hshuishang.com/User/_assets/Vector.png" mode=""/>
<view class="desc">{{addAress.real_name}}</view>
<van-icon class="contact_icon" name="phone-circle-o" />
<view class="desc">{{addAress.mobile}}</view>
</view>
<view class="left_bottom">{{addAress.optionAddr}}</view>
</view>
<image class="right_icon" src="https://static.hshuishang.com/User/_assets/Vector1.png" mode="" />
</view>
<view class="payment_method">
<view class="payment">
<image class="payment_icon" src="https://static.hshuishang.com/User/_assets/Frame.png" mode=""/>
<view class="payment_right">
<view class="payment_right_left">
<view class="payment_title">微信支付</view>
<view class="payment_desc">推荐已经安装微信支付客户端的用户使用</view>
</view>
<view class="payment_right_radio">
<radio value="r1" data-name="wx" checked="{{checked === 'wx'}}" bindtap="headerPaySelectClick"/>
</view>
</view>
</view>
<!-- <view class="payment balance">
<image class="payment_icon" src="https://static.hshuishang.com/User/_assets/Frame1.png" mode=""/>
<view class="payment_right">
<view class="payment_right_left">
<view class="payment_title">余额支付</view>
<view class="payment_desc">推荐已经安装余额支付客户端的用户使用</view>
</view>
<view class="payment_right_radio">
<radio value="r1" data-name='yue' checked="{{checked === 'yue'}}" bindtap="headerPaySelectClick"/>
</view>
</view>
</view> -->
</view>
<view class="bottom">
<view class="price">¥<text>{{shopInfo.total_price}}</text></view>
<button disabled="{{checked === ''}}" class="payment_btn" bindtap="headersubmitOrderClick">确认支付</button>
</view>
</view>

View File

@ -1,125 +1,126 @@
import { doNavigateWithUser } from '../../../utils/helper';
import { postUrl } from '../../../utils/util';
import waterApiArr from '../../../api/water_filter';
Page({
/**
* 页面的初始数据
*/
data: {
functional_List: [
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_25.png",
"name": "推广海报",
"url": "/packages/user/share/index",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_26.png",
"name": "我的下级",
"url": "",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_35.png",
"name": "下级订单",
"url": "",
"type": "h5"
},
{
"image": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_30.png",
"name": "联系平台",
"url": "",
"type": "h5"
},
],
userInfo: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init();
},
init() {
postUrl(waterApiArr.loginInfo,{},res=>{
console.log('loginInfo 接口结果', res);
this.setData({
userInfo: res
})
})
},
/**
* 点击跳转账户详情页
*/
handleUserInfoClick() {
doNavigateWithUser({ url: '/packages/user/userInfo/index' });
},
handleShareClick() {
doNavigateWithUser({ url: '/packages/user/share/index' });
},
headerOrderClick(event) {
console.log('11111', event)
const { url } = event.currentTarget.dataset;
if (!url) {
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel: false,
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
import { doNavigateWithUser } from '../../../utils/helper';
import { postUrl } from '../../../utils/util';
import waterApiArr from '../../../api/water_filter';
const __staticUrl = require('../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
functional_List: [
{
"image": (__staticUrl + '/User/_assets/Group_25.png'),
"name": "推广海报",
"url": "/packages/user/share/index",
"type": "h5"
},
{
"image": (__staticUrl + '/User/_assets/Group_26.png'),
"name": "我的下级",
"url": "",
"type": "h5"
},
{
"image": (__staticUrl + '/User/_assets/Group_35.png'),
"name": "下级订单",
"url": "",
"type": "h5"
},
{
"image": (__staticUrl + '/User/_assets/Group_30.png'),
"name": "联系平台",
"url": "",
"type": "h5"
},
],
userInfo: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init();
},
init() {
postUrl(waterApiArr.loginInfo,{},res=>{
console.log('loginInfo 接口结果', res);
this.setData({
userInfo: res
})
})
},
/**
* 点击跳转账户详情页
*/
handleUserInfoClick() {
doNavigateWithUser({ url: '/packages/user/userInfo/index' });
},
handleShareClick() {
doNavigateWithUser({ url: '/packages/user/share/index' });
},
headerOrderClick(event) {
console.log('11111', event)
const { url } = event.currentTarget.dataset;
if (!url) {
wx.showModal({
title: '提示',
content: '此功能暂未开通!',
showCancel: false,
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,58 +1,58 @@
<view class="container">
<view class="header">
<view class="left">
<image class="avatar" src="{{userInfo.img ? userInfo.img : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png'}}"></image>
</view>
<view class="right">
<view class="user_name" bindtap="handleUserInfoClick">
{{ userInfo.user_name ? userInfo.user_name : '微信用户' }}
(ID:{{userInfo.user_id}})
</view>
<view class="share_poster" bindtap="handleShareClick">推广海报</view>
</view>
</view>
<!-- 推广下级 -->
<view class="main">
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计推广下级</view>
</view>
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计邀请业主</view>
</view>
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计推广订单</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日推广下级</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日邀请业主</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日推广订单</view>
</view>
</view>
<view class="navigation">功能管理</view>
<view class="func">
<!-- 功能列表 -->
<van-grid border="{{ false }}" gutter="{{10}}" icon-size="{{27}}" column-num="4">
<van-grid-item
icon="{{item.image}}"
text="{{item.name}}"
wx:key="index"
link-type="navigateTo"
url="{{item.url}}"
data-url="{{item.url}}"
wx:for="{{functional_List}}"
bind:click="headerOrderClick"
/>
</van-grid>
</view>
</view>
<view class="container">
<view class="header">
<view class="left">
<image class="avatar" src="{{userInfo.img ? userInfo.img : 'https://static.hshuishang.com/person/Group_309.png'}}"></image>
</view>
<view class="right">
<view class="user_name" bindtap="handleUserInfoClick">
{{ userInfo.user_name ? userInfo.user_name : '微信用户' }}
(ID:{{userInfo.user_id}})
</view>
<view class="share_poster" bindtap="handleShareClick">推广海报</view>
</view>
</view>
<!-- 推广下级 -->
<view class="main">
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计推广下级</view>
</view>
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计邀请业主</view>
</view>
<view class="item">
<view class="text">{{0}}</view>
<view class="desc">累计推广订单</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日推广下级</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日邀请业主</view>
</view>
<view class="item has-margin-bottom">
<view class="text">{{0}}</view>
<view class="desc">今日推广订单</view>
</view>
</view>
<view class="navigation">功能管理</view>
<view class="func">
<!-- 功能列表 -->
<van-grid border="{{ false }}" gutter="{{10}}" icon-size="{{27}}" column-num="4">
<van-grid-item
icon="{{item.image}}"
text="{{item.name}}"
wx:key="index"
link-type="navigateTo"
url="{{item.url}}"
data-url="{{item.url}}"
wx:for="{{functional_List}}"
bind:click="headerOrderClick"
/>
</van-grid>
</view>
</view>
<footer />

View File

@ -1,34 +1,34 @@
<view>
<view class="points-overview">
<view class="points-overview__content">
<view class="points-overview__label">账户积分</view>
<view class="points-overview__num">{{ pointsNum }}</view>
</view>
<navigator class="points-overview__action" url="/packages/user/points/desc">
<text class="points-overview__desc">积分规则</text>
<image
style="width: 12rpx; height: 22rpx;"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/more.primary.12x22.png"
>
</image>
</navigator >
</view>
<view class="block-divider"></view>
<view class="record-list">
<view
wx:for="{{records}}"
wx:for-item="item"
wx:key="index"
class="record-list-item"
>
<view class="record-list-item__content">
<view class="record-list-item__label">{{ item.source }}</view>
<view class="record-list-item__num">+{{ item.integral }}</view>
</view>
<view class="record-list-item__datetime">{{ item.create_time }}</view>
</view>
</view>
</view>
<footer />
<view>
<view class="points-overview">
<view class="points-overview__content">
<view class="points-overview__label">账户积分</view>
<view class="points-overview__num">{{ pointsNum }}</view>
</view>
<navigator class="points-overview__action" url="/packages/user/points/desc">
<text class="points-overview__desc">积分规则</text>
<image
style="width: 12rpx; height: 22rpx;"
src="https://static.hshuishang.com/User/_assets/more.primary.12x22.png"
>
</image>
</navigator >
</view>
<view class="block-divider"></view>
<view class="record-list">
<view
wx:for="{{records}}"
wx:for-item="item"
wx:key="index"
class="record-list-item"
>
<view class="record-list-item__content">
<view class="record-list-item__label">{{ item.source }}</view>
<view class="record-list-item__num">+{{ item.integral }}</view>
</view>
<view class="record-list-item__datetime">{{ item.create_time }}</view>
</view>
</view>
</view>
<footer />

View File

@ -1,41 +1,41 @@
<view class="container">
<Nav Text="签到积分" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<view class="header">
<view class="header_left">
<view class="left_detail" bindtap="headerPointsClick">
<image class="gold_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/401463152_31.png" mode=""/>
<text class="points">{{pointsNum}}</text>
<van-icon class="left_icon" color="#FFFFFF" name="arrow" />
</view>
<view class="tomorrow_sign">明日签到+1</view>
</view>
<view class="header_right">
<image class="rigth_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/QIANDAO.png" mode=""/>
</view>
</view>
<view class="main" style="background-image: url(https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Rectangle_112.png)">
<image class="center_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_311.png" mode=""/>
<view class="center_header">
<view class="signed">本期已签到<text>{{checkedData}}</text>天</view>
<view class="center_time">{{starteTime}}~{{endTime}}</view>
</view>
<view class="points_detail">
<view
class="day_detail"
wx:for="{{pointsList}}"
wx:key="index"
bindtap="headerSignClick"
>
<view class="item {{item.today && 'red_border'}}">
<view wx:if="{{item.isSign}}" class="points_time {{!item.isSign && 'color_red'}}">{{item.time}}</view>
<view wx:if="{{!item.isSign}}" class="points_time {{!item.isSign && 'color_red'}}">+{{item.points}}</view>
<image class="points_icon" wx:if="{{item.isSign}}" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_518.png" mode=""/>
<image class="points_icon" wx:else src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/401463152_31.png" mode=""/>
</view>
<view class="day_time">{{index +1}}天</view>
</view>
</view>
</view>
<footer />
<view class="container">
<Nav Text="签到积分" backColor="#fff" color="#fff" NavPosition="relative"></Nav>
<view class="header">
<view class="header_left">
<view class="left_detail" bindtap="headerPointsClick">
<image class="gold_icon" src="https://static.hshuishang.com/User/_assets/401463152_31.png" mode=""/>
<text class="points">{{pointsNum}}</text>
<van-icon class="left_icon" color="#FFFFFF" name="arrow" />
</view>
<view class="tomorrow_sign">明日签到+1</view>
</view>
<view class="header_right">
<image class="rigth_icon" src="https://static.hshuishang.com/User/_assets/QIANDAO.png" mode=""/>
</view>
</view>
<view class="main" style="background-image: url('https://static.hshuishang.com/User/_assets/Rectangle_112.png')">
<image class="center_icon" src="https://static.hshuishang.com/User/_assets/Group_311.png" mode=""/>
<view class="center_header">
<view class="signed">本期已签到<text>{{checkedData}}</text>天</view>
<view class="center_time">{{starteTime}}~{{endTime}}</view>
</view>
<view class="points_detail">
<view
class="day_detail"
wx:for="{{pointsList}}"
wx:key="index"
bindtap="headerSignClick"
>
<view class="item {{item.today && 'red_border'}}">
<view wx:if="{{item.isSign}}" class="points_time {{!item.isSign && 'color_red'}}">{{item.time}}</view>
<view wx:if="{{!item.isSign}}" class="points_time {{!item.isSign && 'color_red'}}">+{{item.points}}</view>
<image class="points_icon" wx:if="{{item.isSign}}" src="https://static.hshuishang.com/User/_assets/Group_518.png" mode=""/>
<image class="points_icon" wx:else src="https://static.hshuishang.com/User/_assets/401463152_31.png" mode=""/>
</view>
<view class="day_time">{{index +1}}天</view>
</view>
</view>
</view>
<footer />
</view>

View File

@ -1,152 +1,153 @@
import util from '../../../utils/util';
import apiArr from '../../../api/water_filter';
Page({
/**
* 页面的初始数据
*/
data: {
imagePath: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test_qrcode.jpg',
},
init() {
let that = this
util.postUrl(apiArr.createQrcode, {
page: '/page/index/index',
scene: `device=${wx.getStorageSync('device_id')}`
}, res => {
let img = util.img_url + res.data;
console.log('img', img)
that.setData({
imagePath: img
})
})
},
headerQrcodeClick() {
console.log('2');
const that = this;
wx.downloadFile({
url: that.data.imagePath, // 网络图片地址
success(res) {
console.log('11312312313', res);
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
// 2. 检查用户授权
wx.getSetting({
success(settingRes) {
if (!settingRes.authSetting['scope.writePhotosAlbum']) {
// 未授权,请求授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 授权成功,保存图片
that.saveImageToAlbum(tempFilePath);
},
fail() {
// 授权失败,提示用户手动打开授权
wx.showModal({
title: '提示',
content: '需要授权保存图片到相册,请手动打开授权设置',
success(modalRes) {
if (modalRes.confirm) {
wx.openSetting(); // 打开授权设置页面
}
}
});
}
});
} else {
// 已授权,保存图片
that.saveImageToAlbum(tempFilePath);
}
}
});
}
},
fail() {
console.log('222');
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
},
saveImageToAlbum(tempFilePath) {
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
wx.showToast({
title: '保存成功',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// this.init();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
import util from '../../../utils/util';
import apiArr from '../../../api/water_filter';
const __staticUrl = require('../../../config/env.js').static_url
Page({
/**
* 页面的初始数据
*/
data: {
imagePath: (__staticUrl + '/test_qrcode.jpg'),
},
init() {
let that = this
util.postUrl(apiArr.createQrcode, {
page: '/page/index/index',
scene: `device=${wx.getStorageSync('device_id')}`
}, res => {
let img = util.img_url + res.data;
console.log('img', img)
that.setData({
imagePath: img
})
})
},
headerQrcodeClick() {
console.log('2');
const that = this;
wx.downloadFile({
url: that.data.imagePath, // 网络图片地址
success(res) {
console.log('11312312313', res);
if (res.statusCode === 200) {
const tempFilePath = res.tempFilePath; // 获取临时文件路径
// 2. 检查用户授权
wx.getSetting({
success(settingRes) {
if (!settingRes.authSetting['scope.writePhotosAlbum']) {
// 未授权,请求授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 授权成功,保存图片
that.saveImageToAlbum(tempFilePath);
},
fail() {
// 授权失败,提示用户手动打开授权
wx.showModal({
title: '提示',
content: '需要授权保存图片到相册,请手动打开授权设置',
success(modalRes) {
if (modalRes.confirm) {
wx.openSetting(); // 打开授权设置页面
}
}
});
}
});
} else {
// 已授权,保存图片
that.saveImageToAlbum(tempFilePath);
}
}
});
}
},
fail() {
console.log('222');
wx.showToast({
title: '图片下载失败',
icon: 'none'
});
}
});
},
saveImageToAlbum(tempFilePath) {
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
wx.showToast({
title: '保存成功',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// this.init();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,52 +1,52 @@
.container {
width: 754rpx;
height: 1334rpx;
overflow-x: hidden;
/* position: relative; */
background: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_756.png');
background-size: 100% 100%;
}
.icon {
width: 752rpx;
height: 1334rpx;
z-index: -1;
}
.main {
width: 100%;
position: absolute;
top: 886rpx;
z-index: 10;
}
.qrcode {
width: 255rpx;
height: 255rpx;
margin: 0 auto;
}
.qrcode_pic {
width: 255rpx;
height: 255rpx;
background: #D9D9D9;
border-radius: 50%;
}
.desc {
margin-top: 32rpx;
text-align: center;
font-weight: 400;
font-size: 26rpx;
color: #000000;
}
.share_btn {
margin-top: 39rpx;
display: flex;
justify-content: space-around;
}
.save {
display: inline-flex;
font-weight: 400;
font-size: 36rpx;
color: #2583FF;
border-radius: 100rpx 100rpx 100rpx 100rpx;
border: 1rpx solid #2583FF;
padding: 10rpx 70rpx;
}
.container {
width: 754rpx;
height: 1334rpx;
overflow-x: hidden;
/* position: relative; */
background: url('https://static.hshuishang.com/User/_assets/Group_756.png');
background-size: 100% 100%;
}
.icon {
width: 752rpx;
height: 1334rpx;
z-index: -1;
}
.main {
width: 100%;
position: absolute;
top: 886rpx;
z-index: 10;
}
.qrcode {
width: 255rpx;
height: 255rpx;
margin: 0 auto;
}
.qrcode_pic {
width: 255rpx;
height: 255rpx;
background: #D9D9D9;
border-radius: 50%;
}
.desc {
margin-top: 32rpx;
text-align: center;
font-weight: 400;
font-size: 26rpx;
color: #000000;
}
.share_btn {
margin-top: 39rpx;
display: flex;
justify-content: space-around;
}
.save {
display: inline-flex;
font-weight: 400;
font-size: 36rpx;
color: #2583FF;
border-radius: 100rpx 100rpx 100rpx 100rpx;
border: 1rpx solid #2583FF;
padding: 10rpx 70rpx;
}

View File

@ -1,58 +1,58 @@
<view class="container">
<!-- 用户信息 -->
<view class="header">
<view class="header_item">
<view class="desc">收货人姓名</view>
<view class="desc">{{addAress.real_name}}</view>
</view>
<view class="header_item">
<view class="desc">手机号码</view>
<view class="desc">{{addAress.mobile}}</view>
</view>
<view class="header_item" bindtap="headerPositionClick">
<view class="desc">配送地址</view>
<view class="header_addaress">
<view class="desc">{{addAress.optionAddr}}</view>
<image class="send_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Vector1.png" mode=""/>
</view>
</view>
</view>
<view class="line"></view>
<!-- 商品卡片信息 -->
<view class="product_card">
<card
item="{{item}}"
/>
</view>
<view class="line"></view>
<!-- 订单信息 -->
<view>
<view class="order_item">
<view class="desc">订单金额</view>
<view class="desc">¥{{item.total_price}}</view>
</view>
<view class="order_item">
<view class="desc">配送费用</view>
<view class="desc order_desc">包邮</view>
</view>
<view class="order_item">
<view class="desc">实际支付</view>
<view class="desc order_desc">¥{{item.total_price}}</view>
</view>
</view>
<view class="line"></view>
<!-- 商家信息 -->
<view class="shop_info">
<card
isTopShow
headerText="{{'商家信息'}}"
item="{{shopInfo}}"
shopInfoShow
/>
</view>
<view class="bottom">
<view class="payment_btn btn_desc" bindtap="handleGoPayClick">去付款</view>
<view class="cancel_btn btn_desc" bindtap="handleCancelOrderClick">取消订单</view>
</view>
</view>
<view class="container">
<!-- 用户信息 -->
<view class="header">
<view class="header_item">
<view class="desc">收货人姓名</view>
<view class="desc">{{addAress.real_name}}</view>
</view>
<view class="header_item">
<view class="desc">手机号码</view>
<view class="desc">{{addAress.mobile}}</view>
</view>
<view class="header_item" bindtap="headerPositionClick">
<view class="desc">配送地址</view>
<view class="header_addaress">
<view class="desc">{{addAress.optionAddr}}</view>
<image class="send_icon" src="https://static.hshuishang.com/User/_assets/Vector1.png" mode=""/>
</view>
</view>
</view>
<view class="line"></view>
<!-- 商品卡片信息 -->
<view class="product_card">
<card
item="{{item}}"
/>
</view>
<view class="line"></view>
<!-- 订单信息 -->
<view>
<view class="order_item">
<view class="desc">订单金额</view>
<view class="desc">¥{{item.total_price}}</view>
</view>
<view class="order_item">
<view class="desc">配送费用</view>
<view class="desc order_desc">包邮</view>
</view>
<view class="order_item">
<view class="desc">实际支付</view>
<view class="desc order_desc">¥{{item.total_price}}</view>
</view>
</view>
<view class="line"></view>
<!-- 商家信息 -->
<view class="shop_info">
<card
isTopShow
headerText="{{'商家信息'}}"
item="{{shopInfo}}"
shopInfoShow
/>
</view>
<view class="bottom">
<view class="payment_btn btn_desc" bindtap="handleGoPayClick">去付款</view>
<view class="cancel_btn btn_desc" bindtap="handleCancelOrderClick">取消订单</view>
</view>
</view>
<footer />

View File

@ -1,267 +1,268 @@
import {
pageTitle,
tabsList
} from './constant';
import {
doNavigateWithUser
} from '../../../utils/helper';
import {
postUrl,
} from '../../../utils/util';
import { apiArr } from '../../../api/user';
Page({
/**
* 页面的初始数据
*/
data: {
tabs: null,
checked: 0,
allList: [{
number: "B123456",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '白色乳胶记忆枕',
amount: 45,
price: 60,
order_id: 48,
state: '待取货',
states: 'c'
},
{
number: "A123456",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '黑色涤纶裤子',
amount: 95,
price: 120,
state: '待接单',
states: 'b'
},
{
number: "C9744123",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '紫色抱枕',
amount: 600,
price: 600,
state: '配送中',
states: 'd'
},
{
number: "B123456",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '白色乳胶记忆枕',
amount: 45,
price: 60,
state: '退款中',
states: 'e'
},
{
number: "A123456",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '黑色涤纶裤子',
amount: 95,
price: 120,
state: '已退款',
states: 'f'
},
{
number: "C9744123",
icon: 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png',
title: '紫色抱枕',
amount: 600,
price: 600,
state: '待接单',
states: 'b'
}
],
list: [],
type: '',
size: 10,
number: 1,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('1111', options);
// 基于父页面传递参数设置页面名称
wx.setNavigationBarTitle({
title: `${pageTitle[options.type]}订单`
});
this.setData({
type: options.type,
tabs: tabsList[options.type],
title: pageTitle[options.type],
});
// this.init(options.type);
},
// 页面初始化 请求list 数据
init(type, pageNum) {
const { list, checked } = this.data;
wx.showLoading({
title: '加载中',
})
let url;
if (type === 'visit') {
url = apiArr.getOrdersAllList
} else if ( type === 'community') {
url = '周边商超'
} else if (type === 'ambient') {
url = '社区商城'
} else {
wx.hideLoading();
console.log('货不对板');
return;
}
let params = {}
if (checked !== 0) {
params = {
page_size: Number(10),
page_num: pageNum || 1,
status: checked
}
} else {
params = {
page_size: Number(10),
page_num: pageNum || 1,
}
}
postUrl(url, params, res => {
console.log('上门服务', res);
wx.hideLoading();
this.setData({
list: list.concat(res.rows || []),
})
if (!res.rows) {
wx.showToast({
title: '没有更多数据了',
icon: 'none',
});
}
})
},
onChange(event) {
const { name } = event.detail;
const { type } = this.data;
this.setData({
list: [],
number: 1,
checked: name
});
this.init(type);
},
// 取消订单
handleOrdeClick(e) {
const { type } = this.data;
wx.showLoading({
title: '加载中',
mask: true
})
postUrl(apiArr.revoke, {
order_id: Number(e.detail)
},
res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
title: '取消订单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.message,
icon: 'none',
})
this.init(type, 1);
})
},
// 订单详情
handleDetailsClick(e) {
console.log('详情事件触发', e);
doNavigateWithUser({
url: `/packages/user/transactionDetail/index?orderId=${e.detail.id}&ordersn=${e.detail.ordersn}`
});
},
// 去付款
handlePaymentClick(e) {
console.log('去付款事件触发',e)
const {name, tel, region, addr, order_id} = e.detail;
// 获取当前点击付款项的地址参数
const addAress = {
real_name: name,
mobile: tel,
optionAddr: `${region}${addr}`,
}
console.log('addAressaddAressaddAress', addAress);
wx.setStorageSync('newAddress', addAress);
doNavigateWithUser({
url: `/packages/user/goPay/index?orderId=${order_id}`
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
const { type } = this.data;
this.setData({
list: [],
number: 1,
})
this.init(type);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
const { type, size, number } = this.data;
this.setData({
number: number + 1,
});
this.init(type, number + 1);
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
import {
const __staticUrl = require('../../../config/env.js').static_url
pageTitle,
tabsList
} from './constant';
import {
doNavigateWithUser
} from '../../../utils/helper';
import {
postUrl,
} from '../../../utils/util';
import { apiArr } from '../../../api/user';
Page({
/**
* 页面的初始数据
*/
data: {
tabs: null,
checked: 0,
allList: [{
number: "B123456",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '白色乳胶记忆枕',
amount: 45,
price: 60,
order_id: 48,
state: '待取货',
states: 'c'
},
{
number: "A123456",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '黑色涤纶裤子',
amount: 95,
price: 120,
state: '待接单',
states: 'b'
},
{
number: "C9744123",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '紫色抱枕',
amount: 600,
price: 600,
state: '配送中',
states: 'd'
},
{
number: "B123456",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '白色乳胶记忆枕',
amount: 45,
price: 60,
state: '退款中',
states: 'e'
},
{
number: "A123456",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '黑色涤纶裤子',
amount: 95,
price: 120,
state: '已退款',
states: 'f'
},
{
number: "C9744123",
icon: (__staticUrl + '/User/_assets/Classroom.png'),
title: '紫色抱枕',
amount: 600,
price: 600,
state: '待接单',
states: 'b'
}
],
list: [],
type: '',
size: 10,
number: 1,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('1111', options);
// 基于父页面传递参数设置页面名称
wx.setNavigationBarTitle({
title: `${pageTitle[options.type]}订单`
});
this.setData({
type: options.type,
tabs: tabsList[options.type],
title: pageTitle[options.type],
});
// this.init(options.type);
},
// 页面初始化 请求list 数据
init(type, pageNum) {
const { list, checked } = this.data;
wx.showLoading({
title: '加载中',
})
let url;
if (type === 'visit') {
url = apiArr.getOrdersAllList
} else if ( type === 'community') {
url = '周边商超'
} else if (type === 'ambient') {
url = '社区商城'
} else {
wx.hideLoading();
console.log('货不对板');
return;
}
let params = {}
if (checked !== 0) {
params = {
page_size: Number(10),
page_num: pageNum || 1,
status: checked
}
} else {
params = {
page_size: Number(10),
page_num: pageNum || 1,
}
}
postUrl(url, params, res => {
console.log('上门服务', res);
wx.hideLoading();
this.setData({
list: list.concat(res.rows || []),
})
if (!res.rows) {
wx.showToast({
title: '没有更多数据了',
icon: 'none',
});
}
})
},
onChange(event) {
const { name } = event.detail;
const { type } = this.data;
this.setData({
list: [],
number: 1,
checked: name
});
this.init(type);
},
// 取消订单
handleOrdeClick(e) {
const { type } = this.data;
wx.showLoading({
title: '加载中',
mask: true
})
postUrl(apiArr.revoke, {
order_id: Number(e.detail)
},
res => {
wx.hideLoading();
if (res.error) {
wx.showToast({
title: '取消订单失败',
icon: 'none',
})
return;
}
wx.showToast({
title: res.message,
icon: 'none',
})
this.init(type, 1);
})
},
// 订单详情
handleDetailsClick(e) {
console.log('详情事件触发', e);
doNavigateWithUser({
url: `/packages/user/transactionDetail/index?orderId=${e.detail.id}&ordersn=${e.detail.ordersn}`
});
},
// 去付款
handlePaymentClick(e) {
console.log('去付款事件触发',e)
const {name, tel, region, addr, order_id} = e.detail;
// 获取当前点击付款项的地址参数
const addAress = {
real_name: name,
mobile: tel,
optionAddr: `${region}${addr}`,
}
console.log('addAressaddAressaddAress', addAress);
wx.setStorageSync('newAddress', addAress);
doNavigateWithUser({
url: `/packages/user/goPay/index?orderId=${order_id}`
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow(options) {
const { type } = this.data;
this.setData({
list: [],
number: 1,
})
this.init(type);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
const { type, size, number } = this.data;
this.setData({
number: number + 1,
});
this.init(type, number + 1);
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,29 +1,29 @@
<!-- 商城订单页 -->
<view class="container">
<van-tabs active="{{checked}}" bind:change="onChange">
<van-tab title="{{item.title}}" wx:for="{{tabs}}" wx:key="index" name="{{item.name}}"></van-tab>
</van-tabs>
<view wx:if="{{list.length === 0}}" class="no_ordes">
<image class="no_orders_icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Clip_path group.png" mode=""/>
<view class="no_orders_desc">您还没有{{title}}的订单~</view>
</view>
<view class="main" wx:else>
<card
wx:for="{{list}}"
wx:key="index"
item="{{item}}"
isTopShow
headerText="{{'订单编号:'}}"
headerDesc="{{item.order_sn}}"
state
isBottomShow
bind:orde="handleOrdeClick"
bind:details="handleDetailsClick"
bind:goPay="handlePaymentClick"
/>
</view>
</view>
<!-- 商城订单页 -->
<view class="container">
<van-tabs active="{{checked}}" bind:change="onChange">
<van-tab title="{{item.title}}" wx:for="{{tabs}}" wx:key="index" name="{{item.name}}"></van-tab>
</van-tabs>
<view wx:if="{{list.length === 0}}" class="no_ordes">
<image class="no_orders_icon" src="https://static.hshuishang.com/User/_assets/Clip_path group.png" mode=""/>
<view class="no_orders_desc">您还没有{{title}}的订单~</view>
</view>
<view class="main" wx:else>
<card
wx:for="{{list}}"
wx:key="index"
item="{{item}}"
isTopShow
headerText="{{'订单编号:'}}"
headerDesc="{{item.order_sn}}"
state
isBottomShow
bind:orde="handleOrdeClick"
bind:details="handleDetailsClick"
bind:goPay="handlePaymentClick"
/>
</view>
</view>
<footer />

Some files were not shown because too many files have changed in this diff Show More