detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <template>
  2. <view class="wrap">
  3. <navbar :iSimmersive="false" title-color="#ffffff" background="#1b43c4" :placeholder="true" title="订单详情"></navbar>
  4. <info v-if="isError"></info>
  5. <view v-if="!isError">
  6. <view class="top" v-if="order.shipping_type == 1">
  7. <view class="status">
  8. <uni-steps :options="stepsOptions" active-color="#07c160" :active="active" />
  9. </view>
  10. <view class="address">
  11. <view class="info">
  12. <text>收件人:{{order.accept_name}}</text>
  13. <text>手机号:{{order.mobile}}</text>
  14. </view>
  15. <view class="address-info">
  16. {{order.region}} {{order.address}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="top" v-if="order.shipping_type == 2">
  21. <view class="status">
  22. <uni-steps :options="stepsShopOptions" active-color="#07c160" :active="active" />
  23. </view>
  24. </view>
  25. <view class="order" v-if="order.shipping_type == 2">
  26. <view class="title">
  27. <text>核销信息</text>
  28. </view>
  29. <view class="shop-box">
  30. <view class="qrcode">
  31. <image :src="order.qrcode"></image>
  32. </view>
  33. <view class="code">{{order.code}}</view>
  34. </view>
  35. <view class="shop-address">
  36. <view>门店名称:{{order.shop_name}}</view>
  37. <view>营业时间:{{order.day_time}}</view>
  38. <view>门店电话:{{order.phone}}</view>
  39. </view>
  40. <view class="shop-address">
  41. <view>取件地址:</view>
  42. <view>
  43. <text>{{order.area_name}}</text>
  44. <text>{{order.shop_address}}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="goods">
  49. <view class="title">
  50. <text>共{{order.item.length}}件商品</text>
  51. </view>
  52. <view class="goods-box">
  53. <view
  54. class="goods-item clear"
  55. v-for="(value,index) in order.item"
  56. :key="index"
  57. @click="goGoods(value.goods_id)"
  58. >
  59. <view class="goods-img">
  60. <image :src="value.thumb_image">
  61. </view>
  62. <view class="goods-info">
  63. <view class="t">
  64. <text>{{value.title}}</text>
  65. <text>¥{{value.sell_price}}</text>
  66. </view>
  67. <view class="b">
  68. <text>{{value.spec}}</text>
  69. <text>× {{value.nums}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="order" v-if="order.goods_info" v-for="(value,index) in order.goods_info" :key="index">
  76. <view class="title">
  77. <text>商品信息</text>
  78. </view>
  79. <view class="shop-address">
  80. <view>商品名称:</view>
  81. <view>
  82. <text style="word-wrap: break-word;">{{value.title}}</text>
  83. </view>
  84. </view>
  85. <view class="shop-address" v-if="value.type==1">
  86. <view>商品内容:</view>
  87. <view>
  88. <text style="word-wrap: break-word;">{{value.content}}</text>
  89. </view>
  90. <view style="padding-top: 10rpx;">
  91. <button style="background-color: #1b43c4;color: #fff;" @click="scopy(value.content)">复制内容</button>
  92. </view>
  93. </view>
  94. <view class="shop-address" v-if="value.type==2">
  95. <view>商品内容:</view>
  96. <view>
  97. <text style="word-wrap: break-word;">{{value.content}}</text>
  98. </view>
  99. <view style="padding-top: 10rpx;">
  100. <button style="background-color: #1b43c4;color: #fff;" @click="scopy(value.content)">复制内容</button>
  101. </view>
  102. </view>
  103. <view class="shop-address" v-if="value.type==3">
  104. <view>
  105. <button style="background-color: #1b43c4;color: #fff;" @click="downLoad(value.content)">下载内容</button>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="order">
  110. <view class="title">
  111. <text>订单信息</text>
  112. </view>
  113. <view class="list clear">
  114. <view class="list-box clear">
  115. <view>订单编号:</view>
  116. <view class="money">{{order.order_no}}</view>
  117. </view>
  118. <view class="list-box clear">
  119. <view>下单时间:</view>
  120. <view>{{order.create_time}}</view>
  121. </view>
  122. <view class="list-box clear">
  123. <view>订单类型:</view>
  124. <view>{{order.type}}</view>
  125. </view>
  126. <view class="list-box clear">
  127. <view>支付状态:</view>
  128. <view class="money">{{order.pay_status}}</view>
  129. </view>
  130. <view class="list-box clear">
  131. <view>支付方式:</view>
  132. <view class="money">{{order.pay_type}}</view>
  133. </view>
  134. </view>
  135. </view>
  136. <view class="order">
  137. <view class="list clear">
  138. <view class="list-box clear">
  139. <view>商品金额:</view>
  140. <view>{{order.real_amount}}</view>
  141. </view>
  142. <view class="list-box clear">
  143. <view>运费金额:</view>
  144. <view>{{order.payable_freight}}</view>
  145. </view>
  146. <view class="list-box clear">
  147. <view>订单总额:</view>
  148. <view class="money">{{order.order_amount}}</view>
  149. </view>
  150. </view>
  151. </view>
  152. <view class="order" v-if="order.order_status==1">
  153. <view class="title">
  154. <text>支付方式</text>
  155. </view>
  156. <view class="payment-box">
  157. <view
  158. v-for="(item,index) in providerList"
  159. :key="index"
  160. class="payment-item"
  161. @click="selectPayment(item.id)"
  162. >
  163. <view><text class="iconfont pay" :id="item.id" :class="item.class"></text></view>
  164. <view :class="{activeColor:payment == item.id}">{{item.name}}<text v-if="item.id == 'balance'" style="padding-left: 15rpx; padding-top: 2rpx; font-size: 24rpx;">可用余额: ¥{{order.users_price}}元</text></view>
  165. <view :class="{active:payment == item.id}"><text class="iconfont">&#xe631;</text></view>
  166. </view>
  167. </view>
  168. </view>
  169. <view v-if="active != 4">
  170. <view class="operation-placeholder"></view>
  171. <view class="operation">
  172. <text class="cancel" v-if="order.order_status==1" @click="cancel">取消订单</text>
  173. <text class="pay" v-if="order.order_status==1" @click="goPay">立即付款</text>
  174. <text class="confirm" v-if="order.order_status == 2 || order.order_status==3 || order.order_status==4" @click="confirm">确认收货</text>
  175. <text class="refund" v-if="order.order_status == 2 || order.order_status==3 || order.order_status==4" @click="refund">申请退款</text>
  176. <text class="evaluate" v-if="order.order_status==5" @click="evaluate">待评价</text>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. </template>
  182. <script>
  183. import info from '@/components/tool/info.vue'
  184. import uniSteps from '@/components/uni-steps/uni-steps.vue'
  185. import subscribe from "@/common/subscribe";
  186. import payment from '@/common/payment';
  187. export default {
  188. components:{
  189. info,uniSteps
  190. },
  191. data(){
  192. return {
  193. isError: false,
  194. orderId: 0,
  195. active: 0,
  196. stepsOptions:[
  197. {
  198. title: '待付款'
  199. },{
  200. title: '待发货'
  201. },{
  202. title: '待收货'
  203. },{
  204. title: '待评价'
  205. },{
  206. title: '已完成'
  207. }
  208. ],
  209. stepsShopOptions:[
  210. {
  211. title: '待付款'
  212. },{
  213. title: '待发货'
  214. },{
  215. title: '待取货'
  216. },{
  217. title: '待评价'
  218. },{
  219. title: '已完成'
  220. }
  221. ],
  222. payment: "wechat",
  223. order:{
  224. accept_name: "",
  225. address: "",
  226. create_time: "",
  227. item: [],
  228. mobile: "",
  229. order_amount: "",
  230. order_no: "",
  231. pay_status: "",
  232. pay_type: "",
  233. payable_freight: '',
  234. payable_amount: "",
  235. promotions: "",
  236. real_amount: "",
  237. region: "",
  238. type: "",
  239. users_price:"0.00",
  240. order_status: 1,
  241. shipping_type: 0,
  242. qrcode: "",
  243. code: "",
  244. area_name: "",
  245. shop_name: "",
  246. phone: "",
  247. shop_address: "",
  248. day_time: "",
  249. goods_info: []
  250. },
  251. providerList: []
  252. };
  253. },
  254. onLoad(options) {
  255. this.isError = false;
  256. this.orderId = options.id;
  257. this.$http.getOrderDetail({
  258. id: this.orderId
  259. }).then((res)=>{
  260. this.isError = false;
  261. if(res.status){
  262. this.active = res.data.active;
  263. this.order = res.data;
  264. }else{
  265. this.isError = true;
  266. }
  267. }).catch((err)=>{
  268. this.isError = true;
  269. });
  270. payment.getPaymentList().then(res=>{
  271. this.providerList = res;
  272. })
  273. subscribe.order();
  274. },
  275. onBackPress(e) {
  276. this.$utils.navigateTo('order/list',{ id: 1 });
  277. return true;
  278. },
  279. methods: {
  280. scopy(content){
  281. this.$utils.iCopy(content).then(res=>{
  282. this.$utils.msg(res);
  283. }).catch(err=>{
  284. this.$utils.msg(err);
  285. });
  286. },
  287. downLoad(saveUrl){
  288. let that = this;
  289. uni.downloadFile({
  290. url: saveUrl,
  291. success: (res) => {
  292. if (res.statusCode === 200) {
  293. console.log('下载成功');
  294. }
  295. // #ifdef H5
  296. that.$utils.msg("已将文件保存在:"+res.tempFilePath);
  297. // #endif
  298. // #ifndef H5
  299. uni.saveFile({
  300. tempFilePath: res.tempFilePath,
  301. success: function(file) {
  302. that.$utils.msg("已将文件保存在:"+file.savedFilePath);
  303. }
  304. });
  305. // #endif
  306. }
  307. });
  308. },
  309. goGoods(goods_id){
  310. this.$utils.navigateTo("goods/view",{
  311. id: goods_id
  312. });
  313. },
  314. selectPayment(value){
  315. this.payment = value;
  316. },
  317. goPay(){
  318. this.$utils.showLoading();
  319. this.$http.getOrderDetailPayment({
  320. order_id: this.orderId,
  321. payment_id: this.payment,
  322. source: payment.getPaymentType(),
  323. // #ifdef H5
  324. url: document.location.href
  325. // #endif
  326. }).then(res=>{
  327. this.$utils.hideLoading();
  328. if(res.status){
  329. payment.setPayType("order").crreateOrder(res.data);
  330. }else{
  331. this.$utils.msg(res.info);
  332. }
  333. }).catch(err=>{
  334. this.$utils.hideLoading();
  335. this.$utils.msg("网络出错,请检查网络是否连接");
  336. });
  337. },
  338. confirm(){
  339. this.$utils.navigateTo("order/confirm_delivery",{
  340. id: this.orderId
  341. });
  342. },
  343. refund(){
  344. this.$utils.navigateTo("order/refund",{
  345. id: this.orderId
  346. });
  347. },
  348. evaluate(){
  349. this.$utils.navigateTo("order/evaluate",{
  350. id: this.orderId
  351. });
  352. },
  353. cancel(){
  354. this.$utils.showLoading();
  355. this.$http.getOrderDetailCancel({
  356. order_id: this.orderId
  357. }).then(res=>{
  358. this.$utils.hideLoading();
  359. if(res.status){
  360. this.$utils.msg(res.info);
  361. this.$utils.navigateTo("order/list",{ id: 1 });
  362. }else{
  363. this.$utils.msg(res.info);
  364. }
  365. }).catch(err=>{
  366. this.$utils.hideLoading();
  367. this.$utils.msg("网络出错,请检查网络是否连接");
  368. });
  369. }
  370. },
  371. }
  372. </script>
  373. <style lang="scss" scoped>
  374. .shop-address {
  375. width: 92%; margin: 0 auto;
  376. padding: 20rpx 0 0 0; font-size: 28rpx; color: #333;
  377. text { padding-right: 20rpx; }
  378. }
  379. .shop-box {
  380. width: 100%; background-color: #fff;
  381. .qrcode {
  382. width: 80%;
  383. height: 370rpx;
  384. background-color: #f5eff0;
  385. margin: 40rpx auto 0 auto;
  386. border-radius: 20rpx;
  387. position: relative;
  388. image {
  389. position: absolute;
  390. top: 50%; left: 50%;
  391. transform: translate(-50%,-50%);
  392. margin: 0 auto;
  393. display: block;
  394. width: 300rpx; height: 300rpx;
  395. }
  396. }
  397. .code {
  398. width: 80%;
  399. height: 100rpx;
  400. line-height: 100rpx;
  401. font-size: 50rpx;
  402. text-align: center;
  403. margin: 0 auto 20rpx auto;
  404. background-color: #1b43c4;
  405. color: #fff;
  406. border-radius: 20rpx;
  407. position: relative;
  408. &:before {
  409. width: 34rpx; height: 34rpx; display: inline-block;
  410. content: " "; position: absolute; right: -18rpx; top: -14rpx;
  411. border-radius: 50%; background-color: #fff;
  412. }
  413. &:after {
  414. width: 34rpx; height: 34rpx; display: inline-block;
  415. content: " "; position: absolute; left: -18rpx; top: -14rpx;
  416. border-radius: 50%; background-color: #fff;
  417. }
  418. }
  419. }
  420. .top{
  421. background-color: #fff;
  422. position: relative;
  423. &:before{
  424. position: absolute;
  425. right: 0;
  426. bottom: 0;
  427. left: 0;
  428. height: 4rpx;
  429. background: -webkit-repeating-linear-gradient(135deg,#ff6c6c 0,#ff6c6c 20%,transparent 0,transparent 25%,#1989fa 0,#1989fa 45%,transparent 0,transparent 50%);
  430. background: repeating-linear-gradient(-45deg,#ff6c6c 0,#ff6c6c 20%,transparent 0,transparent 25%,#1989fa 0,#1989fa 45%,transparent 0,transparent 50%);
  431. background-size: 160rpx;
  432. content: '';
  433. }
  434. .status{
  435. width: 100%;
  436. margin: 0 auto;
  437. padding: 10rpx 0;
  438. }
  439. .address{
  440. font-size: 28rpx;
  441. width: 92%;
  442. margin: 0 auto;
  443. .info{
  444. height: 60rpx;
  445. line-height: 60rpx;
  446. span:first-child{
  447. padding-right: 20rpx;
  448. }
  449. span:last-child{
  450. }
  451. }
  452. .address-info{
  453. height: 60rpx;
  454. line-height: 40rpx;
  455. }
  456. }
  457. }
  458. .goods{
  459. background-color: #fff;
  460. margin-top: 30rpx;
  461. padding-bottom: 20rpx;
  462. .title{
  463. width: 100%;
  464. margin: 0 auto;
  465. color: #666;
  466. font-size: 28rpx;
  467. height: 80rpx;
  468. line-height: 80rpx;
  469. border-bottom: 2rpx solid #eee;
  470. text {
  471. padding-left: 20rpx;
  472. }
  473. }
  474. .goods-box{
  475. padding: 0 32rpx;
  476. .goods-item {
  477. padding-top: 20rpx;
  478. .goods-img {
  479. width: 154rpx;
  480. height: 154rpx;
  481. display: inline-block;
  482. float: left;
  483. image{
  484. width: 100%;
  485. height: 100%;
  486. }
  487. }
  488. .goods-info {
  489. display: inline-block;
  490. width: 72%;
  491. font-size: 28rpx;
  492. float: right;
  493. .t {
  494. width: 100%;
  495. height: 90rpx;
  496. text:first-child{
  497. float: left;
  498. display: -webkit-box;overflow: hidden;-webkit-line-clamp: 2;
  499. -webkit-box-orient: vertical;
  500. width: 70%;
  501. }
  502. text:last-child{
  503. width: 30%;
  504. float: right;
  505. text-align: right;
  506. }
  507. }
  508. .b{
  509. width: 100%;
  510. height: 80rpx;
  511. font-size: 26rpx;
  512. text:first-child{
  513. float: left;
  514. color: #999;
  515. }
  516. text:last-child{
  517. float: right;
  518. color: #666;
  519. }
  520. }
  521. }
  522. }
  523. }
  524. }
  525. .order{
  526. background-color: #fff;
  527. margin-top: 30rpx;
  528. padding-bottom: 20rpx;
  529. .title{
  530. width: 100%;
  531. margin: 0 auto;
  532. color: #666;
  533. font-size: 30rpx;
  534. height: 80rpx;
  535. line-height: 80rpx;
  536. border-bottom: 2rpx solid #eee;
  537. text {
  538. padding-left: 30rpx;
  539. }
  540. }
  541. .list {
  542. width: 100%;
  543. .list-box{
  544. width: 92%;
  545. height: auto !important;
  546. height: 80rpx;
  547. min-height: 80rpx;
  548. line-height: 80rpx;
  549. margin: 0 auto;
  550. font-size: 26rpx; color: #333;
  551. border-bottom: 2rpx solid #ebedf0;
  552. view{ display: inline-block; }
  553. view:first-child { float: left; }
  554. view:last-child { float: right; }
  555. textarea { height: 150rpx; }
  556. }
  557. }
  558. }
  559. .operation-placeholder{
  560. width: 100%;
  561. height: 140rpx;
  562. line-height: 140rpx;
  563. }
  564. .operation{
  565. width: 100%;
  566. height: 110rpx;
  567. line-height: 110rpx;
  568. text-align: right;
  569. background-color: #fff;
  570. position: fixed;
  571. left: 0;
  572. bottom: 0;
  573. border-top: 2rpx solid #eee;
  574. text{
  575. font-size: 28rpx;
  576. text-align: center;
  577. border-radius: 30rpx;
  578. background-color: #fff;
  579. padding: 16rpx 30rpx;
  580. margin-right: 20rpx;
  581. }
  582. text.cancel{
  583. color: #333;
  584. border: 2rpx solid #ddd;
  585. }
  586. text.pay {
  587. background-color: #e93323;
  588. color: #fff;
  589. }
  590. .confirm{
  591. color: #fff;
  592. background-color: #1b43c4;
  593. }
  594. .refund{
  595. color: #1b43c4;
  596. background-color: #fff;
  597. border: 1px solid #1b43c4;
  598. }
  599. .evaluate{
  600. color: #fff;
  601. background-color: #009688;
  602. }
  603. }
  604. .payment-box{
  605. .payment-item{
  606. padding: 20rpx 32rpx;
  607. border-bottom: 2rpx solid #eee;
  608. view { display: inline; }
  609. view:first-child{
  610. font-size: 28rpx;
  611. text{
  612. width: 40rpx;
  613. height: 40rpx;
  614. line-height: 40rpx;
  615. text-align: center;
  616. border-radius:50%;
  617. padding: 4rpx;
  618. }
  619. }
  620. view:nth-child(2){
  621. font-size: 28rpx;
  622. padding-left: 20rpx;
  623. i{
  624. font-size: 24rpx;
  625. font-style: normal;
  626. color: #999;
  627. padding-left: 20rpx;
  628. }
  629. }
  630. view:nth-child(3){
  631. float: right;
  632. display: none;
  633. color: #999;
  634. }
  635. view.active{
  636. display: block;
  637. }
  638. view.activeColor{
  639. color: red;
  640. }
  641. }
  642. #wechat{
  643. position: relative;
  644. top: 2rpx;
  645. width: 40rpx;
  646. height: 40rpx;
  647. display: inline-block;
  648. color: #fff;
  649. background-color: #41b035;
  650. }
  651. #alipay{
  652. position: relative;
  653. top: 2rpx;
  654. width: 40rpx;
  655. height: 40rpx;
  656. display: inline-block;
  657. color: #fff;
  658. background-color: #1296db;
  659. }
  660. #appleiap{
  661. position: relative;
  662. top: 2rpx;
  663. width: 40rpx;
  664. height: 40rpx;
  665. display: inline-block;
  666. color: #333;
  667. background-color: #fff;
  668. border: 1px solid #eee;
  669. }
  670. #balance{
  671. position: relative;
  672. top: 2rpx;
  673. width: 40rpx;
  674. height: 40rpx;
  675. background-repeat: no-repeat;
  676. background-size: 40rpx 40rpx;
  677. display: inline-block;
  678. color: #fff;
  679. background-color: #fe960f;
  680. }
  681. .check {
  682. position: relative;
  683. top: 12rpx;
  684. width: 40rpx;
  685. height: 40rpx;
  686. display: inline-block;
  687. }
  688. }
  689. </style>