Commit 8b8bf267 by chenwq

喜报,下拉刷新

1 parent 641aa212
...@@ -99,5 +99,13 @@ class outputApi { ...@@ -99,5 +99,13 @@ class outputApi {
...data ...data
}) })
} }
/**获取最新喜报 */
getNewGoodUrl(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.good.report',
...data
})
}
} }
export default outputApi export default outputApi
...@@ -13,7 +13,7 @@ Component({ ...@@ -13,7 +13,7 @@ Component({
properties: { properties: {
orderObj: { orderObj: {
type: Object, type: Object,
value: () => {}, value: () => { },
observer(n) { observer(n) {
n && this.dealStaffList() n && this.dealStaffList()
} }
...@@ -164,7 +164,7 @@ Component({ ...@@ -164,7 +164,7 @@ Component({
path: obj.path path: obj.path
}) })
}, },
fail() {} fail() { }
}) })
}) })
}, },
...@@ -176,7 +176,7 @@ Component({ ...@@ -176,7 +176,7 @@ Component({
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
// posterObj = this.selectComponent('#crowdPoster'), // posterObj = this.selectComponent('#crowdPoster'),
// { options } = wx.$router.getPageInstance() // { options } = wx.$router.getPageInstance()
const { options } = wx.$router.getPageInstance() // const { options } = wx.$router.getPageInstance()
// console.log(options) // console.log(options)
// try { // try {
// let flag = await posterObj.check(item) // let flag = await posterObj.check(item)
...@@ -213,7 +213,7 @@ Component({ ...@@ -213,7 +213,7 @@ Component({
this.triggerEvent('posterTrack') this.triggerEvent('posterTrack')
}, },
/**长按战报/喜报 */ /**长按战报/喜报 */
async handlePosterTouch(e) {}, async handlePosterTouch(e) { },
/**战报 */ /**战报 */
handleReport(e) { handleReport(e) {
const { item, idx } = e.currentTarget.dataset const { item, idx } = e.currentTarget.dataset
...@@ -227,10 +227,10 @@ Component({ ...@@ -227,10 +227,10 @@ Component({
return true return true
} }
var posterItem = { var posterItem = {
...item, ...item,
posterUrl: res.url, posterUrl: res.url,
updatedTime:deleteSecond( res.updatedDate) , updatedTime: deleteSecond(res.updatedDate),
type : 'warReport' type: 'warReport'
} }
this.setData({ this.setData({
crowdPosterItem: posterItem, crowdPosterItem: posterItem,
...@@ -249,26 +249,44 @@ Component({ ...@@ -249,26 +249,44 @@ Component({
/**喜报 */ /**喜报 */
handleXiReport(e) { handleXiReport(e) {
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
console.log(item); wx.$api.showLoading('喜报生成中')
if (!item.goodUrl) { outputApi
wx.$api.showToast('喜报生成失败') .getNewGoodUrl({ activityId: item.activityId })
return true .then(res => {
} if (!res.goodUrl) {
// console.log(item); wx.$api.showToast('喜报生成失败')
// debugger return true
var posterItem = { }
...item, var posterItem = {
posterUrl: item.goodUrl, ...item,
// date: item.goodReportDate, posterUrl: res.goodUrl,
updatedTime:deleteSecond( item.goodReportDate) , updatedTime: res.goodReportDate ? deleteSecond(res.goodReportDate) : '',
type : 'warReport' type: 'warReport'
} }
this.setData({ this.setData({
// posterItem: posterItem, crowdPosterItem: posterItem
// isShowPoster: true, })
crowdPosterItem: posterItem, wx.$api.hideLoading()
isShowTip: false })
}) .catch(() => {
wx.$api.showToast('下载喜报失败')
})
.finally(() => {
wx.$api.hideLoading()
})
// var posterItem = {
// ...item,
// posterUrl: item.goodUrl,
// // date: item.goodReportDate,
// updatedTime: deleteSecond(item.goodReportDate),
// type: 'warReport'
// }
// this.setData({
// // posterItem: posterItem,
// // isShowPoster: true,
// crowdPosterItem: posterItem,
// isShowTip: false
// })
} }
} }
}) })
<!-- packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.wxml --> <!-- packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.wxml -->
<wxs src="../../index.wxs" module="filter" /> <wxs src="../../index.wxs" module="filter" />
<view class="crowdfund-layout"> <view class="crowdfund-layout">
<view class="box order"> <view class="box order">
<view class="order-block" wx:for="{{orderFormList}}" wx:key="index"> <view class="order-block" wx:for="{{orderFormList}}" wx:key="index">
<view class="order-txt font-number"> <view class="order-txt font-number">
<text wx:if="{{item.prefix}}">{{item.prefix}}</text> <text wx:if="{{item.prefix}}">{{item.prefix}}</text>
{{filter.money_three_for_two_thousands(orderObj[item.name] || 0.00)}} {{filter.money_three_for_two_thousands(orderObj[item.name] || 0.00)}}
</view> </view>
<view class="order-label">{{item.label}}</view> <view class="order-label">{{item.label}}</view>
</view> </view>
</view> </view>
<view class="box merchant" wx:for="{{orderObj.activityList}}" wx:key="index"> <view class="box merchant" wx:for="{{orderObj.activityList}}" wx:key="index">
<view class="head"> <view class="head">
<!-- text-hide --> <!-- text-hide -->
<view class=" head-title" bindtap="handleJumpH5" data-item="{{item}}"> <view class=" head-title" bindtap="handleJumpH5" data-item="{{item}}">
{{item.activityName}} {{item.activityName}}
</view> </view>
<view class="head-link" bindtap="download" data-item="{{item}}"> <view class="head-link" bindtap="download" data-item="{{item}}">
<image src="{{IMAGES.download}}" class="downloadIcon" webp></image> <image src="{{IMAGES.download}}" class="downloadIcon" webp></image>
母链海报 母链海报
</view> </view>
<view class="down-tips" wx:if="{{index == 0 && isShowTip}}">下载活动海报分享给门店开展活动</view> <view class="down-tips" wx:if="{{index == 0 && isShowTip}}">下载活动海报分享给门店开展活动</view>
</view> </view>
<view class="content"> <view class="content">
<view <view class="content-row" wx:for="{{merchantFormList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
class="content-row" <view class="content-label">{{subItem.label}}</view>
wx:for="{{merchantFormList}}" <view class="content-txt {{subItem.className}}">
wx:for-item="subItem" <text wx:if="{{subItem.prefix}}">{{subItem.prefix}}</text>
wx:for-index="idx" {{subItem.isNumber ? filter.money_three_for_two_thousands(item[subItem.name]) : item[subItem.name]}}
wx:key="idx"> </view>
<view class="content-label">{{subItem.label}}</view> </view>
<view class="content-txt {{subItem.className}}"> <!-- 排名 -->
<text wx:if="{{subItem.prefix}}">{{subItem.prefix}}</text> <view class="content-rank" wx:if="{{item.showStaffList.length}}">
{{subItem.isNumber ? filter.money_three_for_two_thousands(item[subItem.name]) : item[subItem.name]}} <view class="rank-title">员工任务排名</view>
</view> <view class="rank-table">
</view> <view wx:for="{{item.showStaffList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
<!-- 排名 --> <view class="rank">
<view class="content-rank" wx:if="{{item.showStaffList.length}}"> <view class="rank-left">
<view class="rank-title">员工任务排名</view> <view class="rank-num">{{idx + 1}}</view>
<view class="rank-table"> <view class="rank-head">
<view <glsx-image wx:if="{{subItem.shareType == 1}}" class="icon-wechat" src="output/icon-wechat.webp" />
wx:for="{{item.showStaffList}}" <image wx:if="{{subItem.imageUrl}}" src="{{subItem.imageUrl}}" />
wx:for-item="subItem" <glsx-image wx:else src="output/icon-head.webp" />
wx:for-index="idx" </view>
wx:key="idx"> <view class="rank-content">
<view class="rank"> <view class="rank-row">
<view class="rank-left"> <!-- <text wx:if="{{subItem.goodUrl}}" class="rank-row-name text-hide" bindtap="handleXiReport" data-item="{{subItem}}">{{subItem.shareName}}</text> -->
<view class="rank-num">{{idx + 1}}</view> <text wx:if="{{subItem.goodUrl}}" class="rank-row-name text-hide">{{subItem.shareName}}</text>
<view class="rank-head"> <text wx:else class="name-disabled text-hide">{{subItem.shareName}}</text>
<glsx-image wx:if="{{subItem.shareType == 1}}" class="icon-wechat" src="output/icon-wechat.webp" /> <text class="rank-row-dept">{{subItem.departmentName || ''}}</text>
<image wx:if="{{subItem.imageUrl}}" src="{{subItem.imageUrl}}" /> </view>
<glsx-image wx:else src="output/icon-head.webp" /> <view class="rank-row">
</view> <text class="rank-row-txt">访客<text class="font-number">{{subItem.browseCount || 0}}</text>人</text>
<view class="rank-content"> <text class="rank-row-txt">成交<text class="font-number">{{subItem.dealCount || 0}}</text>单</text>
<view class="rank-row"> </view>
<text wx:if="{{subItem.goodUrl}}" class="rank-row-name text-hide" bindtap="handleXiReport" data-item="{{subItem}}">{{subItem.shareName}}</text> </view>
<text wx:else class="name-disabled text-hide" bindtap="handleXiReport" data-item="{{subItem}}">{{subItem.shareName}}</text> </view>
<view class="down-tips" wx:if="{{orderObj.staffIdx == index && idx == 0}}"> <view wx:if="{{subItem.totalAmount}}" class="rank-price txt-red font-number">
点击员工姓名看喜报 ¥ {{filter.money_three_for_two_thousands(subItem.totalAmount || 0.00)}}
</view> </view>
<text class="rank-row-dept">{{subItem.departmentName || ''}}</text> <view wx:else class="rank-price">暂无业绩</view>
</view> </view>
<view class="rank-row"> </view>
<text class="rank-row-txt">访客<text class="font-number">{{subItem.browseCount || 0}}</text>人</text> <view wx:if="{{item.staffList.length}}" class="btn-more" bindtap="handleMore" data-idx="{{index}}">
<text class="rank-row-txt">成交<text class="font-number">{{subItem.dealCount || 0}}</text>单</text> <glsx-image class="icon-more" src="output/icon-more.webp" />
</view> </view>
</view> </view>
</view> </view>
<view wx:if="{{subItem.totalAmount}}" class="rank-price txt-red font-number"> <!-- 诊断 -->
¥ {{filter.money_three_for_two_thousands(subItem.totalAmount || 0.00)}} <view class="content-suggest" wx:if="{{item.activityStatus == 2 && item.suggestTxtList.length}}">
</view> <view class="suggest-title"># 活动诊断</view>
<view wx:else class="rank-price">暂无业绩</view> <view class="suggest-txt">{{item.suggestTxt}}推荐以下建议:</view>
</view> <view class="suggest-block">
</view> <view class="suggest-step" wx:for="{{item.suggestList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
<view <view class="step-label">建议{{idx + 1}}</view>
wx:if="{{item.staffList.length}}" <view class="step-txt">{{subItem}}</view>
class="btn-more" </view>
bindtap="handleMore" </view>
data-idx="{{index}}"> </view>
<glsx-image class="icon-more" src="output/icon-more.webp" /> <!-- 战报 -->
</view> <view class="new-report" wx:if="{{item.activityStatus != 1}}">
</view> <view class="report-left" bindtap="handleReport" data-item="{{item}}" data-idx="{{index}}">生成最新战报</view>
</view> <view class="report-left" bindtap="handleXiReport" data-item="{{item}}" data-idx="{{index}}">生成最新喜报</view>
<!-- 诊断 --> </view>
<view class="content-suggest" wx:if="{{item.activityStatus == 2 && item.suggestTxtList.length}}"> </view>
<view class="suggest-title"># 活动诊断</view> </view>
<view class="suggest-txt">{{item.suggestTxt}}推荐以下建议:</view>
<view class="suggest-block">
<view
class="suggest-step"
wx:for="{{item.suggestList}}"
wx:for-item="subItem"
wx:for-index="idx"
wx:key="idx">
<view class="step-label">建议{{idx + 1}}</view>
<view class="step-txt">{{subItem}}</view>
</view>
</view>
</view>
<!-- 战报 -->
<view class="new-report" wx:if="{{item.activityStatus != 1}}">
<view
class="report-left"
bindtap="handleReport"
data-item="{{item}}"
data-idx="{{index}}">
<glsx-image class="icon-report" src="output/icon-report.webp" />
生成最新战报
</view>
<view wx:if="{{item.reportDate}}">最新更新:{{item.reportDate}}</view>
</view>
</view>
</view>
</view> </view>
<crowdfund-poster <crowdfund-poster item="{{crowdPosterItem}}" id="crowdPoster" scrollImg="{{false}}" bindlongtouch="longtouch" />
item="{{crowdPosterItem}}"
id="crowdPoster"
scrollImg="{{false}}"
bindlongtouch="longtouch" />
<!-- <poster <!-- <poster
posterItem="{{posterItem}}" posterItem="{{posterItem}}"
id="poster" id="poster"
show="{{isShowPoster}}" show="{{isShowPoster}}"
bindlongtouch="handlePosterTouch" /> --> bindlongtouch="handlePosterTouch" /> -->
\ No newline at end of file \ No newline at end of file
...@@ -158,7 +158,13 @@ Page({ ...@@ -158,7 +158,13 @@ Page({
} }
outputApi.getSceneProStatus(params).then(res => { outputApi.getSceneProStatus(params).then(res => {
var data = this.dealOpenActivity(res) var data = this.dealOpenActivity(res)
var sceneObj = {}
// sceneStatus:0未开通 1已开通
res.forEach((item, idx) => {
sceneObj['scene' + (idx + 1)] = item.sceneStatus == 1
})
this.setData({ this.setData({
sceneObj: sceneObj,
['sceneActivityObj.scene1']: data[0].productList, ['sceneActivityObj.scene1']: data[0].productList,
['sceneActivityObj.scene2']: data[1].productList, ['sceneActivityObj.scene2']: data[1].productList,
['sceneActivityObj.scene3']: data[2].productList, ['sceneActivityObj.scene3']: data[2].productList,
...@@ -308,13 +314,8 @@ Page({ ...@@ -308,13 +314,8 @@ Page({
if (curItem) { if (curItem) {
curItem.totalNum = curItem.activityList.length curItem.totalNum = curItem.activityList.length
curItem.shareBtnIdx = -1 curItem.shareBtnIdx = -1
curItem.staffIdx = -1
let shareFlag = false let shareFlag = false
curItem.activityList.forEach((k, kIdx) => { curItem.activityList.forEach((k, kIdx) => {
// 员工喜报
if (curItem.staffIdx == -1 && k.staffList?.length && k.staffList[0].imageUrl) {
curItem.staffIdx = kIdx
}
// 分享按钮判断shareStatus:活动分享状态 0:未分享 1:已分享 // 分享按钮判断shareStatus:活动分享状态 0:未分享 1:已分享
if (k.activityStatus == 2 && k.shareStatus == 0) { if (k.activityStatus == 2 && k.shareStatus == 0) {
curItem.shareBtnIdx = shareFlag ? -1 : kIdx + '' curItem.shareBtnIdx = shareFlag ? -1 : kIdx + ''
...@@ -407,21 +408,21 @@ Page({ ...@@ -407,21 +408,21 @@ Page({
// show: true // show: true
// }) // })
// } catch (error) { // } catch (error) {
wx.$api.showLoading('加载中...') wx.$api.showLoading('加载中...')
outputApi outputApi
.getPosterUrl({ .getPosterUrl({
id: item.activityId id: item.activityId
}) })
.then(res => { .then(res => {
item.posterUrl = res item.posterUrl = res
this.setData({ this.setData({
crowdPosterItem: item, crowdPosterItem: item,
isShowTip: false isShowTip: false
})
})
.catch(() => {
wx.$api.showToast('下载海报失败')
}) })
})
.catch(() => {
wx.$api.showToast('下载海报失败')
})
// } // }
}, },
/**长按海报 */ /**长按海报 */
...@@ -456,13 +457,13 @@ Page({ ...@@ -456,13 +457,13 @@ Page({
onLoad(options) { onLoad(options) {
this.initTime() this.initTime()
wx.$router.getData(obj => { wx.$router.getData(obj => {
var scene = {} // var scene = {}
Object.keys(this.data.sceneObj).forEach(item => { // Object.keys(this.data.sceneObj).forEach(item => {
scene[item] = obj[item] // scene[item] = obj[item]
}) // })
this.setData({ this.setData({
merchantInfo: obj, merchantInfo: obj,
sceneObj: scene, // sceneObj: scene,
sceneCodeList: obj.sceneCodeList sceneCodeList: obj.sceneCodeList
}) })
...@@ -477,5 +478,21 @@ Page({ ...@@ -477,5 +478,21 @@ Page({
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: this.data.merchantInfo.merchantName title: this.data.merchantInfo.merchantName
}) })
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.initTime()
this.setData({
activityActive: 0,
sceneActive: 4
})
wx.$api.showToast({
title: '刷新成功',
icon: 'success'
})
this.getSceneProStatus(this.data.sceneCodeList[this.data.sceneActive - 1], true)
} }
}) })
{ {
"enablePullDownRefresh": true,
"usingComponents": { "usingComponents": {
"scene-box": "../../../components/SceneBox/SceneBox", "scene-box": "../../../components/SceneBox/SceneBox",
"output-transform": "../components//outputTransform/outputTransform", "output-transform": "../components//outputTransform/outputTransform",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!