takeDetail.vue 10 KB

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