share.vue 18 KB

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