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
...@@ -229,8 +229,8 @@ Component({ ...@@ -229,8 +229,8 @@ Component({
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
.getNewGoodUrl({ activityId: item.activityId })
.then(res => {
if (!res.goodUrl) {
wx.$api.showToast('喜报生成失败') wx.$api.showToast('喜报生成失败')
return true return true
} }
// console.log(item);
// debugger
var posterItem = { var posterItem = {
...item, ...item,
posterUrl: item.goodUrl, posterUrl: res.goodUrl,
// date: item.goodReportDate, updatedTime: res.goodReportDate ? deleteSecond(res.goodReportDate) : '',
updatedTime:deleteSecond( item.goodReportDate) , type: 'warReport'
type : 'warReport'
} }
this.setData({ this.setData({
// posterItem: posterItem, crowdPosterItem: posterItem
// isShowPoster: true,
crowdPosterItem: posterItem,
isShowTip: false
}) })
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
// })
} }
} }
}) })
...@@ -23,12 +23,7 @@ ...@@ -23,12 +23,7 @@
<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"
wx:for="{{merchantFormList}}"
wx:for-item="subItem"
wx:for-index="idx"
wx:key="idx">
<view class="content-label">{{subItem.label}}</view> <view class="content-label">{{subItem.label}}</view>
<view class="content-txt {{subItem.className}}"> <view class="content-txt {{subItem.className}}">
<text wx:if="{{subItem.prefix}}">{{subItem.prefix}}</text> <text wx:if="{{subItem.prefix}}">{{subItem.prefix}}</text>
...@@ -39,11 +34,7 @@ ...@@ -39,11 +34,7 @@
<view class="content-rank" wx:if="{{item.showStaffList.length}}"> <view class="content-rank" wx:if="{{item.showStaffList.length}}">
<view class="rank-title">员工任务排名</view> <view class="rank-title">员工任务排名</view>
<view class="rank-table"> <view class="rank-table">
<view <view wx:for="{{item.showStaffList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
wx:for="{{item.showStaffList}}"
wx:for-item="subItem"
wx:for-index="idx"
wx:key="idx">
<view class="rank"> <view class="rank">
<view class="rank-left"> <view class="rank-left">
<view class="rank-num">{{idx + 1}}</view> <view class="rank-num">{{idx + 1}}</view>
...@@ -54,11 +45,9 @@ ...@@ -54,11 +45,9 @@
</view> </view>
<view class="rank-content"> <view class="rank-content">
<view class="rank-row"> <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" bindtap="handleXiReport" data-item="{{subItem}}">{{subItem.shareName}}</text> -->
<text wx:else class="name-disabled text-hide" bindtap="handleXiReport" data-item="{{subItem}}">{{subItem.shareName}}</text> <text wx:if="{{subItem.goodUrl}}" class="rank-row-name text-hide">{{subItem.shareName}}</text>
<view class="down-tips" wx:if="{{orderObj.staffIdx == index && idx == 0}}"> <text wx:else class="name-disabled text-hide">{{subItem.shareName}}</text>
点击员工姓名看喜报
</view>
<text class="rank-row-dept">{{subItem.departmentName || ''}}</text> <text class="rank-row-dept">{{subItem.departmentName || ''}}</text>
</view> </view>
<view class="rank-row"> <view class="rank-row">
...@@ -73,11 +62,7 @@ ...@@ -73,11 +62,7 @@
<view wx:else class="rank-price">暂无业绩</view> <view wx:else class="rank-price">暂无业绩</view>
</view> </view>
</view> </view>
<view <view wx:if="{{item.staffList.length}}" class="btn-more" bindtap="handleMore" data-idx="{{index}}">
wx:if="{{item.staffList.length}}"
class="btn-more"
bindtap="handleMore"
data-idx="{{index}}">
<glsx-image class="icon-more" src="output/icon-more.webp" /> <glsx-image class="icon-more" src="output/icon-more.webp" />
</view> </view>
</view> </view>
...@@ -87,12 +72,7 @@ ...@@ -87,12 +72,7 @@
<view class="suggest-title"># 活动诊断</view> <view class="suggest-title"># 活动诊断</view>
<view class="suggest-txt">{{item.suggestTxt}}推荐以下建议:</view> <view class="suggest-txt">{{item.suggestTxt}}推荐以下建议:</view>
<view class="suggest-block"> <view class="suggest-block">
<view <view class="suggest-step" wx:for="{{item.suggestList}}" wx:for-item="subItem" wx:for-index="idx" wx:key="idx">
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-label">建议{{idx + 1}}</view>
<view class="step-txt">{{subItem}}</view> <view class="step-txt">{{subItem}}</view>
</view> </view>
...@@ -100,27 +80,15 @@ ...@@ -100,27 +80,15 @@
</view> </view>
<!-- 战报 --> <!-- 战报 -->
<view class="new-report" wx:if="{{item.activityStatus != 1}}"> <view class="new-report" wx:if="{{item.activityStatus != 1}}">
<view <view class="report-left" bindtap="handleReport" data-item="{{item}}" data-idx="{{index}}">生成最新战报</view>
class="report-left" <view class="report-left" bindtap="handleXiReport" data-item="{{item}}" data-idx="{{index}}">生成最新喜报</view>
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> </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 + ''
...@@ -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!