Commit 893fdbca by 张立顺

bug 修复

1 parent 919352d7
...@@ -138,7 +138,7 @@ Component({ ...@@ -138,7 +138,7 @@ Component({
item.merchantName = item.merchantName || item.actualMerchantName item.merchantName = item.merchantName || item.actualMerchantName
item.phone = item.phone || item.actualPhone item.phone = item.phone || item.actualPhone
// || item.actualContactName // || item.actualContactName
item.contactName = item.contactName || item.actualAccountName item.contactName = item.contactName || item.actualContactName
return item return item
}) })
console.log(list) console.log(list)
...@@ -180,23 +180,21 @@ Component({ ...@@ -180,23 +180,21 @@ Component({
// let // let
let status = customerList[index].isEdit let status = customerList[index].isEdit
// console.log(isEdit) // console.log(isEdit)
// customerList[index]['isEdit'] = !customerList[index]['isEdit']
if (item.isEdit) { if (item.isEdit) {
// 提交客户信息更新 // 提交客户信息更新
// this.checkout(customerList[index])
// console.log('customerList[index]', customerList[index])
// let {} =
!isSuper && this.submit(customerList[index]) !isSuper && this.submit(customerList[index])
} else { }
customerList[index]['isEdit'] = true console.log(index)
// let indexEdit = console.log(!status)
this.setData({ this.setData({
customerList [`customerList[${index}].isEdit`]: !status
}) })
}
}, },
input(e) { input(e) {
let { index, name } = e.currentTarget.dataset let { index, name } = e.currentTarget.dataset
console.log(index) // console.log(index)
console.log(name) // console.log(name)
let { customerList, listObj } = this.data let { customerList, listObj } = this.data
let { value } = e.detail let { value } = e.detail
// listObj // listObj
......
...@@ -172,12 +172,23 @@ Component({ ...@@ -172,12 +172,23 @@ Component({
tabBarStyle: height / 2 + statusBarHeight tabBarStyle: height / 2 + statusBarHeight
}) })
}, },
refreshList(e) { async refreshList(e) {
console.log(e) console.log(e)
let { type } = this.data let { type } = this.data
let { typename } = e.currentTarget.dataset let { typename } = e.currentTarget.dataset
type[typename].pageNum = 1 type[typename].pageNum = 1
this.getMessageList(typename) let res = await this.getMessageList(typename)
let toastObj = {
success: {
title: '刷新成功',
icon: 'success'
},
fail: {
title: '刷新失败',
icon: 'error'
}
}
wx.$api.showToast(toastObj[res])
}, },
scrollonReachBottom(e) { scrollonReachBottom(e) {
console.log(e) console.log(e)
...@@ -203,6 +214,7 @@ Component({ ...@@ -203,6 +214,7 @@ Component({
}, },
getMessageList(typeName) { getMessageList(typeName) {
let that = this let that = this
return new Promise((resolve, reject) => {
let { serviceMerchantId, type, warReportList, messageList } = this.data let { serviceMerchantId, type, warReportList, messageList } = this.data
let list = type[typeName]['list'] let list = type[typeName]['list']
// console.log('list', this.data[list]) // console.log('list', this.data[list])
...@@ -227,11 +239,15 @@ Component({ ...@@ -227,11 +239,15 @@ Component({
type, type,
triggered: false triggered: false
}) })
resolve('success')
})
.catch(err => {
reject('fail')
}) })
.catch(err => {})
.finally(() => { .finally(() => {
wx.$api.hideLoading() wx.$api.hideLoading()
}) })
})
} }
} }
}) })
...@@ -8,11 +8,33 @@ ...@@ -8,11 +8,33 @@
<view>消息盒子</view> <view>消息盒子</view>
</navigation-bar> </navigation-bar>
<view class="layout " style="padding-top:{{tabBarStyle}}px; height:calc(100vh - {{tabBarStyle}}px)"> <view class="layout " style="padding-top:{{tabBarStyle}}px; height:calc(100vh - {{tabBarStyle}}px)">
<tab tab="{{tabList}}" itemWidth="{{'50%'}}" index="{{tabIndx}}" bindclick="changeTabIndx" class="tabContainer" /> <tab
tab="{{tabList}}"
itemWidth="{{'50%'}}"
index="{{tabIndx}}"
bindclick="changeTabIndx"
class="tabContainer" />
<!-- --> <!-- -->
<view class="scrollCon" hidden="{{tabIndx==1}}"> <view class="scrollCon" hidden="{{tabIndx==1}}">
<scroll-view wx:if="{{tabBarStyle}}" scroll-y enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="refreshList" bindscrolltolower="scrollonReachBottom" refresher-threshold="104" style="height:100%;" scroll-top="{{scrollTop}}" class="list" data-typeName="warReport" refresher-triggered="{{triggered}}"> <scroll-view
<msg-box wx:for="{{warReportList}}" wx:key='index' merchantName="{{item.merchantName}}" messageType="{{item.messageType}}" time="{{item.updatedTime}}"> wx:if="{{tabBarStyle}}"
scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="refreshList"
bindscrolltolower="scrollonReachBottom"
refresher-threshold="104"
style="height:100%;"
scroll-top="{{scrollTop}}"
class="list"
data-typeName="warReport"
refresher-triggered="{{triggered}}">
<msg-box
wx:for="{{warReportList}}"
wx:key='index'
merchantName="{{item.merchantName}}"
messageType="{{item.messageType}}"
time="{{item.updatedTime}}">
<view class="warReportBox" wx:if="{{item.messageType == 2}}"> <view class="warReportBox" wx:if="{{item.messageType == 2}}">
<view class="item"> <view class="item">
<view class="label">当前产值</view> <view class="label">当前产值</view>
...@@ -31,18 +53,37 @@ ...@@ -31,18 +53,37 @@
</view> </view>
<view class="warReportLink"> <view class="warReportLink">
<view class="label">点击了解详情:</view> <view class="label">点击了解详情:</view>
<view class="link" wx:if="{{item.valueUrl}}" data-valueurl="{{item.valueUrl}}" data-item="{{item}}" bind:tap="downLoad"> <view
class="link"
wx:if="{{item.valueUrl}}"
data-valueurl="{{item.valueUrl}}"
data-item="{{item}}"
bind:tap="downLoad">
战报详情 战报详情
</view> </view>
</view> </view>
</msg-box> </msg-box>
</scroll-view> </scroll-view>
</view> </view>
<view hidden="{{tabIndx==0}}" class="scrollCon"> <view hidden="{{tabIndx==0}}" class="scrollCon">
<scroll-view scroll-y enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="refreshList" bindscrolltolower="scrollonReachBottom" refresher-threshold="104" style="height:100%;" scroll-top="{{scrollTop}}" class="list" data-typeName="message" refresher-triggered="{{triggered}}"> <scroll-view
scroll-y
<msg-box wx:for="{{messageList}}" wx:key='index' merchantName="{{item.merchantName}}" messageType="{{item.messageType}}" time="{{item.updatedTime}}"> enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="refreshList"
bindscrolltolower="scrollonReachBottom"
refresher-threshold="104"
style="height:100%;"
scroll-top="{{scrollTop}}"
class="list"
data-typeName="message"
refresher-triggered="{{triggered}}">
<msg-box
wx:for="{{messageList}}"
wx:key='index'
merchantName="{{item.merchantName}}"
messageType="{{item.messageType}}"
time="{{item.updatedTime}}">
<view wx:if="{{item.messageType == 1}}"> <view wx:if="{{item.messageType == 1}}">
<view class="cell"> <view class="cell">
<view class="label">活动名称:</view> <view class="label">活动名称:</view>
...@@ -57,8 +98,8 @@ ...@@ -57,8 +98,8 @@
<view class="value">{{item.activityEndTime||'-'}}</view> <view class="value">{{item.activityEndTime||'-'}}</view>
</view> </view>
<view class="cell" wx:if="{{item.crowdFundActivityId}}"> <view class="cell" wx:if="{{item.crowdFundActivityId}}">
<view class="label">活动链接:</view> <view class="label">母链海报:</view>
<view class="link" bind:tap="copyLink" data-item="{{item}}">下载海报</view> <view class="link" bind:tap="copyLink" data-item="{{item}}">下载母链海报分享给门店开展活动</view>
</view> </view>
</view> </view>
<view class="cell" wx:if="{{item.messageType == 4}}"> <view class="cell" wx:if="{{item.messageType == 4}}">
...@@ -75,8 +116,8 @@ ...@@ -75,8 +116,8 @@
</view> </view>
</msg-box> </msg-box>
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
<crowdfund-poster findKey="crowdFundActivityId" id="poster" item="{{posterItem}}" /> <crowdfund-poster findKey="crowdFundActivityId" id="poster" item="{{posterItem}}" />
<canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" /> <canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" />
...@@ -41,14 +41,14 @@ ...@@ -41,14 +41,14 @@
}, },
{ {
"name": "客户管理", "name": "客户管理",
"pathName": "pages/mineDetail/customerManagement/customerManagement", "pathName": "packagesList/mineDetail/pages/customerManagement",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
}, },
{ {
"name": "消息盒子", "name": "消息盒子",
"pathName": "pages/mineDetail/messageBox/messageBox", "pathName": "packagesList/mineDetail/pages/messageBox",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
......
import wxqrcode from "~/utils/lib/wxqrcode.js"; import wxqrcode from '~/utils/lib/wxqrcode.js'
/** /**
* 微信校验通知类工具封装 * 微信校验通知类工具封装
*/ */
const tipsObj = { const tipsObj = {
phone: { phone: {
icon: "error", icon: 'error',
title: "请输入手机号", title: '请输入手机号'
}, },
username: { username: {
icon: "error", icon: 'error',
title: "请输入用户名", title: '请输入用户名'
}, },
password: { password: {
icon: "error", icon: 'error',
title: "请输入密码", title: '请输入密码'
}, }
}; }
/** /**
* 禁止滑动 * 禁止滑动
*/ */
const noScroll = () => {}; const noScroll = () => {}
/**设置粘贴板内容 */ /**设置粘贴板内容 */
const setCopyData = (data, callBack) => { const setCopyData = (data, callBack) => {
wx.setClipboardData({ wx.setClipboardData({
data: data, data: data,
success(res) { success(res) {
if (callBack && typeof callBack === "function") callBack(res); if (callBack && typeof callBack === 'function') callBack(res)
}, }
}); })
}; }
/** /**
* 防止重复点击 * 防止重复点击
*/ */
const showLoading = (title = "") => { const showLoading = (title = '') => {
if (wx.showLoading) { if (wx.showLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理 // 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.showLoading({ wx.showLoading({
title, title,
mask: true, mask: true
}); })
} else { } else {
// 低版本采用Toast兼容处理并将时间设为20秒以免自动消失 // 低版本采用Toast兼容处理并将时间设为20秒以免自动消失
wx.showToast({ wx.showToast({
title, title,
icon: "loading", icon: 'loading',
mask: true, mask: true,
duration: 20000, duration: 20000
}); })
} }
}; }
const hideLoading = () => { const hideLoading = () => {
if (wx.hideLoading) { if (wx.hideLoading) {
// 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理 // 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理
wx.hideLoading(); wx.hideLoading()
} else { } else {
wx.hideToast(); wx.hideToast()
} }
}; }
const showToast = (val) => { const showToast = val => {
let obj = {}; let obj = {}
if (val && typeof val === "string") { if (val && typeof val === 'string') {
obj.title = val; obj.title = val
obj.icon = "none"; obj.icon = 'none'
} else { } else {
obj = val; obj = val
} }
return wx.showToast(obj); return wx.showToast(obj)
}; }
/** /**
* *
...@@ -80,77 +80,76 @@ const showToast = (val) => { ...@@ -80,77 +80,76 @@ const showToast = (val) => {
const wxShowToast = (name, params) => { const wxShowToast = (name, params) => {
if (arguments.length == 2) { if (arguments.length == 2) {
wx.showToast({ wx.showToast({
title: tipsObj[name]["title"], title: tipsObj[name]['title'],
icon: tipsObj[name]["icon"], icon: tipsObj[name]['icon'],
...params, ...params
}); })
} else { } else {
wx.showToast({ wx.showToast({
...params, ...params
}); })
} }
}; }
/**获取设备信息 */ /**获取设备信息 */
const getSystemInfo = (callBack) => { const getSystemInfo = callBack => {
wx.getSystemInfo({ wx.getSystemInfo({
success(res) { success(res) {
callBack(res); callBack(res)
}, },
fail(err) { fail(err) {
callBack(err); callBack(err)
}, }
}); })
}; }
/**拨打电话 */ /**拨打电话 */
const phoneCall = (phoneNumber) => { const phoneCall = phoneNumber => {
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: `${phoneNumber}`, phoneNumber: `${phoneNumber}`
}); })
}; }
/**查看大图 */ /**查看大图 */
const previewImage = (params) => { const previewImage = params => {
wx.previewImage(params); wx.previewImage(params)
}; }
export function handleCopy(url) { export function handleCopy(url) {
// var { idx } = e.currentTarget.dataset // var { idx } = e.currentTarget.dataset
// var currentItem = this.data.orderObj.activityList[idx] // var currentItem = this.data.orderObj.activityList[idx]
var qr = wxqrcode.createQrCodeImg(url); var qr = wxqrcode.createQrCodeImg(url)
const base64src = function (base64data) { const base64src = function (base64data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const [a, format, bodyData] = const [a, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || []
/data:image\/(\w+);base64,(.*)/.exec(base64data) || []; if (!format) reject(new Error('ERROR_BASE64SRC_PARSE'))
if (!format) reject(new Error("ERROR_BASE64SRC_PARSE")); const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`
const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`; const buffer = wx.base64ToArrayBuffer(bodyData)
const buffer = wx.base64ToArrayBuffer(bodyData);
wx.getFileSystemManager().writeFile({ wx.getFileSystemManager().writeFile({
filePath, filePath,
data: buffer, data: buffer,
encoding: "binary", encoding: 'binary',
success() { success() {
resolve(filePath); resolve(filePath)
}, },
fail() { fail() {
reject(new Error("ERROR_BASE64SRC_WRITE")); reject(new Error('ERROR_BASE64SRC_WRITE'))
}, }
}); })
}); })
}; }
base64src(qr).then((res) => { base64src(qr).then(res => {
console.log(res); console.log(res)
wx.getImageInfo({ wx.getImageInfo({
src: res, src: res,
success(obj) { success(obj) {
wx.showShareImageMenu({ wx.showShareImageMenu({
path: obj.path, path: obj.path
}); })
}, },
fail() {}, fail() {}
}); })
}); })
} }
/**获取节点信息 /**获取节点信息
...@@ -159,18 +158,15 @@ export function handleCopy(url) { ...@@ -159,18 +158,15 @@ export function handleCopy(url) {
* isComponents是否在组件 * isComponents是否在组件
*/ */
const getViewInfo = (name, callBack, isComponents) => { const getViewInfo = (name, callBack, isComponents) => {
const query = !isComponents ? wx.createSelectorQuery() : wx.createSelectorQuery().in(isComponents)
const query = !isComponents
? wx.createSelectorQuery()
: wx.createSelectorQuery().in(isComponents);
query query
.selectAll(name) .selectAll(name)
.boundingClientRect((res) => { .boundingClientRect(res => {
console.log('res: ', res); console.log('res: ', res)
callBack(res); callBack(res)
}) })
.exec(); .exec()
}; }
const wxApi = { const wxApi = {
previewImage, previewImage,
...@@ -182,6 +178,7 @@ const wxApi = { ...@@ -182,6 +178,7 @@ const wxApi = {
phoneCall, phoneCall,
noScroll, noScroll,
getViewInfo, getViewInfo,
}; wxShowToast
}
export default wxApi; export default wxApi
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!