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
this.setData({
customerList
})
} }
console.log(index)
// let indexEdit = console.log(!status)
this.setData({
[`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,35 +214,40 @@ Component({ ...@@ -203,35 +214,40 @@ Component({
}, },
getMessageList(typeName) { getMessageList(typeName) {
let that = this let that = this
let { serviceMerchantId, type, warReportList, messageList } = this.data return new Promise((resolve, reject) => {
let list = type[typeName]['list'] let { serviceMerchantId, type, warReportList, messageList } = this.data
// console.log('list', this.data[list]) let list = type[typeName]['list']
// return // console.log('list', this.data[list])
let params = { // return
serviceMerchantId: serviceMerchantId, let params = {
...type[typeName] serviceMerchantId: serviceMerchantId,
} ...type[typeName]
// console.log(Math.ceil(2.8)) }
wx.$api.showLoading('加载中...') // console.log(Math.ceil(2.8))
mineApi wx.$api.showLoading('加载中...')
.messageBoxPage(params) mineApi
.then(result => { .messageBoxPage(params)
console.log(result) .then(result => {
let { count, data, pageSize, pageNum, pages } = result console.log(result)
const listName = `${type[typeName]['list']}` let { count, data, pageSize, pageNum, pages } = result
type[typeName]['pages'] = pages const listName = `${type[typeName]['list']}`
type[typeName]['pageNum'] = pageNum type[typeName]['pages'] = pages
console.log(listName) type[typeName]['pageNum'] = pageNum
this.setData({ console.log(listName)
[listName]: type[typeName].pageNum == 1 ? data : [...this.data[list], ...data], this.setData({
type, [listName]: type[typeName].pageNum == 1 ? data : [...this.data[list], ...data],
triggered: false type,
triggered: false
})
resolve('success')
}) })
}) .catch(err => {
.catch(err => {}) reject('fail')
.finally(() => { })
wx.$api.hideLoading() .finally(() => {
}) wx.$api.hideLoading()
})
})
} }
} }
}) })
...@@ -5,78 +5,119 @@ ...@@ -5,78 +5,119 @@
</view> --> </view> -->
<navigation-bar showBack="{{true}}" navStyle="{{navStyle}}" bindnavbarReady="navbarReady"> <navigation-bar showBack="{{true}}" navStyle="{{navStyle}}" bindnavbarReady="navbarReady">
<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}}"
<view class="scrollCon" hidden="{{tabIndx==1}}"> itemWidth="{{'50%'}}"
<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}}"> index="{{tabIndx}}"
<msg-box wx:for="{{warReportList}}" wx:key='index' merchantName="{{item.merchantName}}" messageType="{{item.messageType}}" time="{{item.updatedTime}}"> bindclick="changeTabIndx"
<view class="warReportBox" wx:if="{{item.messageType == 2}}"> class="tabContainer" />
<view class="item"> <!-- -->
<view class="label">当前产值</view> <view class="scrollCon" hidden="{{tabIndx==1}}">
<view class="num font-number">{{item.currentValue||'0.0'}}元</view> <scroll-view
</view> wx:if="{{tabBarStyle}}"
</view> scroll-y
<view class="warReportBox" wx:if="{{item.messageType == 3}}"> enable-back-to-top
<view class="item"> refresher-enabled="{{true}}"
<view class="label">总产值</view> bindrefresherrefresh="refreshList"
<view class="num font-number">{{item.totalValue}}元</view> bindscrolltolower="scrollonReachBottom"
</view> refresher-threshold="104"
<view class="item"> style="height:100%;"
<view class="label">完成目标</view> scroll-top="{{scrollTop}}"
<view class="num font-number">{{item.completeRate}}</view> class="list"
</view> data-typeName="warReport"
</view> refresher-triggered="{{triggered}}">
<view class="warReportLink"> <msg-box
<view class="label">点击了解详情:</view> wx:for="{{warReportList}}"
<view class="link" wx:if="{{item.valueUrl}}" data-valueurl="{{item.valueUrl}}" data-item="{{item}}" bind:tap="downLoad"> wx:key='index'
战报详情 merchantName="{{item.merchantName}}"
</view> messageType="{{item.messageType}}"
</view> time="{{item.updatedTime}}">
</msg-box> <view class="warReportBox" wx:if="{{item.messageType == 2}}">
</scroll-view> <view class="item">
<view class="label">当前产值</view>
</view> <view class="num font-number">{{item.currentValue||'0.0'}}元</view>
<view hidden="{{tabIndx==0}}" class="scrollCon"> </view>
<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}}"> </view>
<view class="warReportBox" wx:if="{{item.messageType == 3}}">
<msg-box wx:for="{{messageList}}" wx:key='index' merchantName="{{item.merchantName}}" messageType="{{item.messageType}}" time="{{item.updatedTime}}"> <view class="item">
<view wx:if="{{item.messageType == 1}}"> <view class="label">总产值</view>
<view class="cell"> <view class="num font-number">{{item.totalValue}}元</view>
<view class="label">活动名称:</view> </view>
<view class="value">{{item.activityName}}</view> <view class="item">
</view> <view class="label">完成目标</view>
<view class="cell"> <view class="num font-number">{{item.completeRate}}</view>
<view class="label">开始时间:</view> </view>
<view class="value">{{item.activityStartTime||'-'}}</view> </view>
</view> <view class="warReportLink">
<view class="cell"> <view class="label">点击了解详情:</view>
<view class="label">结算时间:</view> <view
<view class="value">{{item.activityEndTime||'-'}}</view> class="link"
</view> wx:if="{{item.valueUrl}}"
<view class="cell" wx:if="{{item.crowdFundActivityId}}"> data-valueurl="{{item.valueUrl}}"
<view class="label">活动链接:</view> data-item="{{item}}"
<view class="link" bind:tap="copyLink" data-item="{{item}}">下载海报</view> bind:tap="downLoad">
</view> 战报详情
</view> </view>
<view class="cell" wx:if="{{item.messageType == 4}}"> </view>
<view class="label">产品名称:</view> </msg-box>
<view class="value">{{item.activityName}}</view> </scroll-view>
</view> </view>
<view class="cell" wx:if="{{item.messageType == 5}}"> <view hidden="{{tabIndx==0}}" class="scrollCon">
<view class="label">新车交付场景:</view> <scroll-view
<view class="value">{{item.activityName}}</view> scroll-y
</view> enable-back-to-top
<view class="cell" wx:if="{{item.messageType == 6}}"> refresher-enabled="{{true}}"
<view class="label">0~12个月场景:</view> bindrefresherrefresh="refreshList"
<view class="value">{{item.activityName}}</view> bindscrolltolower="scrollonReachBottom"
</view> refresher-threshold="104"
</msg-box> style="height:100%;"
</scroll-view> scroll-top="{{scrollTop}}"
class="list"
</view> 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 class="cell">
<view class="label">活动名称:</view>
<view class="value">{{item.activityName}}</view>
</view>
<view class="cell">
<view class="label">开始时间:</view>
<view class="value">{{item.activityStartTime||'-'}}</view>
</view>
<view class="cell">
<view class="label">结算时间:</view>
<view class="value">{{item.activityEndTime||'-'}}</view>
</view>
<view class="cell" wx:if="{{item.crowdFundActivityId}}">
<view class="label">母链海报:</view>
<view class="link" bind:tap="copyLink" data-item="{{item}}">下载母链海报分享给门店开展活动</view>
</view>
</view>
<view class="cell" wx:if="{{item.messageType == 4}}">
<view class="label">产品名称:</view>
<view class="value">{{item.activityName}}</view>
</view>
<view class="cell" wx:if="{{item.messageType == 5}}">
<view class="label">新车交付场景:</view>
<view class="value">{{item.activityName}}</view>
</view>
<view class="cell" wx:if="{{item.messageType == 6}}">
<view class="label">0~12个月场景:</view>
<view class="value">{{item.activityName}}</view>
</view>
</msg-box>
</scroll-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" />
\ No newline at end of file \ No newline at end of file
<canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" />
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
font-size: 16rpx; font-size: 16rpx;
} }
.total-price { .total-price {
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
......
...@@ -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!