orderDet.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. <template>
  2. <view class="pages">
  3. <!-- 余额 -->
  4. <view class="tosend">
  5. <view class="tosend_text" v-if="dataDet.status == 3 && dataDet.indentState == 2">待骑手接单</view>
  6. <view class="tosend_text" v-if="dataDet.status == 6 && dataDet.indentState == 2">制作中...</view>
  7. <view class="tosend_text" v-if="(dataDet.status == 3 || dataDet.status == 6) && dataDet.indentState == 3">骑手已接单</view>
  8. <view class="tosend_text" v-if="(dataDet.status == 3 || dataDet.status == 6) && dataDet.indentState == 4">骑手配送中</view>
  9. <view class="tosend_text" v-if="dataDet.status == 3 && dataDet.orderType == 1">待取餐</view>
  10. <view class="tosend_text" v-if="dataDet.status == 3 && dataDet.orderType == 2 && dataDet.riderUserId">配送中</view>
  11. <view class="tosend_text" v-if="dataDet.status == 3 && dataDet.orderType == 2 && dataDet.riderUserId == null">待配送</view>
  12. <view class="tosend_text" v-if="dataDet.status == 4">已完成</view>
  13. <view class="tosend_text" v-if="dataDet.status == 5">已取消</view>
  14. <view class="tosend_text" v-if="dataDet.status == 8">已退款</view>
  15. <view class="tosend_text" v-if="dataDet.status == 7">待接单</view>
  16. <!-- <view class="btnCm" v-if="item.riderUserId">配送中</view>
  17. <view class="btnCm" v-else>待派送</view> -->
  18. <view style="padding: 0 30rpx; font-size: 20px" v-if="dataDet.orderSequence">#{{ dataDet.orderSequence }}</view>
  19. <view class="tosend_cont" style="position: relative; margin-top: 20upx" v-if="dataDet.orderType == 2">
  20. <image src="../../static/images/order/dizhi.png" style="position: absolute; width: 32rpx; height: 40rpx; top: 50rpx; left: 32rpx"></image>
  21. <view class="tosend_header_text" style="margin-left: 64rpx" @tap="bindGps(dataDet.address.lat, dataDet.address.lng, dataDet.address.addressDetail)">
  22. {{ dataDet.address.province }}{{ dataDet.address.city }}{{ dataDet.address.district }}{{ dataDet.address.addressDetail }}
  23. </view>
  24. <view class="tosend_cont_infor" style="margin-top: 0; margin-left: 64rpx">
  25. <view class="tosend_cont_infor_le" @click="bindphone(dataDet.address.userPhone)">
  26. {{ dataDet.address.userName }}&nbsp;&nbsp;{{ dataDet.address.userPhone }}
  27. </view>
  28. <!-- <view class="tosend_cont_infor_ri">{{dataDet.orderCode}}</view> -->
  29. </view>
  30. </view>
  31. <view class="tosend_header" style="margin-top: 20upx">
  32. <!-- 排序 -->
  33. <view class="cont_two_top">
  34. <view class="cont_two_top_le" v-if="dataDet.status == 3">取餐号码</view>
  35. <!-- <view class="cont_two_top_ri" v-if="dataDet.status == 6">制作中</view> -->
  36. </view>
  37. <view v-if="dataDet.status == 3 && dataDet.orderType == 1" class="cont_two_text">{{ dataDet.orderCode }}</view>
  38. <view v-if="dataDet.status == 3 && dataDet.orderType == 1" class="cont_two_text2">
  39. 前面还有
  40. <text>{{ dataDet.countOrder ? dataDet.countOrder : 0 }}</text>
  41. 个人排队
  42. </view>
  43. <view v-if="dataDet.status != 3">
  44. <view class="flex justify-between">
  45. <view>取餐号码</view>
  46. <!-- <view class="cont_two_top_ri">制作中</view> -->
  47. </view>
  48. <view style="font-size: 58upx" class="text-center text-bold padding-tb">{{ dataDet.orderCode }}</view>
  49. </view>
  50. <!-- 商品列表 -->
  51. <view class="tosend_header_food" v-for="(item, index) in dataDet.orderGoodsList" :key="index">
  52. <view class="tosend_header_food_le">
  53. <image :src="item.goodsPicture" alt="加载失败" style="border-radius: 10rpx"></image>
  54. </view>
  55. <view class="tosend_header_food_ce justify-between">
  56. <view class="tosend_header_food_text">{{ item.goodsName }}</view>
  57. <view class="tosend_header_food_text2" v-if="item.skuMessage">{{ item.skuMessage }}</view>
  58. <view class="tosend_header_food_text2">打包费</view>
  59. </view>
  60. <view class="tosend_header_food_ri">
  61. <view class="tosend_header_food_text">
  62. <text>¥</text>
  63. {{ item.goodsPrice }}
  64. </view>
  65. <view class="tosend_header_food_text2">×{{ item.goodsNum }}</view>
  66. <view class="tosend_header_food_text2">
  67. <text>¥</text>
  68. {{ item.goodsPack }}/份
  69. </view>
  70. </view>
  71. </view>
  72. <view
  73. class="tosend_header_do do_bot"
  74. v-if="dataDet.errandMoney > 0 && dataDet.orderType == 2 && dataDet.errandMoneyIsShop == '本单未达到商家满减金额,跑腿费由用户承担'"
  75. >
  76. <view>跑腿费</view>
  77. <view class="tosend_header_do_ri">¥{{ dataDet.errandMoney }}</view>
  78. </view>
  79. <view
  80. class="tosend_header_do do_bot"
  81. v-if="dataDet.errandMoney > 0 && dataDet.orderType == 2 && dataDet.errandMoneyIsShop == '商家未开启配送费满减,跑腿费由用户承担'"
  82. >
  83. <view>跑腿费</view>
  84. <view class="tosend_header_do_ri">¥{{ dataDet.errandMoney }}</view>
  85. </view>
  86. <!-- <view class="tosend_header_do" v-if="dataDet.packMoney>0&& dataDet.orderType == 2">
  87. <view>打包费</view>
  88. <view class="tosend_header_do_ri">¥{{dataDet.packMoney}}</view>
  89. </view> -->
  90. <view class="tosend_header_do do_bot" v-if="dataDet.couponMoney > 0">
  91. <view>优惠券</view>
  92. <view class="tosend_header_do_ri">-¥{{ dataDet.couponMoney }}</view>
  93. </view>
  94. <view class="tosend_header_do margin-top">
  95. <view class="tosend_header_do_le2">实付</view>
  96. <view class="tosend_header_do_ri2">
  97. <text>¥</text>
  98. {{ dataDet.payMoney }}
  99. </view>
  100. </view>
  101. </view>
  102. <!-- #ifdef APP -->
  103. <map
  104. v-if="dataDet.riderUserId != null && latitude && longitude && dataDet.status == 3"
  105. id="map"
  106. @tap="goMap"
  107. style="width: 95%; height: 300rpx; margin-top: 20rpx; margin-left: 20rpx"
  108. :markers="markers"
  109. :latitude="latitude"
  110. :longitude="longitude"
  111. ></map>
  112. <!-- #endif -->
  113. <!-- #ifndef APP -->
  114. <map
  115. v-if="dataDet.riderUserId != null && latitude && longitude && dataDet.status == 3"
  116. id="map"
  117. @tap="goMap"
  118. style="width: 95%; height: 300rpx; margin: 20rpx auto 0"
  119. :markers="markers"
  120. :latitude="latitude"
  121. :longitude="longitude"
  122. ></map>
  123. <!-- #endif -->
  124. <!-- 联系骑手 -->
  125. <view class="rider_box" v-if="dataDet.riderUserId != null">
  126. <view class="flex justify-between align-center padding">
  127. <view style="font-size: 31rpx; color: black">联系骑手...</view>
  128. <image @click="gotousu()" src="../../static/images/my/tousu.png" style="width: 43rpx; height: 39rpx" mode=""></image>
  129. </view>
  130. <view>
  131. <u-line color="#F2F2F2" />
  132. </view>
  133. <view style="padding: 20rpx 25rpx; display: flex; justify-content: space-between; align-items: center">
  134. <view style="display: flex">
  135. <view class="rider_left">
  136. <image :src="dataDet.riderAvatar"></image>
  137. </view>
  138. <view style="margin-left: 10rpx; color: #333333">
  139. <view>{{ dataDet.riderUserName }}</view>
  140. <view>{{ riderPhone }}</view>
  141. </view>
  142. </view>
  143. <view class="phone" @click="bindphone(dataDet.riderPhone)">联系TA</view>
  144. </view>
  145. </view>
  146. <!-- 评论信息 -->
  147. <view class="tosend_cont" v-if="dataDet.evaluateMessage">
  148. <view class="tosend_header_text">评论信息</view>
  149. <view>
  150. <view class="flex align-center">
  151. <image :src="dataDet.avatar ? dataDet.avatar : '../../static/logo.png'" style="width: 40px; height: 40px; border-radius: 50%"></image>
  152. <view class="flex justify-between align-center" style="width: 100%; margin-left: 5upx">
  153. <view class="text-bold text-df">{{ dataDet.userNickName }}</view>
  154. <view style="color: #999999; font-size: 24rpx" v-if="dataDet.ecreateTime">
  155. {{ dataDet.ecreateTime }}
  156. </view>
  157. </view>
  158. </view>
  159. <view class="padding-left margin-left-xl" style="font-size: 30upx">{{ dataDet.evaluateMessage }}</view>
  160. <view class="flex justify-end padding-top-sm margin-right" @click="show = true" v-if="!dataDet.shopReplyMessage">
  161. <image src="../../static/images/order/pinglun.png" style="width: 20px; height: 20px"></image>
  162. </view>
  163. <view class="padding-left margin-left-xl margin-top-sm" v-else>
  164. <view class="flex align-center">
  165. <view class="flex align-center text-df" style="color: #999999">
  166. <view class="text-df">商家回复:</view>
  167. {{ dataDet.shopReplyMessage }}
  168. </view>
  169. </view>
  170. <!-- <view class="text-lg padding-left margin-left-xl">{{dataDet.shopReplyMessage}}</view> -->
  171. </view>
  172. </view>
  173. </view>
  174. <!-- 其他信息 -->
  175. <view class="tosend_cont">
  176. <view class="tosend_header_text">其他信息</view>
  177. <view class="tosend_cont_infor" v-if="dataDet.remark">
  178. <view class="tosend_cont_infor_le">订单备注</view>
  179. <view class="tosend_cont_infor_ri">{{ dataDet.remark }}</view>
  180. </view>
  181. <view class="tosend_cont_infor">
  182. <view class="tosend_cont_infor_le">取餐号码</view>
  183. <view class="tosend_cont_infor_ri">{{ dataDet.orderCode }}</view>
  184. </view>
  185. <view class="tosend_cont_infor" v-if="dataDet.phone" @tap="call(dataDet.address.userPhone)">
  186. <view class="tosend_cont_infor_le">取餐电话</view>
  187. <image src="../../static/images/my/phone.png" style="width: 40upx; height: 40upx"></image>
  188. <!-- <view class="tosend_cont_infor_ri">{{dataDet.phone}}</view> -->
  189. </view>
  190. <view class="tosend_cont_infor">
  191. <view class="tosend_cont_infor_le">下单时间</view>
  192. <view class="tosend_cont_infor_ri">{{ dataDet.payTime }}</view>
  193. </view>
  194. <view class="flex justify-between align-center" style="margin-top: 3%">
  195. <view class="tosend_cont_infor_le">订单编号</view>
  196. <view class="tosend_cont_infor_ri">{{ dataDet.orderNumber }}</view>
  197. <view class="text-orange margin-left-lg" @click="copy(dataDet.orderNumber)">复制</view>
  198. </view>
  199. <view class="tosend_cont_infor">
  200. <view class="tosend_cont_infor_le">支付方式</view>
  201. <view class="tosend_cont_infor_ri" v-if="dataDet.payType == 1">微信支付</view>
  202. <view class="tosend_cont_infor_ri" v-if="dataDet.payType == 2">余额支付</view>
  203. </view>
  204. <view class="tosend_cont_infor" v-if="dataDet.orderType == 2 && dataDet.receivingTime">
  205. <view class="tosend_cont_infor_le">骑手取餐时间</view>
  206. <view class="tosend_cont_infor_ri">{{ dataDet.receivingTime }}</view>
  207. </view>
  208. <view class="tosend_cont_infor padding-bottom-sm" v-if="dataDet.finishTime">
  209. <view class="tosend_cont_infor_le">订单送达时间</view>
  210. <view class="tosend_cont_infor_ri">{{ dataDet.finishTime }}</view>
  211. </view>
  212. </view>
  213. <view class="addgood" @click="refund()" v-if="dataDet.status == 6">退款</view>
  214. <view class="addgood" @click="finish()" v-if="dataDet.status == 6">制作完成</view>
  215. <view class="addgood" @click.stop="xiaoPiao()" v-if="dataDet.status == 6 || dataDet.status == 3 || dataDet.status == 4">补打小票</view>
  216. <view class="addgood" @click="refund()" v-if="dataDet.status == 3 && dataDet.orderType == 2">退款</view>
  217. <view class="addgood" @click="peisong()" v-if="dataDet.status == 3 && dataDet.orderType == 1">制作已完成</view>
  218. <view class="addgood" v-if="dataDet.status == 3 && dataDet.orderType == 2 && dataDet.autoSendOrder == 1" @click.stop="succOrder(dataDet)">完成送达</view>
  219. <!-- <view class="addgood" @click="peisong()" v-if="dataDet.status == 3&&dataDet.orderType==2">餐品已完成,等待配送</view> -->
  220. <!-- 聊天室 -->
  221. <view class="chats" @click.stop="chat(dataDet)">
  222. <image src="../../static/images/img/chats.png"></image>
  223. <view class="shopxiaoix" v-if="ShopUnreadCount">{{ ShopUnreadCount }}</view>
  224. </view>
  225. </view>
  226. <!-- 评论弹框 -->
  227. <u-popup v-model="show" mode="bottom" border-radius="14" :closeable="closeable">
  228. <view>
  229. <view class="margin padding-tb">
  230. <u-input v-model="pinglun" type="textarea" height="200" placeholder="请填写回复的内容" maxlengt="200" :clearable="false" style="background: #f5f5f5" />
  231. </view>
  232. <view class="btn" @click="bindEvaluate()">提交</view>
  233. </view>
  234. </u-popup>
  235. </view>
  236. </template>
  237. <script>
  238. export default {
  239. data() {
  240. return {
  241. orderNumber: '',
  242. dataDet: {},
  243. orderType: '',
  244. latitude: '',
  245. longitude: '',
  246. markers: [], //标记点
  247. orderId: '',
  248. address: {},
  249. riderPhone: '',
  250. ShopUnreadCount: 0,
  251. pinglun: '',
  252. show: false,
  253. closeable: true,
  254. first: false
  255. }
  256. },
  257. onLoad(option) {
  258. uni.showLoading({
  259. title: '加载中...',
  260. mask: true // 是否显示透明蒙层,防止触摸穿透
  261. })
  262. console.log(option, 'kl')
  263. this.orderNumber = option.orderNumber
  264. this.orderId = option.orderId
  265. this.first = false
  266. this.getDataDet()
  267. let that = this
  268. setInterval(function () {
  269. that.getShopUnreadCount()
  270. }, 10000)
  271. },
  272. onShow() {
  273. this.first = false
  274. },
  275. methods: {
  276. //评论
  277. bindEvaluate() {
  278. let data = {
  279. shopReplyMessage: this.pinglun,
  280. orderNumber: this.orderNumber
  281. }
  282. this.$Request.postT('/admin/order/shopReplyEvaluate', data).then((res) => {
  283. uni.hideLoading()
  284. if (res.code == 0) {
  285. this.show = false
  286. this.getDataDet()
  287. }
  288. })
  289. },
  290. goMap() {
  291. uni.navigateTo({
  292. url: '/pages/order/orderMap?indentNumber=' + this.orderNumber + '&orderId=' + this.orderId
  293. })
  294. },
  295. //投诉
  296. gotousu() {
  297. console.log(this.orderNumber)
  298. uni.navigateTo({
  299. url: '/pages/my/comments?indentNumber=' + this.orderNumber
  300. })
  301. },
  302. // 拨打电话
  303. bindphone(e) {
  304. uni.makePhoneCall({
  305. phoneNumber: e
  306. })
  307. },
  308. // 一键导航
  309. bindGps(latitude, longitude, name, detailsadd) {
  310. console.log(latitude, longitude, name, detailsadd)
  311. uni.openLocation({
  312. latitude: latitude - 0, //要去的纬度-地址
  313. longitude: longitude - 0, //要去的经度-地址
  314. name: name, //地址名称
  315. address: detailsadd, //详细地址名称
  316. success: function () {
  317. console.log('导航成功')
  318. },
  319. fail: function (error) {
  320. console.log(error)
  321. }
  322. })
  323. },
  324. //聊天室
  325. chat(e) {
  326. // console.log(e)
  327. uni.navigateTo({
  328. url: '/pages/my/im?orderId=' + e.orderId
  329. })
  330. },
  331. //获取骑手位置
  332. getaddress(addressId, riderUserId) {
  333. console.log(addressId)
  334. let data = {
  335. addressId: addressId
  336. }
  337. this.$Request.getA('/app/address/selectAddressById', data).then((res) => {
  338. // uni.hideLoading()
  339. console.log(res)
  340. if (res.code == 0) {
  341. // this.address = res.data
  342. this.getRider(res.data.lat, res.data.lng, riderUserId)
  343. }
  344. })
  345. },
  346. //获取骑手信息
  347. getRider(lat, lng, riderUserId) {
  348. console.log(lat, lng, riderUserId, '111111')
  349. let data = {
  350. lat: lat,
  351. lng: lng,
  352. riderUserId: riderUserId
  353. }
  354. this.$Request.getA('/timedtask/selectRiderLocation', data).then((res) => {
  355. if (res.code == 0) {
  356. console.log(res.data, '经纬度')
  357. this.latitude = res.data.riderLocation.lat
  358. this.longitude = res.data.riderLocation.lng
  359. this.markers = [
  360. {
  361. id: 1,
  362. latitude: res.data.riderLocation.lat,
  363. longitude: res.data.riderLocation.lng,
  364. iconPath: '../../static/images/order/rider.png',
  365. width: '40',
  366. height: '40'
  367. }
  368. ]
  369. uni.hideLoading()
  370. }
  371. })
  372. },
  373. getDataDet() {
  374. let data = {
  375. // page: 1,
  376. // limit: 10,
  377. orderId: this.orderId
  378. }
  379. this.$Request.getA('/app/order/selectOrderById', data).then((res) => {
  380. uni.hideLoading()
  381. if (res.code == 0) {
  382. this.dataDet = res.data
  383. let start = res.data.orderCode.length - 3
  384. this.dataDet.orderCode = res.data.orderCode.substring(start, res.data.orderCode.length)
  385. this.getaddress(res.data.addressId, res.data.riderUserId)
  386. this.dataDet.orderGoodsList.forEach((res) => {
  387. res.goodsPicture = res.goodsPicture.split(',')
  388. })
  389. this.dataDet.address = JSON.parse(this.dataDet.address)
  390. this.riderPhone = this.dataDet.riderPhone
  391. this.riderPhone = this.riderPhone.replace(this.dataDet.riderPhone.substr(3, 4), '****')
  392. // console.log(this.dataDet);
  393. // let phone = this.dataDet.riderPhone;
  394. // let result = phone.substring(0, 3) + "****" + phone.substring(7, 11);
  395. // // console.log(this.dataDet.riderPhone,result);
  396. // this.dataDet.riderPhone = result
  397. this.orderType = res.data.orderType
  398. console.log(this.dataDet, '2222222')
  399. }
  400. })
  401. },
  402. copy(value) {
  403. uni.setClipboardData({
  404. data: value, //要被复制的内容
  405. success: () => {
  406. //复制成功的回调函数
  407. uni.showToast({
  408. //提示
  409. title: '复制成功'
  410. })
  411. }
  412. })
  413. },
  414. // 打电话
  415. call(phone) {
  416. uni.makePhoneCall({
  417. phoneNumber: phone
  418. })
  419. },
  420. // 打开地图
  421. openMap(e) {
  422. let latitude = e.latitude
  423. let longitude = e.longitude
  424. uni.openLocation({
  425. latitude: Number(latitude),
  426. longitude: Number(longitude),
  427. name: e.address,
  428. success: function () {
  429. console.log('success')
  430. }
  431. })
  432. },
  433. // 完成送达
  434. succOrder(e) {
  435. let that = this
  436. uni.showModal({
  437. title: '提示',
  438. content: '确认完成送达吗?',
  439. success: function (res) {
  440. if (res.confirm) {
  441. console.log('用户点击确定')
  442. let data = {
  443. orderId: e.orderId,
  444. sendSmsFlag: 0
  445. // orderNumber: e.orderNumber,
  446. // shopId: that.shopId,
  447. // addressId: e.addressId,
  448. // status: 3
  449. }
  450. that.$Request.postT('/admin/order/accomplishOrder', data).then((res) => {
  451. if (res.code == 0) {
  452. uni.navigateBack()
  453. }
  454. })
  455. } else if (res.cancel) {
  456. console.log('用户点击取消')
  457. }
  458. }
  459. })
  460. },
  461. refund() {
  462. let that = this
  463. uni.showModal({
  464. title: '提示',
  465. content: '确认退款吗?',
  466. success: function (res) {
  467. if (res.confirm) {
  468. console.log('用户点击确定')
  469. let data = {
  470. orderId: that.dataDet.orderId
  471. }
  472. that.$Request.postA('/admin/order/adminCancelOrder', data).then((res) => {
  473. if (res.code == 0) {
  474. let pages = getCurrentPages() // 当前页面
  475. let beforePage = pages[pages.length - 2] // 上一页
  476. uni.navigateBack({
  477. success: function () {
  478. beforePage.onLoad() // 执行上一页的onLoad方法
  479. }
  480. })
  481. }
  482. })
  483. } else if (res.cancel) {
  484. console.log('用户点击取消')
  485. }
  486. }
  487. })
  488. },
  489. // 补打小票
  490. xiaoPiao() {
  491. let that = this
  492. uni.showModal({
  493. title: '提示',
  494. content: '确认补打小票吗?',
  495. success: function (re) {
  496. if (re.confirm) {
  497. console.log('用户点击确定')
  498. let data = {
  499. orderId: that.dataDet.orderId,
  500. isAppend: 1
  501. // orderNumber: e.orderNumber,
  502. // status: 8
  503. }
  504. that.$Request.post('/admin/order/print', data).then((res) => {
  505. if (res.code == 0) {
  506. // that.page = 1
  507. // that.getOrderList()
  508. } else {
  509. that.$queue.showToast(res.msg)
  510. }
  511. })
  512. } else if (re.cancel) {
  513. console.log('用户点击取消')
  514. }
  515. }
  516. })
  517. },
  518. finish(e) {
  519. let that = this
  520. uni.showModal({
  521. title: '提示',
  522. content: '确认订单完成吗?',
  523. success: function (res) {
  524. if (res.confirm) {
  525. console.log('用户点击确定')
  526. let data = {
  527. orderId: that.dataDet.orderId,
  528. orderNumber: that.dataDet.orderNumber,
  529. status: 3
  530. }
  531. that.$Request.postJsonA('/admin/order/updateOrder', data).then((res) => {
  532. if (res.code == 0) {
  533. let pages = getCurrentPages() // 当前页面
  534. let beforePage = pages[pages.length - 2] // 上一页
  535. uni.navigateBack({
  536. success: function () {
  537. beforePage.onLoad() // 执行上一页的onLoad方法
  538. }
  539. })
  540. }
  541. })
  542. } else if (res.cancel) {
  543. console.log('用户点击取消')
  544. }
  545. }
  546. })
  547. },
  548. peisong(e) {
  549. let that = this
  550. uni.showModal({
  551. title: '提示',
  552. content: '确认开始配送吗?',
  553. success: function (res) {
  554. if (res.confirm) {
  555. console.log('用户点击确定')
  556. let data = {
  557. orderId: that.dataDet.orderId,
  558. orderNumber: that.dataDet.orderNumber,
  559. status: 4
  560. }
  561. that.$Request.postJsonA('/admin/order/updateOrder', data).then((res) => {
  562. if (res.code == 0) {
  563. let pages = getCurrentPages() // 当前页面
  564. let beforePage = pages[pages.length - 2] // 上一页
  565. uni.navigateBack({
  566. success: function () {
  567. beforePage.onLoad() // 执行上一页的onLoad方法
  568. }
  569. })
  570. }
  571. })
  572. } else if (res.cancel) {
  573. console.log('用户点击取消')
  574. }
  575. }
  576. })
  577. },
  578. //获取用户聊天消息
  579. getShopUnreadCount() {
  580. let that = this
  581. let data = {
  582. ordersId: that.orderId
  583. }
  584. that.$Request.getT('/shop/ordersChat/selectShopUnreadCount', data).then((res) => {
  585. if (res.code == 0) {
  586. // that.ShopUnreadCount = res.data
  587. if (res.data > 0) {
  588. if (this.ShopUnreadCount != res.data && !this.first) {
  589. that.aplayAudio()
  590. this.ShopUnreadCount = res.data
  591. uni.showModal({
  592. title: '消息',
  593. content: '有' + res.data + '条消息,请前往聊天列表处理。',
  594. success: (ret) => {
  595. if (ret.confirm) {
  596. uni.redirectTo({
  597. url: '/pages/my/liaotian'
  598. })
  599. this.first = true
  600. } else {
  601. console.log('else', ret)
  602. that.defineCallBack()
  603. }
  604. }
  605. })
  606. // this.chatNum = data.data
  607. }
  608. } else {
  609. that.ShopUnreadCount = 0
  610. }
  611. }
  612. })
  613. },
  614. //消息提示
  615. aplayAudio() {
  616. // console.log('语音提示')
  617. const innerAudioContext = uni.createInnerAudioContext()
  618. innerAudioContext.autoplay = true
  619. innerAudioContext.src = 'https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3'
  620. innerAudioContext.onPlay(() => {
  621. console.log('开始播放')
  622. })
  623. innerAudioContext.onError((res) => {
  624. console.log(res.errMsg)
  625. console.log(res.errCode)
  626. })
  627. }
  628. }
  629. }
  630. </script>
  631. <style scoped>
  632. /* 余额 */
  633. .tosend {
  634. width: 100%;
  635. height: 280rpx;
  636. /* background: -webkit-linear-gradient(top, #FCD202, #F5F5F5); */
  637. }
  638. .tosend_text {
  639. padding: 3% 3% 0%;
  640. font-size: 38upx;
  641. font-weight: 800;
  642. color: #333333;
  643. }
  644. .tosend_header {
  645. width: 94%;
  646. background-color: #ffffff;
  647. margin: 0 auto;
  648. border-radius: 18rpx;
  649. padding: 3%;
  650. }
  651. /* 排序 */
  652. .cont_two_top {
  653. width: 100%;
  654. display: flex;
  655. justify-content: space-between;
  656. }
  657. .cont_two_top_le {
  658. font-size: 30rpx;
  659. font-weight: 500;
  660. color: #333333;
  661. }
  662. .cont_two_top_ri {
  663. padding: 6rpx 10rpx;
  664. text-align: center;
  665. background: rgba(255, 19, 10, 0.2);
  666. font-size: 24rpx;
  667. border: 2rpx solid #ff130a;
  668. color: #ff130a;
  669. opacity: 0.6;
  670. border-radius: 8rpx;
  671. }
  672. .cont_two_text {
  673. font-size: 56rpx;
  674. text-align: center;
  675. font-weight: bold;
  676. color: #333333;
  677. margin: 5% 0;
  678. line-height: 32rpx;
  679. }
  680. .cont_two_text2 {
  681. font-size: 30rpx;
  682. width: 100%;
  683. font-weight: 500;
  684. color: #333333;
  685. text-align: center;
  686. padding-bottom: 4%;
  687. line-height: 32rpx;
  688. border-bottom: 1rpx solid #e6e6e6;
  689. }
  690. .cont_two_text2 text {
  691. color: #ff130a;
  692. }
  693. /* 商品列表 */
  694. .tosend_header_text {
  695. font-family: PingFang SC;
  696. font-weight: 800;
  697. color: #333333;
  698. line-height: 2;
  699. font-size: 30rpx;
  700. }
  701. .tosend_header_food {
  702. width: 100%;
  703. display: flex;
  704. margin-top: 35rpx;
  705. justify-content: space-between;
  706. }
  707. .tosend_header_food_le {
  708. /* width: 15%; */
  709. }
  710. .tosend_header_food_le image {
  711. width: 135rpx;
  712. height: 135rpx;
  713. }
  714. .tosend_header_food_ce {
  715. /* margin: 0 0 0 4%; */
  716. width: 57%;
  717. margin-left: 10upx;
  718. }
  719. .tosend_header_food_ri {
  720. text-align: right;
  721. width: 25%;
  722. }
  723. .tosend_header_food_text {
  724. font-size: 34rpx;
  725. font-weight: 500;
  726. color: #333333;
  727. line-height: 1.8;
  728. overflow: hidden;
  729. text-overflow: ellipsis;
  730. white-space: nowrap;
  731. }
  732. .tosend_header_food_text text {
  733. font-size: 25rpx;
  734. }
  735. .tosend_header_food_text2 {
  736. font-size: 26rpx;
  737. /* font-weight: 500; */
  738. color: #999999;
  739. }
  740. .do_top {
  741. padding-top: 3%;
  742. }
  743. .do_bot {
  744. padding-bottom: 3%;
  745. border-bottom: 2rpx solid #e6e6e6;
  746. }
  747. .tosend_header_do {
  748. width: 100%;
  749. color: #333333;
  750. font-size: 30rpx;
  751. display: flex;
  752. line-height: 1.5;
  753. }
  754. .tosend_header_do view {
  755. flex: 1;
  756. }
  757. .tosend_header_do_ri {
  758. text-align: right;
  759. }
  760. .tosend_header_do_le2 {
  761. font-family: PingFang SC;
  762. font-weight: 500;
  763. color: #999999;
  764. padding-top: 1.5%;
  765. }
  766. .tosend_header_do_ri2 {
  767. text-align: right;
  768. color: #ea0000;
  769. font-size: 40rpx;
  770. }
  771. .tosend_header_do_ri2 text {
  772. font-size: 30rpx;
  773. }
  774. /* 其他信息 */
  775. .tosend_cont {
  776. width: 94%;
  777. background-color: #ffffff;
  778. margin: 3% auto;
  779. border-radius: 18rpx;
  780. padding: 3%;
  781. }
  782. .tosend_cont_infor {
  783. display: flex;
  784. margin-top: 30rpx;
  785. }
  786. .tosend_cont_infor_le {
  787. flex: 1;
  788. color: #999999;
  789. }
  790. .tosend_cont_infor_ri {
  791. flex: 2;
  792. text-align: right;
  793. color: #333333;
  794. }
  795. .tosend_cont_text {
  796. text-align: right;
  797. }
  798. .addgood {
  799. width: 685upx;
  800. height: 88upx;
  801. background: #ffcc00;
  802. border-radius: 8upx;
  803. text-align: center;
  804. line-height: 88rpx;
  805. margin: 40rpx auto;
  806. font-size: 32rpx;
  807. font-weight: bold;
  808. color: #ffffff;
  809. }
  810. .chats {
  811. position: fixed;
  812. bottom: 70px;
  813. right: 15px;
  814. }
  815. .chats image {
  816. width: 60px;
  817. height: 60px;
  818. }
  819. /* 联系骑手 */
  820. .rider_box {
  821. width: 95%;
  822. margin: 0 auto;
  823. background: #ffffff;
  824. margin-top: 20rpx;
  825. border-radius: 10rpx;
  826. }
  827. .rider_left image {
  828. width: 80rpx;
  829. height: 85rpx;
  830. border-radius: 60%;
  831. }
  832. .phone {
  833. background: #fd6416;
  834. color: #ffffff;
  835. padding: 8rpx 15rpx;
  836. border-radius: 13rpx;
  837. font-size: 24rpx;
  838. }
  839. .shopxiaoix {
  840. background: red;
  841. color: #ffffff;
  842. width: 40rpx;
  843. height: auto;
  844. text-align: center;
  845. border-radius: 30rpx;
  846. position: relative;
  847. top: -66px;
  848. left: 35px;
  849. }
  850. .btn {
  851. width: 690upx;
  852. height: 88upx;
  853. margin: 30upx auto;
  854. background: #fcd202;
  855. box-shadow: 0px 10upx 20upx 0upx #ffd9b3;
  856. border-radius: 16upx;
  857. display: flex;
  858. align-items: center;
  859. justify-content: center;
  860. color: #000000;
  861. }
  862. </style>