share.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <view>
  3. <tn-nav-bar fixed customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
  5. <text class='icon tn-icon-left'></text>
  6. </view>
  7. <view slot="default">
  8. <text :style="{fontSize:(wxFontSize)+'px'}">我的供应</text>
  9. </view>
  10. </tn-nav-bar>
  11. <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  12. <uv-sticky :offsetTop="vuex_custom_bar_height + 'px'" bgColor="#ffffff">
  13. <tn-tabs-swiper :list="list" :isScroll="false" :current="current" name="tab-name"
  14. @change="change" style="border-bottom: 1rpx solid #f1f1f1cc;" :fontSize="(wxFontSize+12)" :barWidth="wxFontSize+50"></tn-tabs-swiper>
  15. </uv-sticky>
  16. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm tn-margin-bottom">
  17. <!-- 图文信息 -->
  18. <block v-for="(item,index) in content">
  19. <view class="blogger__item" :key="index">
  20. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  21. <view class="justify__author__info" @click="tn('')">
  22. <view class="tn-flex tn-flex-row-center">
  23. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  24. <view class="tn-padding-right tn-text-ellipsis">
  25. <view class="tn-padding-right tn-text-bold tn-text-lg" :style="{fontSize:(wxFontSize)+'px'}">
  26. {{ item.company||(item.contactNickName||item.contactPerson)}} </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消) -->
  32. <view v-if="item.status=='1'"
  33. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  34. <text class="" style="background: #3F51B542;font-size: 12px;
  35. padding: 8px;
  36. color: #333333;
  37. border-radius: 24px;
  38. " :style="{fontSize:(wxFontSize-6)+'px'}">暂存</text>
  39. </view>
  40. <view v-if="item.status=='3'"
  41. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  42. <text class="" style="background: #3f51b56b;font-size: 12px;
  43. padding: 8px;
  44. color: #ff0;
  45. border-radius: 24px;
  46. " :style="{fontSize:(wxFontSize-6)+'px'}">审核中</text>
  47. </view>
  48. <view v-if="item.status=='4'&&item.showFlag!='否'"
  49. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  50. <text class="" style="background: #3F51B542;font-size: 12px;
  51. padding: 8px;
  52. color: #007000;
  53. border-radius: 24px;
  54. " :style="{fontSize:(wxFontSize-6)+'px'}">已通过</text>
  55. </view>
  56. <view v-if="item.status=='9'"
  57. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  58. <text class="" style="background: #3F51B542;font-size: 12px;
  59. padding: 8px;
  60. color: #d23920;
  61. border-radius: 24px;
  62. " @click="showTips(item)" :style="{fontSize:(wxFontSize-6)+'px'}">已拒绝</text>
  63. </view>
  64. <view v-if="item.status=='10'"
  65. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  66. <text class="" style="background: #3F51B542;font-size: 12px;
  67. padding: 8px;
  68. color: #333333;
  69. border-radius: 24px;
  70. " :style="{fontSize:(wxFontSize-6)+'px'}">已取消</text>
  71. </view>
  72. <view v-if="item.status=='4'&&item.showFlag=='否'"
  73. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  74. <text class="" style="background: #3F51B542;font-size: 12px;
  75. padding: 8px;
  76. color: #333333;
  77. border-radius: 24px;
  78. " :style="{fontSize:(wxFontSize-6)+'px'}">已下架</text>
  79. </view>
  80. </view>
  81. <view
  82. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  83. @click="tn('')">
  84. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand" fontColor="#3a96d7" shape="circle" :fontSize="wxFontSize+11">{{ item.brand }}</tn-tag>
  85. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  86. fontColor="#3a96d7" shape="circle" :fontSize="wxFontSize+11">个人</tn-tag>
  87. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  88. <text v-if="item.content"
  89. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df" :style="{fontSize:(wxFontSize-2)+'px'}">{{ item.content }}</text>
  90. </view>
  91. <!-- 内容太多疲劳了-->
  92. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  93. :id="`blogger__content--${index}`">
  94. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true" :fontSize="(wxFontSize-3)"
  95. :stripe="true" :data="item.shareExt">
  96. </basic-table>
  97. </view>
  98. <block v-if="item.imgList">
  99. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  100. @click="tn('')">
  101. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  102. class="blogger__main-image" :class="{
  103. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  104. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  105. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  106. </view>
  107. <view v-else class="tn-padding-top-xs">
  108. <tn-grid hoverClass="none" :col="3">
  109. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  110. <!-- #ifndef MP-WEIXIN -->
  111. <tn-grid-item style="width: 30%;margin: 10rpx;">
  112. <image class="blogger__main-image blogger__main-image--3"
  113. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  114. </tn-grid-item>
  115. <!-- #endif-->
  116. <!-- #ifdef MP-WEIXIN -->
  117. <tn-grid-item style="width: 30%;margin: 10rpx;">
  118. <image class="blogger__main-image blogger__main-image--3"
  119. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  120. </tn-grid-item>
  121. <!-- #endif-->
  122. </block>
  123. </tn-grid>
  124. </view>
  125. </block>
  126. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  127. <view>
  128. <text class="tn-icon-link" :style="{fontSize:(wxFontSize-4)+'px'}"></text>
  129. <view style="display: inline;margin-left:8px" @click="clickLink(file.ftpUrl,file.fileName)" :style="{fontSize:(wxFontSize-3)+'px'}">
  130. {{file.fileName}}</view>
  131. </view>
  132. </view>
  133. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  134. <view class="justify-content-item tn-color-gray tn-text-center">
  135. <view class="tn-padding-right tn-padding-top-xs tn-color-gray" style="display: flex;">
  136. <view style="white-space: nowrap;">{{ item.createTime|formatDate }}</view>
  137. <view v-if="item.status==9&&item.feedback" style="color: red;margin-left:8px;" :style="{fontSize:(wxFontSize-3)+'px'}">
  138. 反馈意见:{{item.feedback||'--'}}
  139. </view>
  140. </view>
  141. </view>
  142. <view class="justify-content-item tn-flex tn-flex-col-center">
  143. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.status==4&&item.showFlag!='否'">
  144. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue" :fontSize="24" height="auto" padding="10rpx 18rpx" @click="finishItem(item)">下架</tn-button> -->
  145. <button type="warn" plain="true" size="mini" @click="finishItem(item)">下架供应</button>
  146. </view>
  147. <view class="justify-content-item tn-flex tn-flex-col-center" style="flex:none" v-if="item.status==1||item.status==9">
  148. <button type="warn" plain="true" size="mini" @click="editItem(item)">编辑</button>
  149. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  150. :fontSize="24" height="auto" padding="10rpx 18rpx"
  151. @click="finishItem(item)">结束需求</tn-button> -->
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- 边距间隔 -->
  157. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  158. </block>
  159. <!-- 边距间隔 -->
  160. <!-- <view class="tn-strip-bottom"></view> -->
  161. </view>
  162. </view>
  163. <tn-modal v-model="showModel" @click="clickModel" :title="titleModel" :content="contentModel" :button="buttonModel"></tn-modal>
  164. <view class='tn-tabbar-height'></view>
  165. <view v-if="showEmpty" style="margin-top: 32vh;">
  166. <tn-empty mode="data"></tn-empty>
  167. </view>
  168. </view>
  169. </template>
  170. <script>
  171. import request from '../../utils/request'
  172. import {
  173. uniShowModal
  174. } from '../../utils/uni_api'
  175. export default {
  176. data() {
  177. return {
  178. showModel:false,
  179. titleModel:'下架供应提示',
  180. contentModel:'下架之后内容不再展示在供应页面里, 是否继续?',
  181. buttonModel:[{
  182. text: '取消',
  183. plain: true,
  184. shape: 'round'
  185. },
  186. {
  187. text: '继续',
  188. backgroundColor: 'tn-bg-indigo',
  189. fontColor: '#FFFFFF'
  190. }],
  191. list: [{
  192. 'tab-name': '已通过'
  193. }, {
  194. 'tab-name': '审核中'
  195. }, {
  196. 'tab-name': '暂存'
  197. }, {
  198. 'tab-name': '已拒绝'
  199. }],
  200. current: 0,
  201. showEmpty: false,
  202. content:[],
  203. curItem:{},
  204. columns: [{
  205. fieldName: 'prodName',
  206. fieldDesc: '产品名称',
  207. }, {
  208. fieldName: 'prodSpec',
  209. fieldDesc: '产品型号',
  210. }, {
  211. fieldName: 'prodDesc',
  212. fieldDesc: '产品介绍',
  213. }],
  214. wxFontSize:17
  215. }
  216. },
  217. filters: {
  218. formatDate(value) {
  219. if (!value) return '';
  220. const date = new Date(value);
  221. const today = new Date();
  222. const yesterday = new Date(today); // 昨天的日期
  223. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  224. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  225. today.getDate()) {
  226. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  227. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  228. }
  229. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  230. .getDate() == yesterday.getDate()) {
  231. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  232. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  233. }
  234. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  235. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  236. },
  237. },
  238. onLoad(props){
  239. const appBaseInfo = wx.getAppBaseInfo();
  240. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  241. if(props.tab==1){
  242. this.current= 1;
  243. }
  244. if(props.tab==2){
  245. this.current= 2;
  246. }
  247. },
  248. onShow() {
  249. this.loadData();
  250. },
  251. methods: {
  252. goBack() {
  253. const pages = getCurrentPages()
  254. // 有可返回的页面则直接返回,uni.navigateBack 默认返回失败之后会自动刷新页面 ,无法继续返回
  255. if (pages.length > 1) {
  256. uni.navigateBack()
  257. return;
  258. }else{
  259. uni.navigateTo({
  260. url: '/pages/index/index'
  261. })
  262. }
  263. },
  264. change(index) {
  265. this.current = index;
  266. this.loadData();
  267. },
  268. isImage(fileName) {
  269. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  270. const extension = fileName.split('.').pop().toLowerCase();
  271. return imageExtensions.includes(extension);
  272. },
  273. loadData() {
  274. let that = this;
  275. that.content = [];
  276. request.post('/slbResourceShare/show/my', {
  277. userNo: uni.getStorageSync('userNo'),
  278. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  279. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  280. limit: 1000,
  281. index: 1
  282. }).then(res => {
  283. let newList = res.list || [];
  284. if (res.success) {
  285. let newList = res.list || [];
  286. for (let i = 0; i < newList.length; i++) {
  287. newList[i].imgList = [];
  288. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  289. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  290. newList[i].imgList.push(newList[i].fileDetailList[j]);
  291. }
  292. }
  293. }
  294. that.content = newList;
  295. if (newList.length == 0) {
  296. that.showEmpty = true;
  297. } else {
  298. that.showEmpty = false;
  299. }
  300. }else{
  301. if(res._redirect){
  302. uni.showToast({
  303. title: '操作过期,请重试',
  304. duration: 2000,
  305. icon:'none'
  306. });
  307. that.goBack();
  308. }
  309. }
  310. })
  311. },
  312. showImg(items, index) {
  313. let urls = [];
  314. for (let i = 0; i < items.length; i++) {
  315. urls.push(items[i].ftpUrl);
  316. }
  317. // 预览图片
  318. uni.previewImage({
  319. urls: urls,
  320. current: index,
  321. });
  322. },
  323. clickLink(url,fileName) {
  324. // uni.navigateTo({
  325. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  326. // })
  327. uni.downloadFile({
  328. url: url,
  329. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  330. success: function (res) {
  331. const filePath = res.filePath
  332. uni.openDocument({
  333. filePath: filePath,
  334. showMenu: true,
  335. success: function (res) {
  336. console.log('打开文档成功')
  337. },
  338. fail: function(){
  339. uni.navigateTo({
  340. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  341. })
  342. }
  343. })
  344. }
  345. })
  346. // uni.navigateTo({
  347. // url:'/pages/webview/web-view?url='+url,
  348. // })
  349. },
  350. finishItem(item){
  351. let that = this;
  352. uniShowModal('下架提醒', '下架之后内容不再展示在我有什么页面里, 是否继续?', {
  353. showCancel: true,
  354. confirmText:'继续',
  355. success: (res) => {
  356. if(res.confirm){
  357. that.finishNext(item);
  358. }
  359. }
  360. })
  361. },
  362. clickModel(e){
  363. if(e.index==1){
  364. this.showModel = false;
  365. this.finishNext(this.curItem)
  366. }else{
  367. this.showModel = false;
  368. }
  369. },
  370. finishNext(item){
  371. let that = this;
  372. request.post('/slbResourceShare/offShelf', {
  373. id: item.id,
  374. userNo: uni.getStorageSync('userNo'),
  375. }).then(res => {
  376. if (res.success) {
  377. uni.showToast({
  378. title: '下架成功'
  379. })
  380. that.loadData();
  381. } else {
  382. uni.showToast({
  383. title: res.msg,
  384. icon: 'none'
  385. })
  386. }
  387. })
  388. },
  389. editItem(item){
  390. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  391. uni.navigateTo({
  392. url: '/circlePages/addShare?sid=' + item.bisNo,
  393. })
  394. }
  395. }
  396. }
  397. </script>
  398. <style lang="scss" scoped>
  399. /* 胶囊*/
  400. .tn-custom-nav-bar__back {
  401. width: 60%;
  402. height: 100%;
  403. position: relative;
  404. display: flex;
  405. justify-content: space-evenly;
  406. align-items: center;
  407. box-sizing: border-box;
  408. // background-color: rgba(0, 0, 0, 0.15);
  409. border-radius: 1000rpx;
  410. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  411. // color: #FFFFFF;
  412. font-size: 18px;
  413. .icon {
  414. display: block;
  415. flex: 1;
  416. margin: auto;
  417. text-align: center;
  418. }
  419. &:before {
  420. content: " ";
  421. width: 1rpx;
  422. height: 110%;
  423. position: absolute;
  424. top: 22.5%;
  425. left: 0;
  426. right: 0;
  427. margin: auto;
  428. transform: scale(0.5);
  429. transform-origin: 0 0;
  430. pointer-events: none;
  431. box-sizing: border-box;
  432. opacity: 0.7;
  433. background-color: #FFFFFF;
  434. }
  435. }
  436. /* 文章内容 start*/
  437. .blogger {
  438. &__item {
  439. padding: 30rpx;
  440. }
  441. &__author {
  442. &__btn {
  443. margin-right: -12rpx;
  444. opacity: 0.5;
  445. }
  446. }
  447. &__desc {
  448. line-height: 30rpx;
  449. &__label {
  450. color: #1D2541;
  451. background-color: #F3F2F7;
  452. border-radius: 10rpx;
  453. font-size: 22rpx;
  454. padding: 5rpx 15rpx;
  455. margin: 5rpx 18rpx 0 0;
  456. &--prefix {
  457. font-size: 24rpx;
  458. color: #1D2541;
  459. padding-right: 10rpx;
  460. }
  461. }
  462. &__content {
  463. line-height: 50rpx;
  464. }
  465. }
  466. &__content {
  467. margin-top: 18rpx;
  468. padding-right: 18rpx;
  469. &__data {
  470. line-height: 46rpx;
  471. text-align: justify;
  472. overflow: hidden;
  473. transition: all 0.25s ease-in-out;
  474. }
  475. &__status {
  476. margin-top: 10rpx;
  477. font-size: 26rpx;
  478. color: #82B2FF;
  479. }
  480. }
  481. &__main-image {
  482. border: 1rpx solid #F8F7F8;
  483. border-radius: 16rpx;
  484. &--1 {
  485. max-width: 80%;
  486. max-height: 300rpx;
  487. }
  488. &--2 {
  489. max-width: 260rpx;
  490. max-height: 260rpx;
  491. }
  492. &--3 {
  493. height: 212rpx;
  494. width: 100%;
  495. }
  496. }
  497. &__count-icon {
  498. font-size: 40rpx;
  499. padding-right: 5rpx;
  500. }
  501. &__ad {
  502. width: 100%;
  503. height: 500rpx;
  504. transform: translate3d(0px, 0px, 0px) !important;
  505. ::v-deep .uni-swiper-slide-frame {
  506. transform: translate3d(0px, 0px, 0px) !important;
  507. }
  508. .uni-swiper-slide-frame {
  509. transform: translate3d(0px, 0px, 0px) !important;
  510. }
  511. &__item {
  512. position: absolute;
  513. width: 100%;
  514. height: 100%;
  515. transform-origin: left center;
  516. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  517. transition: transform 0.25s ease-in-out;
  518. z-index: 1;
  519. &--0 {
  520. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  521. z-index: 4;
  522. }
  523. &--1 {
  524. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  525. z-index: 3;
  526. }
  527. &--2 {
  528. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  529. z-index: 2;
  530. }
  531. }
  532. &__content {
  533. border-radius: 40rpx;
  534. width: 640rpx;
  535. height: 500rpx;
  536. overflow: hidden;
  537. }
  538. &__image {
  539. width: 100%;
  540. height: 100%;
  541. }
  542. }
  543. }
  544. /* 文章内容 end*/
  545. /* 间隔线 start*/
  546. .tn-strip-bottom {
  547. width: 100%;
  548. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  549. }
  550. /* 间隔线 end*/
  551. </style>