share.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  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. uni.navigateBack();
  254. },
  255. change(index) {
  256. this.current = index;
  257. this.loadData();
  258. },
  259. isImage(fileName) {
  260. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  261. const extension = fileName.split('.').pop().toLowerCase();
  262. return imageExtensions.includes(extension);
  263. },
  264. loadData() {
  265. let that = this;
  266. that.content = [];
  267. request.post('/slbResourceShare/show/my', {
  268. userNo: uni.getStorageSync('userNo'),
  269. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  270. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  271. limit: 1000,
  272. index: 1
  273. }).then(res => {
  274. let newList = res.list || [];
  275. if (res.success) {
  276. let newList = res.list || [];
  277. for (let i = 0; i < newList.length; i++) {
  278. newList[i].imgList = [];
  279. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  280. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  281. newList[i].imgList.push(newList[i].fileDetailList[j]);
  282. }
  283. }
  284. }
  285. that.content = newList;
  286. if (newList.length == 0) {
  287. that.showEmpty = true;
  288. } else {
  289. that.showEmpty = false;
  290. }
  291. }
  292. console.warn(res);
  293. })
  294. },
  295. showImg(items, index) {
  296. let urls = [];
  297. for (let i = 0; i < items.length; i++) {
  298. urls.push(items[i].ftpUrl);
  299. }
  300. // 预览图片
  301. uni.previewImage({
  302. urls: urls,
  303. current: index,
  304. });
  305. },
  306. clickLink(url,fileName) {
  307. // uni.navigateTo({
  308. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  309. // })
  310. uni.downloadFile({
  311. url: url,
  312. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  313. success: function (res) {
  314. const filePath = res.filePath
  315. uni.openDocument({
  316. filePath: filePath,
  317. showMenu: true,
  318. success: function (res) {
  319. console.log('打开文档成功')
  320. },
  321. fail: function(){
  322. uni.navigateTo({
  323. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  324. })
  325. }
  326. })
  327. }
  328. })
  329. // uni.navigateTo({
  330. // url:'/pages/webview/web-view?url='+url,
  331. // })
  332. },
  333. finishItem(item){
  334. let that = this;
  335. uniShowModal('下架提醒', '下架之后内容不再展示在我有什么页面里, 是否继续?', {
  336. showCancel: true,
  337. confirmText:'继续',
  338. success: (res) => {
  339. if(res.confirm){
  340. that.finishNext(item);
  341. }
  342. }
  343. })
  344. },
  345. clickModel(e){
  346. if(e.index==1){
  347. this.showModel = false;
  348. this.finishNext(this.curItem)
  349. }else{
  350. this.showModel = false;
  351. }
  352. },
  353. finishNext(item){
  354. let that = this;
  355. request.post('/slbResourceShare/offShelf', {
  356. id: item.id,
  357. userNo: uni.getStorageSync('userNo'),
  358. }).then(res => {
  359. if (res.success) {
  360. uni.showToast({
  361. title: '下架成功'
  362. })
  363. that.loadData();
  364. } else {
  365. uni.showToast({
  366. title: res.msg,
  367. icon: 'none'
  368. })
  369. }
  370. })
  371. },
  372. editItem(item){
  373. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  374. uni.navigateTo({
  375. url: '/circlePages/addShare?sid=' + item.bisNo,
  376. })
  377. }
  378. }
  379. }
  380. </script>
  381. <style lang="scss" scoped>
  382. /* 胶囊*/
  383. .tn-custom-nav-bar__back {
  384. width: 60%;
  385. height: 100%;
  386. position: relative;
  387. display: flex;
  388. justify-content: space-evenly;
  389. align-items: center;
  390. box-sizing: border-box;
  391. // background-color: rgba(0, 0, 0, 0.15);
  392. border-radius: 1000rpx;
  393. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  394. // color: #FFFFFF;
  395. font-size: 18px;
  396. .icon {
  397. display: block;
  398. flex: 1;
  399. margin: auto;
  400. text-align: center;
  401. }
  402. &:before {
  403. content: " ";
  404. width: 1rpx;
  405. height: 110%;
  406. position: absolute;
  407. top: 22.5%;
  408. left: 0;
  409. right: 0;
  410. margin: auto;
  411. transform: scale(0.5);
  412. transform-origin: 0 0;
  413. pointer-events: none;
  414. box-sizing: border-box;
  415. opacity: 0.7;
  416. background-color: #FFFFFF;
  417. }
  418. }
  419. /* 文章内容 start*/
  420. .blogger {
  421. &__item {
  422. padding: 30rpx;
  423. }
  424. &__author {
  425. &__btn {
  426. margin-right: -12rpx;
  427. opacity: 0.5;
  428. }
  429. }
  430. &__desc {
  431. line-height: 30rpx;
  432. &__label {
  433. color: #1D2541;
  434. background-color: #F3F2F7;
  435. border-radius: 10rpx;
  436. font-size: 22rpx;
  437. padding: 5rpx 15rpx;
  438. margin: 5rpx 18rpx 0 0;
  439. &--prefix {
  440. font-size: 24rpx;
  441. color: #1D2541;
  442. padding-right: 10rpx;
  443. }
  444. }
  445. &__content {
  446. line-height: 50rpx;
  447. }
  448. }
  449. &__content {
  450. margin-top: 18rpx;
  451. padding-right: 18rpx;
  452. &__data {
  453. line-height: 46rpx;
  454. text-align: justify;
  455. overflow: hidden;
  456. transition: all 0.25s ease-in-out;
  457. }
  458. &__status {
  459. margin-top: 10rpx;
  460. font-size: 26rpx;
  461. color: #82B2FF;
  462. }
  463. }
  464. &__main-image {
  465. border: 1rpx solid #F8F7F8;
  466. border-radius: 16rpx;
  467. &--1 {
  468. max-width: 80%;
  469. max-height: 300rpx;
  470. }
  471. &--2 {
  472. max-width: 260rpx;
  473. max-height: 260rpx;
  474. }
  475. &--3 {
  476. height: 212rpx;
  477. width: 100%;
  478. }
  479. }
  480. &__count-icon {
  481. font-size: 40rpx;
  482. padding-right: 5rpx;
  483. }
  484. &__ad {
  485. width: 100%;
  486. height: 500rpx;
  487. transform: translate3d(0px, 0px, 0px) !important;
  488. ::v-deep .uni-swiper-slide-frame {
  489. transform: translate3d(0px, 0px, 0px) !important;
  490. }
  491. .uni-swiper-slide-frame {
  492. transform: translate3d(0px, 0px, 0px) !important;
  493. }
  494. &__item {
  495. position: absolute;
  496. width: 100%;
  497. height: 100%;
  498. transform-origin: left center;
  499. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  500. transition: transform 0.25s ease-in-out;
  501. z-index: 1;
  502. &--0 {
  503. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  504. z-index: 4;
  505. }
  506. &--1 {
  507. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  508. z-index: 3;
  509. }
  510. &--2 {
  511. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  512. z-index: 2;
  513. }
  514. }
  515. &__content {
  516. border-radius: 40rpx;
  517. width: 640rpx;
  518. height: 500rpx;
  519. overflow: hidden;
  520. }
  521. &__image {
  522. width: 100%;
  523. height: 100%;
  524. }
  525. }
  526. }
  527. /* 文章内容 end*/
  528. /* 间隔线 start*/
  529. .tn-strip-bottom {
  530. width: 100%;
  531. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  532. }
  533. /* 间隔线 end*/
  534. </style>