waitOrderDetail.vue 9.6 KB

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