cityOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <view class="content">
  3. <view class="part2 u-skeleton-fillet">
  4. <view class="box_add">
  5. <!-- <view class="distance">
  6. <view>{{orderDelites.distancessd}}</view>
  7. </view> -->
  8. <view class="add_name" @click="goStart">
  9. <view class="sh_name">
  10. {{orderDelites.userAddressDetail}}({{orderDelites.userProvince}}{{orderDelites.userCity}}{{orderDelites.userDistrict}})
  11. <u-icon name="map"></u-icon>
  12. </view>
  13. </view>
  14. </view>
  15. <u-line color="#F2F2F2" />
  16. <view class="part3">
  17. <view class="three_left">
  18. <image src="../../../static/rider/icon_data.png"></image>
  19. <text>{{orderDelites.sendOutTime}}</text>
  20. </view>
  21. <!-- <view class="three_right">¥{{orderDelites.errandMoney}}</view> -->
  22. </view>
  23. </view>
  24. <!-- tip -->
  25. <view class="tip_box u-skeleton-fillet">
  26. <view class="tip_part1">
  27. <view class="box_two" v-if="orderDelites.indentType==4">同城服务</view>
  28. <view class="box_two" v-if="orderDelites.indentType==3">同城帮买</view>
  29. <view class="box_one" v-if='orderDelites.serviceType'>{{orderDelites.serviceType}}</view>
  30. <view class="box_one" v-if='orderDelites.tool'>{{orderDelites.tool}}</view>
  31. </view>
  32. <u-line color="#F2F2F2" />
  33. <view class="tip_content" v-if="orderDelites.indentType==3">
  34. {{orderDelites.remarks}}
  35. </view>
  36. <view class="tip_content" v-if="orderDelites.indentType==4">
  37. {{orderDelites.serviceDetails}}
  38. </view>
  39. </view>
  40. <!-- 订单信息 -->
  41. <view class="order_box u-skeleton-fillet">
  42. <view class="order_title">订单信息</view>
  43. <view class="order_list">
  44. <view class="order_name">订单号码</view>
  45. <view class="order_numbers" @click="copyOrder(orderDelites.indentNumber)">{{orderDelites.indentNumber}}
  46. <u-icon name="order"></u-icon>
  47. </view>
  48. </view>
  49. <view class="order_list">
  50. <view class="order_name">预约时间</view>
  51. <view class="order_numbers">{{orderDelites.sendOutTime}}</view>
  52. </view>
  53. </view>
  54. <!-- 费用明细 -->
  55. <view class="order_box u-skeleton-fillet">
  56. <view class="order_title">费用明细</view>
  57. <view class="order_list">
  58. <view class="income_name">跑腿费</view>
  59. <view class="income_numbers">¥<text>{{orderDelites.errandMoney}}</text></view>
  60. </view>
  61. <view class="order_list" v-if="orderDelites.tip">
  62. <view class="income_name">小费奖励</view>
  63. <view class="income_numbers">¥<text>{{orderDelites.tip}}</text></view>
  64. </view>
  65. <view class="order_list" v-if="orderDelites.prepayMoney">
  66. <view class="income_name">商品预付</view>
  67. <view class="income_numbers">¥<text>{{orderDelites.prepayMoney}}</text></view>
  68. </view>
  69. <view class="order_list">
  70. <view class="income_name">合计</view>
  71. <view class="income_numbers1">¥<text>{{orderDelites.riderMoney}}</text></view>
  72. </view>
  73. </view>
  74. <!-- 接单按钮 -->
  75. <view class="tabbar_btn">
  76. <view class="btn" @click="bindorder">接单</view>
  77. </view>
  78. <u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. orderDelites: {},
  86. indentNumber: '',
  87. checkCertification: '',
  88. userId: '',
  89. loading: true, // 是否显示骨架屏组件
  90. }
  91. },
  92. onLoad(options) {
  93. console.log(options)
  94. this.indentNumber = options.id
  95. var that = this
  96. uni.getLocation({
  97. type: 'wgs84',
  98. success: function(res) {
  99. console.log('当前位置的经度:' + res.longitude);
  100. console.log('当前位置的纬度:' + res.latitude);
  101. that.longitude = res.longitude
  102. that.latitude = res.latitude
  103. that.taskData()
  104. }
  105. });
  106. this.userId = that.$queue.getData("userId");
  107. this.checkCertification = that.$queue.getData("checkCertification");
  108. },
  109. methods: {
  110. copyOrder(value) {
  111. uni.setClipboardData({
  112. data: value, //要被复制的内容
  113. success: () => { //复制成功的回调函数
  114. uni.showToast({ //提示
  115. title: '复制成功'
  116. })
  117. }
  118. });
  119. },
  120. goStart() {
  121. // let obj = {
  122. // name: this.orderDelites.deilveryAddressDetail,
  123. // lat: this.orderDelites.userLat,
  124. // long: this.orderDelites.userLng,
  125. // }
  126. // this.navgate(obj)
  127. let latitude = this.orderDelites.userLat
  128. let longitude = this.orderDelites.userLng
  129. let name = this.orderDelites.userAddressDetail
  130. uni.openLocation({
  131. latitude: Number(latitude), //要去的纬度-地址
  132. longitude: Number(longitude), //要去的经度-地址
  133. name: name, //地址名称
  134. address: name, //详细地址名称
  135. success: function() {
  136. console.log('导航成功');
  137. },
  138. fail: function(error) {
  139. console.log(error)
  140. }
  141. })
  142. },
  143. navgate(e) {
  144. let plugin = requirePlugin('routePlan');
  145. let key = this.$queue.getData('mapKey'); //使用在腾讯位置服务申请的key
  146. let referer = this.$queue.getData('mapName'); //调用插件的app的名称
  147. let endPoint = JSON.stringify({ //终点
  148. 'name': e.name,
  149. 'latitude': e.lat,
  150. 'longitude': e.long
  151. });
  152. wx.navigateTo({
  153. url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
  154. });
  155. },
  156. // 获取任务数据
  157. taskData() {
  158. this.$Request.postT('/app/tbindent/indentMessage', {
  159. indentNumber: this.indentNumber,
  160. ol: this.longitude,
  161. od: this.latitude
  162. }).then(res => {
  163. if (res.code == 0) {
  164. if (res.data.distancessd > 1000) {
  165. res.data.distancessd = Number((res.data.distancessd / 1000)).toFixed(2) + "km"
  166. } else {
  167. if (res.data.distancessd == 0) {
  168. res.data.distancessd = "0m";
  169. } else {
  170. res.data.distancessd = Number(res.data.distancessd).toFixed(1) + "m";
  171. }
  172. }
  173. this.orderDelites = res.data
  174. } else {
  175. console.log('res', res.data)
  176. }
  177. this.loading = false;
  178. });
  179. },
  180. bindorder() {
  181. let that = this
  182. if (!that.userId) {
  183. uni.showModal({
  184. title: '提示',
  185. content: '请先登录后再接单',
  186. success: function(res) {
  187. if (res.confirm) {
  188. console.log('用户点击确定');
  189. uni.navigateTo({
  190. url: '/pages/login/login'
  191. })
  192. } else if (res.cancel) {
  193. console.log('用户点击取消');
  194. }
  195. }
  196. });
  197. return;
  198. }
  199. if (that.checkCertification != 1) {
  200. uni.showModal({
  201. title: '提示',
  202. content: '请先实名认证后再接单',
  203. success: function(res) {
  204. if (res.confirm) {
  205. console.log('用户点击确定');
  206. uni.navigateTo({
  207. url: '/pages/riderMy/approve/approve'
  208. })
  209. } else if (res.cancel) {
  210. console.log('用户点击取消');
  211. }
  212. }
  213. });
  214. return;
  215. }
  216. uni.showModal({
  217. title: '提示',
  218. content: '确认接单吗',
  219. success: function(res) {
  220. if (res.confirm) {
  221. console.log('用户点击确定');
  222. that.$Request.postT('/app/tbindent/indentReceiving', {
  223. indentNumber: that.indentNumber
  224. }).then(res => {
  225. if (res.code == 0) {
  226. uni.navigateTo({
  227. url: '/pages/index/orderdetail/orderdetail?id=' + that
  228. .indentNumber
  229. })
  230. } else {
  231. console.log('失败:', res.data)
  232. uni.showToast({
  233. title: res.msg,
  234. icon: 'none',
  235. duration: 1500
  236. });
  237. }
  238. });
  239. } else if (res.cancel) {
  240. console.log('用户点击取消');
  241. }
  242. }
  243. });
  244. }
  245. }
  246. }
  247. </script>
  248. <style>
  249. body {
  250. background: #F5F5F5;
  251. }
  252. .content {
  253. width: 100%;
  254. padding-bottom: 180rpx;
  255. }
  256. .part2 {
  257. width: 90%;
  258. margin: 0 auto;
  259. /* padding-top: 25rpx; */
  260. /* height: 230rpx; */
  261. background: #ffffff;
  262. border-radius: 23rpx;
  263. /* box-shadow: 0rpx 5rpx 5rpx 0rpx rgba(198, 186, 181, 0.20); */
  264. margin-top: 30rpx;
  265. }
  266. .box_add {
  267. display: flex;
  268. /* height: 100rpx; */
  269. /* line-height: 31rpx; */
  270. padding: 15px 17px;
  271. }
  272. .distance {
  273. flex: 1;
  274. text-align: center;
  275. font-size: 28rpx;
  276. margin-top: 15rpx;
  277. }
  278. .a {
  279. font-size: 16rpx;
  280. }
  281. .add_name {
  282. flex: 4;
  283. }
  284. .sh_name {
  285. font-size: 28rpx;
  286. font-weight: bold;
  287. letter-spacing: 2rpx;
  288. }
  289. .xs_add {
  290. color: #999999;
  291. font-size: 24rpx;
  292. margin-top: 10rpx;
  293. }
  294. .u-line {
  295. border-bottom-width: 3px !important;
  296. }
  297. .part3 {
  298. width: 90%;
  299. margin: 0 auto;
  300. display: flex;
  301. }
  302. .three_left {
  303. flex: 1;
  304. height: 100rpx;
  305. display: flex;
  306. justify-content: left;
  307. align-items: center;
  308. }
  309. .three_left image {
  310. width: 36rpx;
  311. height: 37rpx;
  312. }
  313. .three_left text {
  314. color: #333333;
  315. font-size: 25rpx;
  316. margin-left: 10rpx;
  317. }
  318. .three_right {
  319. flex: 1;
  320. height: 100rpx;
  321. display: flex;
  322. justify-content: flex-end;
  323. align-items: center;
  324. color: #FF412D;
  325. font-size: 32rpx;
  326. font-weight: bold;
  327. }
  328. /* tip */
  329. .tip_box {
  330. width: 90%;
  331. margin: 0 auto;
  332. height: 180rpx;
  333. background: #FFFFFF;
  334. margin-top: 20rpx;
  335. border-radius: 22rpx;
  336. }
  337. .tip_part1 {
  338. display: flex;
  339. height: 70rpx;
  340. justify-content: left;
  341. align-items: center;
  342. margin-left: 30rpx;
  343. }
  344. .box_one {
  345. background: #c4e2ff;
  346. color: #359CFF;
  347. height: 45rpx;
  348. font-size: 22rpx;
  349. text-align: center;
  350. line-height: 45rpx;
  351. border-radius: 5rpx;
  352. margin-left: 20rpx;
  353. padding: 0 10rpx
  354. }
  355. .box_two {
  356. font-size: 32rpx;
  357. font-weight: bold;
  358. letter-spacing: 3rpx;
  359. }
  360. .tip_content {
  361. width: 90%;
  362. margin: 0 auto;
  363. font-size: 29rpx;
  364. /* font-weight: bold; */
  365. letter-spacing: 2rpx;
  366. margin-top: 15rpx;
  367. }
  368. .u-line {
  369. border-bottom-width: 3px !important;
  370. }
  371. /* 订单信息 */
  372. .order_box {
  373. width: 90%;
  374. margin: 0 auto;
  375. /* height: 300rpx; */
  376. padding-bottom: 10upx;
  377. background: #ffffff;
  378. margin-top: 20rpx;
  379. border-radius: 22rpx;
  380. }
  381. .order_title {
  382. width: 90%;
  383. margin: 0 auto;
  384. font-size: 32rpx;
  385. font-weight: bold;
  386. line-height: 67rpx;
  387. letter-spacing: 3rpx;
  388. }
  389. .order_list {
  390. display: flex;
  391. }
  392. .order_name {
  393. flex: 1;
  394. margin-left: 35rpx;
  395. color: #999999;
  396. font-size: 25rpx;
  397. height: 75rpx;
  398. display: flex;
  399. justify-content: left;
  400. align-items: center;
  401. }
  402. .order_numbers {
  403. flex: 1;
  404. color: #333333;
  405. display: flex;
  406. justify-content: flex-end;
  407. align-items: center;
  408. font-size: 26rpx;
  409. margin-right: 35rpx;
  410. }
  411. /* 费用明细 */
  412. .income_name {
  413. flex: 1;
  414. margin-left: 35rpx;
  415. color: #999999;
  416. font-size: 26rpx;
  417. height: 75rpx;
  418. display: flex;
  419. justify-content: left;
  420. align-items: center;
  421. }
  422. .income_numbers {
  423. flex: 1;
  424. color: #333333;
  425. display: flex;
  426. justify-content: flex-end;
  427. align-items: center;
  428. font-size: 26rpx;
  429. margin-right: 35rpx;
  430. }
  431. .income_numbers1 {
  432. flex: 1;
  433. color: #FF2400;
  434. display: flex;
  435. justify-content: flex-end;
  436. align-items: center;
  437. font-size: 26rpx;
  438. margin-right: 35rpx;
  439. }
  440. /* 接单按钮 */
  441. .tabbar_btn {
  442. position: fixed;
  443. bottom: 0rpx;
  444. left: 0rpx;
  445. right: 0rpx;
  446. width: 100%;
  447. height: 120rpx;
  448. background: #FFFFFF;
  449. display: flex;
  450. justify-content: center;
  451. align-items: center;
  452. }
  453. .btn {
  454. width: 90%;
  455. height: 80rpx;
  456. background: #FF7F00;
  457. border-radius: 21rpx;
  458. color: white;
  459. text-align: center;
  460. line-height: 80rpx;
  461. font-size: 26rpx;
  462. }
  463. </style>