Commit 8b8bf267 by chenwq

喜报,下拉刷新

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