wdemandlist.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav solid-bottom solid-bottom echo-fixed-top">
  4. <view class="flex text-center">
  5. <view class="cu-item flex-sub" :class="status==0?'text-red cur':''" @tap="tabSelect" data-status="0">全部</view>
  6. <view class="cu-item flex-sub" :class="status==1?'text-red cur':''" @tap="tabSelect" data-status="1">待修改</view>
  7. <view class="cu-item flex-sub" :class="status==2?'text-red cur':''" @tap="tabSelect" data-status="2">待审核</view>
  8. <view class="cu-item flex-sub" :class="status==3?'text-red cur':''" @tap="tabSelect" data-status="3">已上架</view>
  9. <view class="cu-item flex-sub" :class="status==4?'text-red cur':''" @tap="tabSelect" data-status="4">已停招</view>
  10. <view class="cu-item flex-sub" :class="status==5?'text-red cur':''" @tap="tabSelect" data-status="5">已下架</view>
  11. </view>
  12. </scroll-view>
  13. <view class="echo-fixed-top-empty"></view>
  14. <block v-for="(item,index) in plist" :key="index">
  15. <view class="cu-card dynamic no-card solid-bottom echo-demand-item margin-tb-sm">
  16. <view class="cu-item shadow padding-top-sm padding-bottom">
  17. <view class="padding-lr padding-bottom-xs flex justify-between align-center">
  18. <view class="basis-xl text-bold text-lg text-cut">{{item.title}}</view>
  19. <view class="basis-xs text-cut text-right text-gray text-sm">{{item.city}}</view>
  20. </view>
  21. <view class="padding-lr flex justify-between align-bottom">
  22. <view v-if="item.wtype==1"><text class="text-red text-bold">{{item.zwagall}}</text></view>
  23. <view v-if="item.wtype==5"><text class="text-red text-bold">其他</text></view>
  24. <view v-else><text class="text-red text-bold">{{item.bwagall}}</text></view>
  25. <view class="text-red">{{item.ftype_text}}:{{item.fwagall}}</view>
  26. </view>
  27. <view class="padding-lr padding-bottom-sm text-cut">
  28. <view v-for="(titem,tindex) in item.tags" :key="tindex" class="cu-tag light bg-gray sm">{{titem}}</view>
  29. </view>
  30. <view class="grid solids-top text-center col-2" v-if="item.status==1">
  31. <view @tap="goDemandform" :data-demandid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  32. <view @tap="statusDemand" :data-demandid="item.id" :data-status="2" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 提交审核 </view>
  33. </view>
  34. <view class="grid solids-top text-center col-1" v-if="item.status==2">
  35. <view @tap="goDemandform" :data-demandid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  36. </view>
  37. <view class="grid solids-top text-center col-5" v-if="item.status==3">
  38. <view @tap="goDemandform" :data-demandid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  39. <view @tap="statusDemand" :data-demandid="item.id" :data-status="5" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 下架 </view>
  40. <view @tap="updateTime" :data-demandid="item.id" class="padding-top"><text class="cuIcon-top padding-right-xs"></text> 置顶 </view>
  41. <view @tap="goWdemandLog" :data-demandid="item.id" class="padding-top"><text class="cuIcon-list padding-right-xs"></text> 记录 </view>
  42. <view @tap="goDemandDetail" :data-demandid="item.id" class="padding-top"><text class="cuIcon-text padding-right-xs"></text> 详情 </view>
  43. </view>
  44. <view class="grid solids-top text-center col-4" v-if="item.status==4">
  45. <view @tap="goDemandform" :data-demandid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  46. <view @tap="statusDemand" :data-demandid="item.id" :data-status="5" class="padding-top"><text class="cuIcon-pulldown padding-right-xs"></text> 下架 </view>
  47. <view @tap="goWdemandLog" :data-demandid="item.id" class="padding-top"><text class="cuIcon-list padding-right-xs"></text> 记录 </view>
  48. <view @tap="goDemandDetail" :data-demandid="item.id" class="padding-top"><text class="cuIcon-text padding-right-xs"></text> 详情 </view>
  49. </view>
  50. <view class="grid solids-top text-center col-3" v-if="item.status==5">
  51. <view @tap="goDemandform" :data-demandid="item.id" class="padding-top"><text class="cuIcon-write padding-right-xs"></text> 编辑 </view>
  52. <view @tap="statusDemand" :data-demandid="item.id" :data-status="4" class="padding-top"><text class="cuIcon-pullup padding-right-xs"></text> 上架 </view>
  53. <view @tap="goWdemandLog" :data-demandid="item.id" class="padding-top"><text class="cuIcon-list padding-right-xs"></text> 记录 </view>
  54. </view>
  55. </view>
  56. </view>
  57. </block>
  58. <uni-load-more :status="pstatus"></uni-load-more>
  59. <view class="padding"></view>
  60. </view>
  61. </template>
  62. <script>
  63. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  64. var _this;
  65. export default {
  66. components: {
  67. uniLoadMore
  68. },
  69. data() {
  70. return {
  71. isRotate: false,
  72. status: 3,
  73. userinfo: false,
  74. workerinfo: false,
  75. param: {},
  76. pstatus: 'more',
  77. ppage: 1,
  78. psize: 20,
  79. plist: [],
  80. modal:{
  81. isshow: "",
  82. demandpic: ""
  83. }
  84. }
  85. },
  86. onLoad: function(option) {
  87. _this = this;
  88. _this.status = option.status || 3;
  89. _this.userinfo = _this.checkLogin("/pages/my/my");
  90. _this.workerinfo = uni.getStorageSync('workerinfo') || false;
  91. if (_this.userinfo === false || _this.workerinfo === false) {
  92. uni.reLaunch({
  93. url: "/pages/my/my"
  94. });
  95. return false;
  96. }
  97. _this.getMore();
  98. },
  99. onPullDownRefresh: function() {
  100. _this.pageRefresh();
  101. },
  102. onReachBottom: function() {
  103. if (_this.pstatus !== 'more') {
  104. return;
  105. }
  106. _this.getMore();
  107. },
  108. methods: {
  109. goDemandDetail: function(e) {
  110. var demandid = e.currentTarget.dataset.demandid;
  111. uni.navigateTo({
  112. url: '/pages/demand/detail?demandid='+demandid
  113. });
  114. },
  115. goWdemandLog: function(e) {
  116. var demandid = e.currentTarget.dataset.demandid;
  117. uni.navigateTo({
  118. url: '/pages/demand/wdemandlog?demandid='+demandid
  119. });
  120. },
  121. goDemandform: function(e) {
  122. var demandid = e.currentTarget.dataset.demandid;
  123. uni.navigateTo({
  124. url: '/pages/demand/demandform?demandid='+demandid
  125. });
  126. },
  127. saveImage: function() {
  128. uni.downloadFile({
  129. url: _this.modal.demandpic, //仅为示例,并非真实的资源
  130. success: (res) => {
  131. if (res.statusCode === 200) {
  132. uni.saveImageToPhotosAlbum({
  133. filePath: res.tempFilePath,
  134. success: function () {
  135. uni.showModal({
  136. title: '信息提示',
  137. content: "已保存到手机相册,注意查收。",
  138. showCancel: false
  139. });
  140. }
  141. });
  142. }
  143. }
  144. });
  145. },
  146. hideModal: function() {
  147. _this.modal.isshow = "";
  148. },
  149. shareDemand: function(e) {
  150. var demandid = e.currentTarget.dataset.demandid;
  151. _this.$req.ajax({
  152. title: "招聘简章生成中...",
  153. path: "demand/getdemandcode",
  154. data: {
  155. demandid: demandid,
  156. userid: _this.userinfo.id
  157. }
  158. }).then((data) => {
  159. _this.modal.demandpic = data.demandpic;
  160. _this.modal.isshow = "show";
  161. }).catch((err) => {
  162. uni.showModal({
  163. title: '温馨提示',
  164. content: err,
  165. showCancel: false
  166. });
  167. });
  168. },
  169. statusDemand: function(e) {
  170. var demandid = e.currentTarget.dataset.demandid;
  171. var status = e.currentTarget.dataset.status;
  172. _this.$req.ajax({
  173. path: "wdemand/statusdemand",
  174. data: {
  175. demandid: demandid,
  176. userid: _this.userinfo.id,
  177. workerid: _this.workerinfo.id,
  178. status: status
  179. }
  180. }).then((data) => {
  181. _this.pageRefresh();
  182. }).catch((err) => {
  183. uni.showModal({
  184. title: '信息提示',
  185. content: err,
  186. showCancel: false
  187. });
  188. });
  189. },
  190. updateTime: function(e) {
  191. var demandid = e.currentTarget.dataset.demandid;
  192. uni.showModal({
  193. title: '信息提示',
  194. content: '每次置顶会扣除'+_this.param.topdemand+'积分,确定要做置顶操作吗?',
  195. success: function(res) {
  196. if (res.confirm) {
  197. _this.$req.ajax({
  198. path: "wdemand/updatedemand",
  199. data: {
  200. demandid: demandid,
  201. userid: _this.userinfo.id,
  202. workerid: _this.workerinfo.id
  203. }
  204. }).then((data) => {
  205. _this.pageRefresh();
  206. }).catch((err) => {
  207. uni.showModal({
  208. title: '信息提示',
  209. content: err,
  210. showCancel: false
  211. });
  212. });
  213. }
  214. }
  215. });
  216. },
  217. pageRefresh: function() {
  218. _this.pstatus = 'more';
  219. _this.ppage = 1;
  220. _this.plist = [];
  221. _this.getMore();
  222. },
  223. getMore: function() {
  224. _this.$req.ajax({
  225. path: "wdemand/listdemand",
  226. data: {
  227. ppage: _this.ppage,
  228. psize: _this.psize,
  229. status: _this.status,
  230. workerid: _this.workerinfo.id
  231. }
  232. }).then((data) => {
  233. _this.param = data.param;
  234. _this.pstatus = data.pstatus;
  235. _this.plist = _this.plist.concat(data.plist);
  236. _this.ppage += 1;
  237. uni.stopPullDownRefresh();
  238. }).catch((err) => {
  239. uni.showModal({
  240. title: '信息提示',
  241. content: err,
  242. showCancel: false
  243. });
  244. });
  245. },
  246. tabSelect: function(e) {
  247. _this.status = e.currentTarget.dataset.status;
  248. _this.pageRefresh();
  249. },
  250. },
  251. }
  252. </script>
  253. <style>
  254. .picmodal{ width: 640rpx; background-color: transparent; }
  255. .picmodal image{ width: 100%; }
  256. .picmodal .bg-img{ position: relative; }
  257. .picmodalclose{ position: absolute; top: 0rpx; right: 0rpx; }
  258. </style>