用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

295 lines
11 KiB

  1. <template>
  2. <view>
  3. <view class="se-m-20 se-br-20 se-bs-b se-bgc-white se-py-20 se-px-30" v-for="(items,indexs) in taskList" :key="indexs" @click="onMasterDetail(items)">
  4. <view class="se-flex se-flex-h-sb">
  5. <view class="se-flex">
  6. <text class="se-fw-6 se-c-black se-fs-30">{{items.title}}</text>
  7. </view>
  8. <view class="se-c-orange se-fs-32 se-fw-6">
  9. {{items.salaryMin}}-{{items.salaryMax}}k
  10. </view>
  11. </view>
  12. <view class="se-py-10">
  13. <text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5" v-if="items.categoryOne_dictText">{{items.categoryOne_dictText}}</text>
  14. <text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5" v-if="items.categoryTwo_dictText">{{items.categoryTwo_dictText}}</text>
  15. <text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5"v-if="items.payType_dictText">{{items.payType_dictText}}</text>
  16. </view>
  17. <view class="se-flex se-flex-h-sb">
  18. <view class="se-flex se-flex-h-c">
  19. <u-icon name="map"></u-icon>
  20. <text class="se-c-text-sub se-fs-24 se-pr-10">{{items.latitude,items.longitude | getDistance}}km</text>
  21. <text class="se-c-text-sub se-fs-24 se-pl-10 se-b-l se-toe-3" style="max-width: 220rpx;">{{items.address}}</text>
  22. </view>
  23. <view class="se-c-text se-c-text-sub se-fs-24">
  24. {{items.createTime | formatTime}}
  25. </view>
  26. <view class="se-flex se-flex-h-c se-py-10 se-px-20 se-br-12 se-fs-22 se-c-orange se-bgc-ffd se-fw-6">
  27. <text class="se-ml-5">立即接单</text>
  28. </view>
  29. </view>
  30. </view>
  31. <u-empty v-if="taskList && taskList.length==0" mode="list"></u-empty>
  32. </view>
  33. </template>
  34. <script>
  35. export default{
  36. data(){
  37. return{
  38. taskList:[
  39. {
  40. "id": "1895062781967736834",
  41. "createBy": null,
  42. "createTime": "2025-02-27 18:45:50",
  43. "updateBy": null,
  44. "updateTime": null,
  45. "title": "销售兼职",
  46. "address": "云南省昆明市官渡区站前路",
  47. "categoryOne": "1894724968848064513",
  48. "categoryTwo": "1894726005210251265",
  49. "salaryMin": 3000,
  50. "salaryMax": 10000,
  51. "salaryDay": 200,
  52. "payType": "1",
  53. "phone": "17875426385",
  54. "details": "卖衣服",
  55. "image": "https://tennis-oss.xzaiyp.top/2025-02-27/45e4b177-f0da-4eba-95e5-2322589a8af7.jpg",
  56. "userId": "1891910362819756034",
  57. "longitude": 102.72173,
  58. "latitude": 25.015772,
  59. "tag": null,
  60. "startTime": "2015-01-01 00:00:00",
  61. "endTime": "2015-01-01 00:00:00",
  62. "employAuthenticationPerson": {
  63. "id": "1895028819692646402",
  64. "createBy": null,
  65. "createTime": 1740645053000,
  66. "updateBy": "admin",
  67. "updateTime": 1741768776000,
  68. "name": "安师傅",
  69. "password": null,
  70. "phone": "17875426385",
  71. "address": "云南省文山州凤凰谷",
  72. "industry": "1894724665780240386",
  73. "cerImageFront": "https://tennis-oss.xzaiyp.top/2025-02-27/9ed9dabf-15a1-4ea4-87cb-d7df3f52c0e8.jpg",
  74. "cerImageBack": "https://tennis-oss.xzaiyp.top/2025-02-27/0bf464ca-b275-4db5-8349-6bc9720067b1.jpg",
  75. "status": "1",
  76. "userId": "1891910362819756034",
  77. "industryName": null,
  78. "image": "https://tennis-oss.xzaiyp.top/2025-02-27/b176ed2c-499e-40df-bce9-abbb7429f890.jpg"
  79. },
  80. "employAuthenticationCompany": null,
  81. "hanHaiMember": {
  82. "id": "1891910362819756034",
  83. "createBy": null,
  84. "createTime": 1739894400000,
  85. "updateBy": "admin001",
  86. "updateTime": 1740412800000,
  87. "sysOrgCode": null,
  88. "nickName": "哦哟",
  89. "headImage": "https://tennis-oss.xzaiyp.top/2025-02-25/f209a458-f58c-492d-8887-7295000d9b5f.jpeg",
  90. "name": "",
  91. "phone": "17875426385",
  92. "account": null,
  93. "password": null,
  94. "passwordSalt": null,
  95. "shopName": null,
  96. "role": "",
  97. "cardId": null,
  98. "frozenFlag": "",
  99. "deleteFlag": "0",
  100. "token": null,
  101. "officialOpenid": null,
  102. "appletOpenid": "opwCj7Z-ni6VvPuwI8zvebAiU_lk",
  103. "appOpenid": null,
  104. "wxUnionid": null,
  105. "officialAppid": null,
  106. "idCard": null,
  107. "idCardPassword": null,
  108. "idCardSalt": null,
  109. "idCardOpen": null,
  110. "intentionNum": null,
  111. "successNum": null,
  112. "addNum": null,
  113. "shareId": null,
  114. "vid": null,
  115. "vtime": null,
  116. "isPay": null,
  117. "follow": null,
  118. "payRole": null,
  119. "price": 0,
  120. "integerPrice": null,
  121. "appletAppid": null,
  122. "sex": "2",
  123. "isDai": null
  124. },
  125. "categoryOne_dictText": "兼职",
  126. "categoryTwo_dictText": "波音兼职",
  127. "payType_dictText": "支付宝支付",
  128. "userId_dictText": "哦哟"
  129. },
  130. {
  131. "id": "1895062781967736834",
  132. "createBy": null,
  133. "createTime": "2025-02-27 18:45:50",
  134. "updateBy": null,
  135. "updateTime": null,
  136. "title": "销售兼职",
  137. "address": "云南省昆明市官渡区站前路",
  138. "categoryOne": "1894724968848064513",
  139. "categoryTwo": "1894726005210251265",
  140. "salaryMin": 3000,
  141. "salaryMax": 10000,
  142. "salaryDay": 200,
  143. "payType": "1",
  144. "phone": "17875426385",
  145. "details": "卖衣服",
  146. "image": "https://tennis-oss.xzaiyp.top/2025-02-27/45e4b177-f0da-4eba-95e5-2322589a8af7.jpg",
  147. "userId": "1891910362819756034",
  148. "longitude": 102.72173,
  149. "latitude": 25.015772,
  150. "tag": null,
  151. "startTime": "2015-01-01 00:00:00",
  152. "endTime": "2015-01-01 00:00:00",
  153. "employAuthenticationPerson": {
  154. "id": "1895028819692646402",
  155. "createBy": null,
  156. "createTime": 1740645053000,
  157. "updateBy": "admin",
  158. "updateTime": 1741768776000,
  159. "name": "安师傅",
  160. "password": null,
  161. "phone": "17875426385",
  162. "address": "云南省文山州凤凰谷",
  163. "industry": "1894724665780240386",
  164. "cerImageFront": "https://tennis-oss.xzaiyp.top/2025-02-27/9ed9dabf-15a1-4ea4-87cb-d7df3f52c0e8.jpg",
  165. "cerImageBack": "https://tennis-oss.xzaiyp.top/2025-02-27/0bf464ca-b275-4db5-8349-6bc9720067b1.jpg",
  166. "status": "1",
  167. "userId": "1891910362819756034",
  168. "industryName": null,
  169. "image": "https://tennis-oss.xzaiyp.top/2025-02-27/b176ed2c-499e-40df-bce9-abbb7429f890.jpg"
  170. },
  171. "employAuthenticationCompany": null,
  172. "hanHaiMember": {
  173. "id": "1891910362819756034",
  174. "createBy": null,
  175. "createTime": 1739894400000,
  176. "updateBy": "admin001",
  177. "updateTime": 1740412800000,
  178. "sysOrgCode": null,
  179. "nickName": "哦哟",
  180. "headImage": "https://tennis-oss.xzaiyp.top/2025-02-25/f209a458-f58c-492d-8887-7295000d9b5f.jpeg",
  181. "name": "",
  182. "phone": "17875426385",
  183. "account": null,
  184. "password": null,
  185. "passwordSalt": null,
  186. "shopName": null,
  187. "role": "",
  188. "cardId": null,
  189. "frozenFlag": "",
  190. "deleteFlag": "0",
  191. "token": null,
  192. "officialOpenid": null,
  193. "appletOpenid": "opwCj7Z-ni6VvPuwI8zvebAiU_lk",
  194. "appOpenid": null,
  195. "wxUnionid": null,
  196. "officialAppid": null,
  197. "idCard": null,
  198. "idCardPassword": null,
  199. "idCardSalt": null,
  200. "idCardOpen": null,
  201. "intentionNum": null,
  202. "successNum": null,
  203. "addNum": null,
  204. "shareId": null,
  205. "vid": null,
  206. "vtime": null,
  207. "isPay": null,
  208. "follow": null,
  209. "payRole": null,
  210. "price": 0,
  211. "integerPrice": null,
  212. "appletAppid": null,
  213. "sex": "2",
  214. "isDai": null
  215. },
  216. "categoryOne_dictText": "兼职",
  217. "categoryTwo_dictText": "波音兼职",
  218. "payType_dictText": "支付宝支付",
  219. "userId_dictText": "哦哟"
  220. }
  221. ]
  222. }
  223. },
  224. filters:{
  225. formatTime(time) {
  226. const timestamp = new Date(time).getTime();
  227. const currentTime = new Date().getTime();
  228. console.info("currentTime",currentTime)
  229. const diff = (currentTime - timestamp) / 1000; // 时间差,单位:秒
  230. // 计算月差,判断是否超过一个月
  231. const oneMonthInSeconds = 30 * 24 * 60 * 60;
  232. if (diff > oneMonthInSeconds) {
  233. let date = new Date(timestamp);
  234. let year = date.getFullYear();
  235. let month = date.getMonth() + 1;
  236. let day = date.getDate();
  237. if (month < 10) month = "0" + month;
  238. if (day < 10) day = "0" + day;
  239. return `${year}-${month}-${day}`;
  240. } else {
  241. // 计算秒、分钟、小时的差值
  242. if (diff < 60) {
  243. return `${Math.floor(diff)}秒钟前`;
  244. } else if (diff < 60 * 60) {
  245. return `${Math.floor(diff / 60)}分钟前`;
  246. } else if (diff < 60 * 60 * 24) {
  247. return `${Math.floor(diff / 60 / 60)}小时前`;
  248. } else {
  249. // 显示天数
  250. return `${Math.floor(diff / 60 / 60 / 24)}天前`;
  251. }
  252. }
  253. },
  254. formDate(date){
  255. return dayjs(date).format("YYYY-MM-DD").fromNow();
  256. },
  257. getDistance(lat1, lng1) {
  258. let lng2 = uni.getStorageSync("longitude")
  259. let lat2 = uni.getStorageSync("latitude")
  260. if(!lng2 && !lat2){
  261. return "请授权"
  262. }
  263. const R = 6371; // 地球半径,单位:km
  264. const radLat1 = (lat1 * Math.PI) / 180;
  265. const radLat2 = (lat2 * Math.PI) / 180;
  266. const deltaLat = radLat2 - radLat1;
  267. const deltaLng = ((lng2 - lng1) * Math.PI) / 180;
  268. const a =
  269. Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +
  270. Math.cos(radLat1) *
  271. Math.cos(radLat2) *
  272. Math.sin(deltaLng / 2) *
  273. Math.sin(deltaLng / 2);
  274. const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  275. return (R * c).toFixed(2); // 返回保留两位小数的公里数
  276. }
  277. },
  278. methods:{
  279. onMasterDetail(event){
  280. uni.navigateTo({
  281. url:"/pages_subpack/work-detail/index?id="+event.id
  282. })
  283. }
  284. }
  285. }
  286. </script>
  287. <style>
  288. </style>