share.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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 v-if="item.status==9&&item.feedback">
  165. <view>
  166. <view>
  167. 反馈意见:{{item.feedback||'--'}}
  168. </view>
  169. </view>
  170. </view>
  171. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  172. <view class="justify-content-item tn-color-gray tn-text-center">
  173. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  174. {{ item.createTime|formatDate }}
  175. </view>
  176. </view>
  177. <view class="justify-content-item tn-flex tn-flex-col-center">
  178. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.showFlag!='否'">
  179. <!-- <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> -->
  180. <button type="warn" plain="true" size="mini" @click="finishItem(item)">下架供应</button>
  181. </view>
  182. <view class="justify-content-item tn-flex tn-flex-col-center" v-if="item.status==1||item.status==9">
  183. <button type="warn" plain="true" size="mini" @click="editItem(item)">编辑</button>
  184. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" backgroundColor="tn-bg-blue"
  185. :fontSize="24" height="auto" padding="10rpx 18rpx"
  186. @click="finishItem(item)">结束需求</tn-button> -->
  187. </view>
  188. </view>
  189. </view>
  190. </view>
  191. <!-- 边距间隔 -->
  192. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  193. </block>
  194. <!-- 边距间隔 -->
  195. <!-- <view class="tn-strip-bottom"></view> -->
  196. <!-- 广告 -->
  197. </view>
  198. </view>
  199. <tn-modal v-model="showModel" @click="clickModel" :title="titleModel" :content="contentModel" :button="buttonModel"></tn-modal>
  200. <view class='tn-tabbar-height'></view>
  201. <view v-if="showEmpty" style="margin-top: 32vh;">
  202. <tn-empty mode="data"></tn-empty>
  203. </view>
  204. </view>
  205. </template>
  206. <script>
  207. import request from '../../utils/request'
  208. export default {
  209. data() {
  210. return {
  211. showModel:false,
  212. titleModel:'下架供应提示',
  213. contentModel:'下架之后内容不再展示在供应页面里, 是否继续?',
  214. buttonModel:[{
  215. text: '取消',
  216. plain: true,
  217. shape: 'round'
  218. },
  219. {
  220. text: '继续',
  221. backgroundColor: 'tn-bg-indigo',
  222. fontColor: '#FFFFFF'
  223. }],
  224. list: [{
  225. 'tab-name': '已通过'
  226. }, {
  227. 'tab-name': '审核中'
  228. }, {
  229. 'tab-name': '暂存'
  230. }, {
  231. 'tab-name': '已拒绝'
  232. }],
  233. current: 0,
  234. showEmpty: false,
  235. content:[],
  236. curItem:{},
  237. columns: [{
  238. fieldName: 'prodName',
  239. fieldDesc: '产品名称',
  240. }, {
  241. fieldName: 'prodSpec',
  242. fieldDesc: '规格型号',
  243. }, {
  244. fieldName: 'prodDesc',
  245. fieldDesc: '产品介绍',
  246. }],
  247. }
  248. },
  249. filters: {
  250. formatDate(value) {
  251. if (!value) return '';
  252. const date = new Date(value);
  253. const today = new Date();
  254. const yesterday = new Date(today); // 昨天的日期
  255. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  256. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  257. today.getDate()) {
  258. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  259. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  260. }
  261. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  262. .getDate() == yesterday.getDate()) {
  263. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  264. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  265. }
  266. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  267. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  268. },
  269. },
  270. onLoad(props){
  271. if(props.tab==1){
  272. this.current= 1;
  273. }
  274. if(props.tab==2){
  275. this.current= 2;
  276. }
  277. },
  278. onShow() {
  279. this.loadData();
  280. },
  281. methods: {
  282. goBack() {
  283. uni.navigateBack();
  284. },
  285. change(index) {
  286. this.current = index;
  287. this.loadData();
  288. },
  289. isImage(fileName) {
  290. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  291. const extension = fileName.split('.').pop().toLowerCase();
  292. return imageExtensions.includes(extension);
  293. },
  294. loadData() {
  295. let that = this;
  296. that.content = [];
  297. request.post('/slbResourceShare/show/my', {
  298. userNo: uni.getStorageSync('userNo'),
  299. // 状态(1:暂存,2:待处理,3:审核中,4:已通过,9:已拒绝,10:已取消)
  300. status: that.current == 1 ? '3' : that.current == 2 ? '1' : that.current == 3 ? '9' : '4',
  301. }).then(res => {
  302. let newList = res.list || [];
  303. if (res.success) {
  304. let newList = res.list || [];
  305. for (let i = 0; i < newList.length; i++) {
  306. newList[i].imgList = [];
  307. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  308. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  309. newList[i].imgList.push(newList[i].fileDetailList[j]);
  310. }
  311. }
  312. }
  313. that.content = newList;
  314. if (newList.length == 0) {
  315. that.showEmpty = true;
  316. } else {
  317. that.showEmpty = false;
  318. }
  319. }
  320. console.warn(res);
  321. })
  322. },
  323. showImg(items, index) {
  324. let urls = [];
  325. for (let i = 0; i < items.length; i++) {
  326. urls.push(items[i].ftpUrl);
  327. }
  328. // 预览图片
  329. uni.previewImage({
  330. urls: urls,
  331. current: index,
  332. });
  333. },
  334. clickLink(url,fileName) {
  335. uni.navigateTo({
  336. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  337. })
  338. // uni.navigateTo({
  339. // url:'/pages/webview/web-view?url='+url,
  340. // })
  341. },
  342. finishItem(item){
  343. this.curItem = item;
  344. this.showModel = true;
  345. return false;
  346. },
  347. clickModel(e){
  348. if(e.index==1){
  349. this.showModel = false;
  350. this.finishNext(this.curItem)
  351. }else{
  352. this.showModel = false;
  353. }
  354. },
  355. finishNext(item){
  356. let that = this;
  357. request.post('/slbResourceShare/offShelf', {
  358. id: item.id,
  359. userNo: uni.getStorageSync('userNo'),
  360. }).then(res => {
  361. if (res.success) {
  362. uni.showToast({
  363. title: '下架成功'
  364. })
  365. that.loadData();
  366. } else {
  367. uni.showToast({
  368. title: res.msg,
  369. icon: 'none'
  370. })
  371. }
  372. })
  373. },
  374. editItem(item){
  375. uni.setStorageSync(item.bisNo,JSON.stringify(item))
  376. uni.navigateTo({
  377. url: '/circlePages/addShare?sid=' + item.bisNo,
  378. })
  379. }
  380. }
  381. }
  382. </script>
  383. <style lang="scss" scoped>
  384. /* 胶囊*/
  385. .tn-custom-nav-bar__back {
  386. width: 60%;
  387. height: 100%;
  388. position: relative;
  389. display: flex;
  390. justify-content: space-evenly;
  391. align-items: center;
  392. box-sizing: border-box;
  393. // background-color: rgba(0, 0, 0, 0.15);
  394. border-radius: 1000rpx;
  395. // border: 1rpx solid rgba(255, 255, 255, 0.5);
  396. // color: #FFFFFF;
  397. font-size: 18px;
  398. .icon {
  399. display: block;
  400. flex: 1;
  401. margin: auto;
  402. text-align: center;
  403. }
  404. &:before {
  405. content: " ";
  406. width: 1rpx;
  407. height: 110%;
  408. position: absolute;
  409. top: 22.5%;
  410. left: 0;
  411. right: 0;
  412. margin: auto;
  413. transform: scale(0.5);
  414. transform-origin: 0 0;
  415. pointer-events: none;
  416. box-sizing: border-box;
  417. opacity: 0.7;
  418. background-color: #FFFFFF;
  419. }
  420. }
  421. /* 文章内容 start*/
  422. .blogger {
  423. &__item {
  424. padding: 30rpx;
  425. }
  426. &__author {
  427. &__btn {
  428. margin-right: -12rpx;
  429. opacity: 0.5;
  430. }
  431. }
  432. &__desc {
  433. line-height: 30rpx;
  434. &__label {
  435. color: #1D2541;
  436. background-color: #F3F2F7;
  437. border-radius: 10rpx;
  438. font-size: 22rpx;
  439. padding: 5rpx 15rpx;
  440. margin: 5rpx 18rpx 0 0;
  441. &--prefix {
  442. font-size: 24rpx;
  443. color: #1D2541;
  444. padding-right: 10rpx;
  445. }
  446. }
  447. &__content {
  448. line-height: 50rpx;
  449. }
  450. }
  451. &__content {
  452. margin-top: 18rpx;
  453. padding-right: 18rpx;
  454. &__data {
  455. line-height: 46rpx;
  456. text-align: justify;
  457. overflow: hidden;
  458. transition: all 0.25s ease-in-out;
  459. }
  460. &__status {
  461. margin-top: 10rpx;
  462. font-size: 26rpx;
  463. color: #82B2FF;
  464. }
  465. }
  466. &__main-image {
  467. border: 1rpx solid #F8F7F8;
  468. border-radius: 16rpx;
  469. &--1 {
  470. max-width: 80%;
  471. max-height: 300rpx;
  472. }
  473. &--2 {
  474. max-width: 260rpx;
  475. max-height: 260rpx;
  476. }
  477. &--3 {
  478. height: 212rpx;
  479. width: 100%;
  480. }
  481. }
  482. &__count-icon {
  483. font-size: 40rpx;
  484. padding-right: 5rpx;
  485. }
  486. &__ad {
  487. width: 100%;
  488. height: 500rpx;
  489. transform: translate3d(0px, 0px, 0px) !important;
  490. ::v-deep .uni-swiper-slide-frame {
  491. transform: translate3d(0px, 0px, 0px) !important;
  492. }
  493. .uni-swiper-slide-frame {
  494. transform: translate3d(0px, 0px, 0px) !important;
  495. }
  496. &__item {
  497. position: absolute;
  498. width: 100%;
  499. height: 100%;
  500. transform-origin: left center;
  501. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  502. transition: transform 0.25s ease-in-out;
  503. z-index: 1;
  504. &--0 {
  505. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  506. z-index: 4;
  507. }
  508. &--1 {
  509. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  510. z-index: 3;
  511. }
  512. &--2 {
  513. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  514. z-index: 2;
  515. }
  516. }
  517. &__content {
  518. border-radius: 40rpx;
  519. width: 640rpx;
  520. height: 500rpx;
  521. overflow: hidden;
  522. }
  523. &__image {
  524. width: 100%;
  525. height: 100%;
  526. }
  527. }
  528. }
  529. /* 文章内容 end*/
  530. /* 间隔线 start*/
  531. .tn-strip-bottom {
  532. width: 100%;
  533. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  534. }
  535. /* 间隔线 end*/
  536. </style>