share.vue 17 KB

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