takeDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view class="padding">
  3. <view class="bg padding radius">
  4. <view class=" u-flex " @click="goNav('')">
  5. <view class="" style="width: 200rpx;height: 200rpx;">
  6. <image :src="order.orderTaking.headImg" style="width: 100%;height: 100%;"></image>
  7. </view>
  8. <view class="u-flex-1 text-white margin-left-xs">
  9. <view class="flex">
  10. <view v-if="order.orderTaking.authentication == 2">
  11. <image src="../../static/images/qi.png" style="width: 35rpx;height: 35rpx;"></image>
  12. </view>
  13. <view class="" v-if="order.orderTaking.authentication == 1">
  14. <image src="../../static/images/geren.png" style="width: 35rpx;height: 35rpx;">
  15. </image>
  16. </view>
  17. <view class="margin-right-xs text-df margin-left-xs"
  18. style="margin-top: -2px;display: inline-block;width: 400rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
  19. {{order.orderTaking.myLevel}}
  20. </view>
  21. </view>
  22. <view style="color: #999999;font-size: 24rpx;line-height: 40rpx;"
  23. v-if="order.orderTaking.authentication == 1">
  24. <text v-if="order.orderTaking.sex == 1">女</text>
  25. <text v-if="order.orderTaking.sex == 0">男</text>
  26. /<text>{{age}}岁</text>
  27. /<text>{{order.orderTaking.orderLevel}}</text>
  28. /<text>{{order.orderTaking.region}}</text>
  29. </view>
  30. <view style="color: #999999;line-height: 60rpx;" v-if="order.orderTaking.authentication == 2">
  31. <text>{{order.orderTaking.orderTakingUserName}}</text>/<text>{{order.orderTaking.region}}</text>
  32. </view>
  33. <view class="margin-top-xs ">
  34. <text class="padding-xs margin-right-xs text-sm"
  35. style="color: #FF1200;background-color: #FFEBF0;"
  36. v-for="(item,index) in order.orderTaking.gameId" :key="index">{{item}}</text>
  37. </view>
  38. <view style="color:#FF1200;font-size: 31rpx;margin-top: 20rpx;">
  39. ¥{{order.orderTaking.oldMoney}}/月
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="bg padding radius margin-top">
  45. <view class="text-lg text-bold">
  46. 服务信息
  47. </view>
  48. <view class="margin-left-sm margin-right-xs">
  49. <view class="flex justify-between margin-top-lg">
  50. <view style="width: 140upx;">服务类型</view>
  51. <view><text v-for="(item,index) in order.orderTaking.gameId" :key="index"
  52. class="margin-left-sm">{{item}}</text></view>
  53. </view>
  54. <view class="flex justify-between margin-top-lg">
  55. <view style="width: 140upx;">上户地址</view>
  56. <view class="text-white">
  57. <text>{{order.detailsAddress}}{{order.houseNumber}}</text>
  58. </view>
  59. </view>
  60. <view class="flex justify-between margin-top-lg">
  61. <view style="width: 140upx;">入离时间</view>
  62. <view class="text-white">
  63. <text>{{order.startTime}}至{{order.endTime}}</text>
  64. </view>
  65. </view>
  66. <view class="flex justify-between margin-top-lg">
  67. <view style="width: 140upx;">服务地点</view>
  68. <view class="flex">
  69. <view class="text-white">{{order.orderTaking.region}}
  70. </view>
  71. </view>
  72. </view>
  73. <view class="flex justify-between margin-top-lg">
  74. <view style="width: 140upx;">真实姓名</view>
  75. <view class="text-white">{{order.name}}</view>
  76. </view>
  77. <view class="flex justify-between margin-top-lg">
  78. <view style="width: 140upx;">联系方式</view>
  79. <view class="text-white" @click="bindphone()">{{order.phone}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="bg padding radius margin-top" style="margin-bottom: 140rpx;">
  84. <view class="text-lg text-bold">
  85. 订单信息
  86. </view>
  87. <view class="margin-left-sm margin-right-xs">
  88. <view class="flex justify-between margin-top-lg">
  89. <view style="width: 165rpx;">订单编号</view>
  90. <view class="text-white">{{order.ordersNo}}</view>
  91. </view>
  92. <view class="flex justify-between margin-top-lg">
  93. <view style="width: 165rpx;">下单时间</view>
  94. <view class="text-white">{{order.createTime}}</view>
  95. </view>
  96. <!-- <view class="flex justify-between margin-top-lg">
  97. <view style="width: 120upx;">支付方式</view>
  98. <view class="text-white">{{order.createTime}}</view>
  99. </view>
  100. -->
  101. </view>
  102. </view>
  103. <!-- <view class="flex tabber padding-top-sm padding-bottom-sm align-center" v-if="isTrue == 0">
  104. <u-button @click="cancelOrder(order)" shape="circle" class="margin-right-sm " :custom-style="customStyle"
  105. :hair-line="false">取消订单
  106. </u-button>
  107. <u-button @click="pay" class="margin-right-sm " shape="circle" :custom-style="customStyle2"
  108. :hair-line="false">立即支付
  109. </u-button>
  110. </view> -->
  111. <view class="flex tabber padding-top-sm padding-bottom-sm align-center margin-right-xs padding-right"
  112. v-if="order.state ==1">
  113. <u-button v-if="order.state == 1" :custom-style="customStyle" shape="circle" :plain="true"
  114. @click="cancelOrder(order,3)">拒接接单</u-button>
  115. <!-- <u-button v-if="item.state == 3" :custom-style="customStyle" shape="circle" :plain="true" @click="delOrder(item)">拒接接单</u-button> -->
  116. <u-button v-if="order.state == 1" :custom-style="customStyle1" shape="circle" :plain="true"
  117. @click="cancelOrder(order,2)">完成接单</u-button>
  118. <!-- <u-button :custom-style="customStyle" shape="circle" :plain="true" @click="clickItem(item)">联系TA
  119. </u-button> -->
  120. </view>
  121. </view>
  122. </template>
  123. <script>
  124. export default {
  125. data() {
  126. return {
  127. customStyle: {
  128. color: '#999999',
  129. border: '2rpx solid #999999',
  130. // backgroundColor: '#1E1F31',
  131. border: "8rpx",
  132. width: '180rpx',
  133. height: '54rpx',
  134. margin: "0 0 0 20rpx"
  135. },
  136. customStyle1: {
  137. color: '#557EFD',
  138. border: '2rpx solid #557EFD',
  139. // backgroundColor: '#1E1F31',
  140. border: "8rpx",
  141. width: '180rpx',
  142. height: '54rpx',
  143. margin: "0 0 0 20rpx"
  144. },
  145. id: '',
  146. order: {
  147. user: {},
  148. game: {}
  149. },
  150. isTrue: 0,
  151. vipMoney: '',
  152. data: [],
  153. price: '',
  154. age: 0,
  155. birthDate: ''
  156. }
  157. },
  158. onLoad(e) {
  159. console.log(e)
  160. var jsObject = JSON.stringify(e);
  161. console.log(jsObject)
  162. this.isTrue = e.isTrue
  163. if (this.isTrue) {
  164. uni.setNavigationBarTitle({
  165. title: '订单详情'
  166. })
  167. }
  168. this.id = e.id
  169. this.getOrder()
  170. },
  171. methods: {
  172. //换算年龄
  173. getAge(e) {
  174. console.log('出生日期:' + e)
  175. this.birthDate = e
  176. //创建系统日期
  177. var today = new Date();
  178. //把出生日期转换成日期
  179. this.birthDate = new Date(this.birthDate);
  180. //分别获取到年份后相减
  181. this.age = today.getFullYear() - this.birthDate.getFullYear();
  182. // console.log(this.age+'当前年龄')
  183. },
  184. // 拨打电话
  185. bindphone() {
  186. let that = this
  187. uni.showModal({
  188. title: '提示',
  189. content: '是否拨打电话',
  190. success: function(res) {
  191. if (res.confirm) {
  192. console.log('用户点击确定', that.phone);
  193. uni.makePhoneCall({
  194. phoneNumber: that.phone //仅为示例
  195. });
  196. } else if (res.cancel) {
  197. console.log('用户点击取消');
  198. }
  199. }
  200. });
  201. },
  202. goNav(e) {
  203. uni.navigateTo({
  204. url: e
  205. })
  206. },
  207. getOrder() {
  208. let data = {
  209. id: this.id
  210. }
  211. this.$Request.get('/app/orders/queryOrders', data).then(res => {
  212. if (res.code == 0) {
  213. this.order = res.data
  214. // this.order.orderTaking.gameName = this.order.orderTaking.gameName.split(",");
  215. this.order.orderTaking.gameId = this.order.orderTaking.gameId.split(",");
  216. // this.order.orderTaking.region = this.order.orderTaking.region.split(",");
  217. if (this.order.orderTaking.region) {
  218. let region = this.order.orderTaking.region.split(",");
  219. this.order.orderTaking.region = region[1]
  220. } else {
  221. this.order.orderTaking.region = '不限地区'
  222. }
  223. this.price = (res.data.orderTaking.oldMoney * res.data.orderNumber)
  224. .toFixed(2)
  225. this.vipMoney = (res.data.orderTaking.money * res.data.orderNumber - res.data.payMoney * 1)
  226. .toFixed(2)
  227. this.getAge(this.order.orderTaking.birthdate)
  228. console.log(this.vipMoney, 'vipvipvipv')
  229. }
  230. })
  231. },
  232. // 取消订单
  233. cancelOrder(e, status) {
  234. let that = this
  235. let content = ''
  236. if (status == 3) {
  237. content = '确定拒绝接单吗?'
  238. } else if (status == 2) {
  239. content = '确定订单已经完成吗?如果未完成,客户投诉将采取封号处理'
  240. }
  241. uni.showModal({
  242. title: '提示',
  243. content: content,
  244. success: function(res) {
  245. if (res.confirm) {
  246. let data = {
  247. id: e.ordersId,
  248. status
  249. }
  250. that.$Request.get('/app/orders/cancelOrder', data).then(res => {
  251. if (res.code == 0) {
  252. that.getOrder()
  253. }
  254. })
  255. }
  256. },
  257. })
  258. },
  259. // 支付订单
  260. pay() {
  261. let that = this
  262. uni.showModal({
  263. title: '付款提示',
  264. content: '确认支付' + that.order.payMoney + '元吗?',
  265. success: function(re) {
  266. if (re.confirm) {
  267. console.log('用户点击确定');
  268. that.$Request.post("/app/orders/payMoney", {
  269. ordersId: that.order.ordersId,
  270. }).then(res => {
  271. if (res.code == 0) {
  272. uni.showToast({
  273. title: '支付成功'
  274. })
  275. setTimeout(function() {
  276. uni.navigateBack()
  277. }, 1000)
  278. } else {
  279. uni.showToast({
  280. title: res.msg,
  281. icon: 'none'
  282. })
  283. }
  284. });
  285. } else if (re.cancel) {
  286. console.log('用户点击取消');
  287. }
  288. }
  289. })
  290. },
  291. // 取消订单
  292. // cancelOrder(e) {
  293. // let data = {
  294. // id: e.ordersId,
  295. // status: '3'
  296. // }
  297. // this.$Request.get('/app/orders/cancelOrder', data).then(res => {
  298. // if (res.code == 0) {
  299. // uni.showToast({
  300. // title: '取消成功',
  301. // icon: 'none'
  302. // })
  303. // setTimeout(function() {
  304. // uni.navigateBack()
  305. // }, 1000)
  306. // }
  307. // })
  308. // },
  309. goMsg() {
  310. let data = {
  311. userId: uni.getStorageSync('userId'),
  312. focusedUserId: this.order.user.userId
  313. }
  314. this.$Request.postJson('/app/chat/insertChatConversation ', data).then(res => {
  315. if (res.code == 0) {
  316. let id = this.order.user.userId == res.data.userId ? res.data.focusedUserId : this.order
  317. .user.userId
  318. uni.navigateTo({
  319. url: '/pages/msg/im?chatConversationId=' + res.data.chatConversationId +
  320. '&byUserId=' + id
  321. })
  322. }
  323. })
  324. },
  325. }
  326. }
  327. </script>
  328. <style>
  329. page {
  330. background: #f7f7f7;
  331. }
  332. .bg {
  333. background: #FFFFFF;
  334. }
  335. .tabber {
  336. width: 100%;
  337. background: #ffffff;
  338. position: fixed;
  339. bottom: 0;
  340. left: 0;
  341. right: 0;
  342. justify-content: flex-end;
  343. height: 127rpx;
  344. }
  345. </style>