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