share.vue 18 KB

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