hisOrderDetail.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <view class="order-pages">
  3. <view class="order-info">
  4. <!-- 订单状态 -->
  5. <view class="order-status">
  6. <view class="status-title flex align_center justify_center">
  7. <view class="t-icon icon t-icon-icon_complete"></view>
  8. {{orderInfo.orderStateDictValue}}
  9. </view>
  10. <view class="status-care">
  11. 预约时间:2021-05-10 15:10:05
  12. </view>
  13. </view>
  14. <!-- 服务信息 -->
  15. <view class="info-main">
  16. <view class="flex align_center">
  17. <view class="new-left">
  18. 陕西省西安市未央区华
  19. 帝金座602室
  20. </view>
  21. </view>
  22. <view class="time flex align_center justify_between">
  23. <text>百果园(贞观路店)</text>
  24. <view class="flex align_center">
  25. <view class="t-icon phone t-icon-icon_phone"></view>
  26. <text>18092252287</text>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 预约信息 -->
  31. <view class="item-info">
  32. <view class="item flex justify_between">
  33. <text>预约品类</text>
  34. <text>纸品类,金属类</text>
  35. </view>
  36. <view class="item flex justify_between">
  37. <text>预约重量</text>
  38. <text>50-100kg</text>
  39. </view>
  40. </view>
  41. <!-- 订单信息 -->
  42. <view class="item-info">
  43. <!-- <view class="item flex justify_between">
  44. <text class="item-title">订单信息</text>
  45. </view> -->
  46. <view class="item flex justify_between">
  47. <text>订单编号</text>
  48. <text>202102022225</text>
  49. </view>
  50. <view class="item flex justify_between">
  51. <text>下单时间</text>
  52. <text>2021-04-19 15:33</text>
  53. </view>
  54. <view class="item flex justify_between">
  55. <text>服务时间</text>
  56. <text>2021-04-19 15:33</text>
  57. </view>
  58. </view>
  59. <!-- 图片 -->
  60. <view class="item-info">
  61. <view class="item flex justify_between">
  62. <text class="item-title">图片</text>
  63. </view>
  64. <view class="item flex">
  65. <u-image class="img-icon" :src="item.icon?item.icon:'../../static/img/mddef.jpg'" border-radius="16" width="160" height="160"></u-image>
  66. </view>
  67. </view>
  68. <!-- 回收品类明细 -->
  69. <view class="item-info">
  70. <view class="item flex justify_between">
  71. <text class="item-title">回收品类明细</text>
  72. </view>
  73. <view class="item flex">
  74. </view>
  75. </view>
  76. <!-- 金额 -->
  77. <view class="item-info">
  78. <view class="item flex justify_between">
  79. <text>应付金额</text>
  80. <text>22.20 元</text>
  81. </view>
  82. <view class="item flex justify_between">
  83. <text>支付方式</text>
  84. <text>线下</text>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import moment from 'moment'
  92. export default {
  93. data() {
  94. return {
  95. orderInfo: {
  96. id: '',
  97. createDate: '2021-05-10 15:22',
  98. orderStateDictValue: '已完成',
  99. storeName: '昆仑润滑·车领主 (西咸新区-...',
  100. location: '2.9km',
  101. orderState:'WAIT_PAY',
  102. orderGoodsList: [
  103. {
  104. goodsImages: '',
  105. goodsName: '水蜡免擦洗车(轿车)',
  106. payGold: 200,
  107. buyQty: 2,
  108. goodsNum: 5,
  109. },
  110. {
  111. goodsImages: '',
  112. goodsName: '水蜡免擦洗车(轿车)',
  113. payGold: 200,
  114. buyQty: 2,
  115. goodsNum: 5,
  116. },
  117. ],
  118. payGold: 450
  119. },
  120. totalPrice: 0, // 支付合计
  121. password: '', // 支付密码
  122. showSetPswModal: false, // 设置支付密码弹窗
  123. showInputPsw: false, // 打开输入密码弹窗
  124. showLeavePsw: false, // 打开确定放弃弹窗
  125. orderId: '', // 订单id
  126. leftTime: null,
  127. payFinish: false , // 是否支付成功
  128. focus: false
  129. }
  130. },
  131. onLoad(options) {
  132. // 监听设置密码是否成功
  133. uni.$once('setPswSuccess', this.setPsw)
  134. if (options.id) {
  135. console.log(options.id)
  136. this.orderId = options.id
  137. // this.getOrderDetail()
  138. }
  139. // 开启分享
  140. uni.showShareMenu({
  141. withShareTicket: true,
  142. menus: ['shareAppMessage', 'shareTimeline']
  143. })
  144. },
  145. computed: {
  146. },
  147. methods: {
  148. // 支付剩余时间
  149. leftTimeFun() {
  150. const date1 = moment().toArray() // 当前时间 数组形式
  151. const date2 = moment(this.orderInfo.orderTime).toDate() // 下单时间 日期格式
  152. const date3 = moment(date2).toArray() // 下单时间 数组形式
  153. const date4 = moment(date1).diff(moment(date3), 'seconds')//计算相差的秒数
  154. const tt = 30 - Math.ceil(date4/60) //向上取整
  155. if (tt > 0) {
  156. this.leftTime = tt
  157. } else {
  158. // this.getOrderDetail()
  159. this.leftTime = '00'
  160. }
  161. },
  162. // 获取订单详情
  163. getOrderDetail() {
  164. orderDetail({
  165. id: this.orderId
  166. }).then(res => {
  167. console.log(res,'rrrrrrrr')
  168. if (res.status == 200) {
  169. this.orderInfo = res.data
  170. if(this.orderInfo.orderState=='WAIT_PAY') {
  171. this.leftTimeFun()
  172. }
  173. }
  174. })
  175. },
  176. // 跳转到设置支付密码页
  177. toSetPwd () {
  178. uni.navigateTo({
  179. url:"/pages/userCenter/userInfo/smsVerification"
  180. })
  181. },
  182. // 设置密码成功, 打开输入密码弹窗
  183. setPsw (e) {
  184. if (e.success) {
  185. this.showInputPsw = true
  186. setTimeout(()=>{
  187. this.focus = true
  188. },300)
  189. }
  190. },
  191. // 关闭输入密码弹窗
  192. closePayModal(){
  193. if(!this.payFinish) {
  194. this.showLeavePsw = true
  195. }
  196. },
  197. //确认放弃
  198. canclePay() {
  199. this.password = ''
  200. this.showLeavePsw = false
  201. this.showInputPsw = false
  202. this.focus = false
  203. },
  204. // 继续支付
  205. payAgain () {
  206. this.focus = false
  207. this.showLeavePsw = false
  208. this.showInputPsw = true
  209. setTimeout(()=>{
  210. this.focus = true
  211. },300)
  212. },
  213. // 支付 判断用户是否设置过支付密码
  214. toPay() {
  215. this.totalPrice = this.orderInfo.originalGold
  216. this.payFinish = false
  217. // 判断用户是否设置过支付密码
  218. existPayPwd().then(res=>{
  219. console.log(res,'rrrrrr')
  220. if(res.status == 200) {
  221. // 设置过支付密码,输入密码
  222. if(res.data) {
  223. this.showInputPsw = true
  224. setTimeout(()=>{
  225. this.focus = true
  226. },300)
  227. } else {
  228. // 没设置过支付密码,提示设置密码
  229. this.showSetPswModal = true
  230. }
  231. }
  232. })
  233. },
  234. // 支付
  235. toPayOrder() {
  236. if (this.password === '') {
  237. uni.showToast({
  238. title: '请先输入支付密码',
  239. icon: 'none'
  240. })
  241. return false
  242. }
  243. let id = this.orderInfo.id
  244. let params = {
  245. payPwd: this.password,
  246. id: id
  247. }
  248. signPay(params).then(res=>{
  249. this.btnLoading = false
  250. if(res.status == 200) {
  251. // 关闭弹窗 刷新页面
  252. this.payFinish = true
  253. this.showInputPsw = false
  254. this.getOrderDetail()
  255. // 刷新订单列表
  256. uni.$emit('refresh')
  257. // 跳转到支付完成界面
  258. uni.navigateTo({
  259. url:"/pagesA/toOrder/payFinish?id=" + id
  260. })
  261. } else{
  262. this.password = ''
  263. }
  264. })
  265. },
  266. },
  267. }
  268. </script>
  269. <style lang="scss">
  270. .order-pages {
  271. width: 100%;
  272. height: 100vh;
  273. display: flex;
  274. flex-direction: column;
  275. background-color: #F5F5F5;
  276. .order-info {
  277. width: 100%;
  278. flex: 1;
  279. overflow-y: scroll;
  280. // 订单内容
  281. .info-main{
  282. background: #ffffff;
  283. padding: 10upx 32upx;
  284. margin: 20upx 32upx 0;
  285. border-radius: 24upx;
  286. box-shadow: 1px 1px 3px #EEEEEE;
  287. font-size: 28upx;
  288. background-image: url(../../static/home_bg_expressage.png);
  289. background-repeat: no-repeat;
  290. .new-left{
  291. width: 360rpx;
  292. font-size: 36rpx;
  293. color: #191919;
  294. font-weight: 600;
  295. line-height: 44rpx;
  296. margin-top: 30rpx;
  297. }
  298. .time{
  299. padding: 20rpx 0;
  300. font-size: 32rpx;
  301. color: #7C7D7E;
  302. }
  303. }
  304. // 状态
  305. .order-status {
  306. padding: 30upx 0;
  307. text-align: center;
  308. .status-title {
  309. font-size: 42upx;
  310. color: #191919;
  311. .icon{
  312. width: 48rpx;
  313. height: 48rpx;
  314. margin-right: 10rpx;
  315. }
  316. }
  317. .status-care {
  318. font-size: 28upx;
  319. margin-top: 10upx;
  320. color: #191919;
  321. >text {
  322. color: red;
  323. }
  324. }
  325. }
  326. // 订单信息列
  327. .item-info{
  328. border-radius: 24rpx;
  329. margin: 20rpx 32rpx 0;
  330. padding: 0rpx 32rpx;
  331. background-color: #fff;
  332. .item{
  333. padding: 28rpx 0;
  334. font-size: 32rpx;
  335. // border-bottom: 1px solid #EBEBEB;
  336. :first-child{
  337. color: #7C7D7E;
  338. }
  339. :last-child-child{
  340. color: #222222;
  341. }
  342. &:last-child{
  343. border-bottom: none;
  344. }
  345. .item-title{
  346. color: #181818;
  347. }
  348. }
  349. }
  350. .price-text {
  351. font-size: 20upx;
  352. margin-left: 10upx;
  353. }
  354. .price-num {
  355. font-size: 32upx;
  356. color: red;
  357. font-weight: 600;
  358. margin-right: 6rpx;
  359. }
  360. .u-cell {
  361. padding: 10rpx 32rpx;
  362. }
  363. }
  364. .footer {
  365. padding: 20rpx 32rpx;
  366. display: flex;
  367. background-color: #fff;
  368. .btn{
  369. flex: 1;
  370. height: 84rpx;
  371. font-size: 32rpx;
  372. text-align: center;
  373. line-height: 84rpx;
  374. }
  375. .btnCancleStyle{
  376. color: #666666;
  377. background: #E5E5E5;
  378. border-radius: 60rpx 0px 0px 60rpx;
  379. }
  380. .btnPayStyle{
  381. color: #191919;
  382. background: #FFD100;
  383. border-radius: 0rpx 60px 60px 0rpx;
  384. }
  385. .useBtn{
  386. width: 100%;
  387. height: 84rpx;
  388. font-size: 32rpx;
  389. text-align: center;
  390. line-height: 84rpx;
  391. color: #191919;
  392. background: #FFD100;
  393. border-radius: 60rpx
  394. }
  395. }
  396. }
  397. </style>