index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. <template>
  2. <view :data-theme="theme">
  3. <view class='order-details'>
  4. <!-- 给header上与data上加on为退款订单-->
  5. <view class='header bg_color'>
  6. <view class='picTxt acea-row row-middle'>
  7. <view class='data'>
  8. <view v-if="orderInfo.refundStatus == 3" class='state'>已退款</view>
  9. <view v-else class='state'>{{orderInfo.status | orderStatusFilter}}</view>
  10. <view v-if="orderInfo.refundReasonTime !== null">{{orderInfo.refundReasonTime}}</view>
  11. <view v-if="orderInfo.createTime && orderInfo.status>0">{{orderInfo.createTime}}</view>
  12. <view v-if="orderInfo.status===0">请在{{orderInfo.expirationTime}}前完成支付!</view>
  13. </view>
  14. <view class="">
  15. <image class="orderStatusPng" :src="urlDomain+`crmebimage/presets/orderStatus/${statusPng[orderInfo.status]}.png`" mode=""></image>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="borderPad" style="margin: -100rpx auto 0 auto;">
  20. <view v-if="orderInfo.status!==9 && (shippingType ===1 || shippingType ===3) && orderInfo.refundStatus !== 3" class='nav'>
  21. <view class='navCon acea-row row-between-wrapper'>
  22. <view :class="orderInfo.status == 0 ?'on':''">待付款</view>
  23. <view :class="orderInfo.status == 1 ? 'on':''">待发货</view>
  24. <view :class="orderInfo.status == 4 ? 'on':''">待收货</view>
  25. <view :class="orderInfo.status == 5 ? 'on':''">已收货</view>
  26. <view :class="orderInfo.status == 6 ? 'on':''">已完成</view>
  27. </view>
  28. <!-- 订单状态(0:待支付,1:待发货,2:部分发货, 3:待核销,4:待收货,5:已收货,6:已完成,9:已取消) -->
  29. <view class='progress acea-row row-between-wrapper'>
  30. <view class='iconfont'
  31. :class='(orderInfo.status == 0 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 0 ? "font_color":"")'>
  32. </view>
  33. <view class='line' :class='orderInfo.status > 0 ? "bg_color":""'></view>
  34. <view class='iconfont'
  35. :class='(orderInfo.status == 1 ? "icon-webicon318":"icon-yuandianxiao") + " " +(orderInfo.status >= 1 ? "font_color":"")'>
  36. </view>
  37. <view class='line' :class='orderInfo.status > 2 ? "bg_color":""'></view>
  38. <view class='iconfont'
  39. :class='(orderInfo.status == 4 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 4 ? "font_color":"")'>
  40. </view>
  41. <view class='line' :class='orderInfo.status > 4 ? "bg_color":""'></view>
  42. <view class='iconfont'
  43. :class='(orderInfo.status == 5 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 5 ? "font_color":"")'>
  44. </view>
  45. <view class='line' :class='orderInfo.status > 5 ? "bg_color":""'></view>
  46. <view class='iconfont'
  47. :class='(orderInfo.status == 6 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 6 ? "font_color":"")'>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-if="shippingType ===2 && orderInfo.refundStatus !== 3" class='nav'>
  52. <view class='navCon acea-row row-between-wrapper'>
  53. <view :class="orderInfo.status == 0 ?'on':''">待付款</view>
  54. <view :class="orderInfo.status == 3 ? 'on':''">待核销</view>
  55. <view :class="orderInfo.status == 6 ? 'on':''">已收货</view>
  56. </view>
  57. <!-- 订单状态(0:待支付,1:待发货,2:部分发货, 3:待核销,4:待收货,5:已收货,6:已完成,9:已取消) -->
  58. <view class='progress acea-row row-between-wrapper'>
  59. <view class='iconfont'
  60. :class='(orderInfo.status == 0 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 0 ? "font_color":"")'>
  61. </view>
  62. <view class='line' :class='orderInfo.status > 0 ? "bg_color":""'></view>
  63. <view class='iconfont'
  64. :class='(orderInfo.status == 3 ? "icon-webicon318":"icon-yuandianxiao") + " " +(orderInfo.status >= 3 ? "font_color":"")'>
  65. </view>
  66. <view class='line' :class='orderInfo.status > 4 ? "bg_color":""'></view>
  67. <view class='iconfont'
  68. :class='(orderInfo.status == 5 ? "icon-webicon318":"icon-yuandianxiao") + " " + (orderInfo.status >= 5 ? "font_color":"")'>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- 收货地址只显示一次 -->
  73. <view v-if="isUserAddress && secondType !== ProductTypeEnum.Fictitious"
  74. class='wrapper borRadius14 address'>
  75. <view class='name'>{{userAddress[0].realName}}<text
  76. class='phone'>{{userAddress[0].userPhone}}</text></view>
  77. <view>{{userAddress[0].userAddress}}</view>
  78. </view>
  79. <block v-for="(item, index) in orderInfo.merchantOrderList" :key="item.merId">
  80. <view v-if="item.shippingType == 2 && orderInfo.status == 3 && orderInfo.refundStatus !== 3">
  81. <view class="writeOff borRadius14">
  82. <view class="title">核销信息</view>
  83. <view class="grayBg">
  84. <view class="pictrue">
  85. <image :src="codeImg"></image>
  86. </view>
  87. </view>
  88. <view class="gear">
  89. <image src="../static/images/writeOff.jpg"></image>
  90. </view>
  91. <view class="num">{{item.verifyCode}}</view>
  92. <view class="rules" v-if='item.systemStore'>
  93. <view class="item">
  94. <view class="rulesTitle acea-row row-middle">
  95. <text class="iconfont icon-shijian"></text>核销时间
  96. </view>
  97. <view class="info">
  98. 每日:<text class="time">{{item.systemStore.dayTime.replace(',','-')}}</text>
  99. </view>
  100. </view>
  101. <view class="item">
  102. <view class="rulesTitle acea-row row-middle">
  103. <text class="iconfont icon-shuoming1"></text>使用说明
  104. </view>
  105. <view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="map borRadius14">
  110. <view class='title item acea-row row-between-wrapper'>
  111. <view>自提地址信息</view>
  112. <view class="place cart-color acea-row row-center-wrapper" @tap="showMaoLocation(item)">
  113. <text class="iconfont icon-weizhi"></text>查看位置
  114. </view>
  115. </view>
  116. <view class="address">
  117. <view class='name' @tap="makePhone(item.merPhone)">{{item.merName}}<text
  118. class='phone'>{{item.merPhone}}</text><text
  119. class="iconfont icon-tonghua font-color"></text></view>
  120. <view>{{item.merAddressDetail}}</view>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="borRadius14 orderGoodsBox">
  125. <orderGoods :orderInfo="item" :orderNo="orderNo" :cartInfo="item.orderInfoList" :jump="true"
  126. :orderData="orderInfo" :secondType="orderInfo.secondType"></orderGoods>
  127. <!-- v-if="orderInfo.status < 2" -->
  128. <view class="p-24">
  129. <view class='item acea-row row-between'>
  130. <view>配送方式:</view>
  131. <view v-if="Number(orderInfo.secondType) > 4" class='conter'>自动发货</view>
  132. <view v-else-if="Number(orderInfo.secondType) === 2" class='conter'>虚拟发货</view>
  133. <view v-else class='conter'>{{item.shippingType ==1 ? '商家配送': '到店自提'}}</view>
  134. </view>
  135. </view>
  136. <view class='flex justify-between userRemarkBox'>
  137. <view class="f-s-28 color28">买家留言:</view>
  138. <view class='cor-86 f-s-28 userRemark'>{{item.userRemark || '-'}}</view>
  139. <view v-show="!isShow" @click="isShow=!isShow">
  140. <view class='mark_show f-s-28'>{{item.userRemark}}</view>
  141. </view>
  142. </view>
  143. </view>
  144. <!-- <view v-if="orderInfo.status > 1" class="p-24 wrapper borRadius14">
  145. <view class='item acea-row row-between'>
  146. <view>配送方式:</view>
  147. <view v-if="Number(orderInfo.secondType) > 4" class='conter'>自动发货</view>
  148. <view v-else-if="secondType === ProductTypeEnum.Fictitious" class='conter'>虚拟发货</view>
  149. <view v-else class='conter'>{{item.shippingType ==1 ? '商家配送': '到店自提'}}</view>
  150. </view>
  151. </view> -->
  152. </block>
  153. </view>
  154. <!-- 系统表单信息 "-->
  155. <view v-if="orderExtend.length" class="borderPad">
  156. <view class='wrapper borRadius14'>
  157. <systemFromInfo :orderExtend="orderExtend"></systemFromInfo>
  158. </view>
  159. </view>
  160. <!-- 订单信息 "-->
  161. <view class="borderPad">
  162. <view class='wrapper borRadius14'>
  163. <view class='item acea-row row-between'>
  164. <view>订单编号:</view>
  165. <view class='conter acea-row row-middle row-right' style="width: auto;"><text
  166. class="text-overflow">{{orderInfo.orderNo}}</text>
  167. <!-- #ifndef H5 -->
  168. <text class='copy line-heightOne' @tap='handleCopy(orderInfo.orderNo)'>复制</text>
  169. <!-- #endif -->
  170. <!-- #ifdef H5 -->
  171. <text class='copy copy-data' :data-clipboard-text="orderInfo.orderNo">复制</text>
  172. <!-- #endif -->
  173. </view>
  174. </view>
  175. <view class='item acea-row row-between'>
  176. <view>下单时间:</view>
  177. <view class='conter'>{{(orderInfo.createTime || 0)}}</view>
  178. </view>
  179. <view class='item acea-row row-between'>
  180. <view>支付状态:</view>
  181. <view class='conter' v-if="orderInfo.paid">已支付</view>
  182. <view class='conter' v-else>未支付</view>
  183. </view>
  184. <view
  185. v-show="(orderInfo.payType && secondType !== ProductTypeEnum.Integral) || (secondType === ProductTypeEnum.Integral && orderInfo.payPrice!=0)"
  186. class='item acea-row row-between'>
  187. <view>支付方式:</view>
  188. <view class='conter'>{{orderInfo.payType | payTypeFilter}}</view>
  189. </view>
  190. </view>
  191. <view>
  192. <view class='wrapper borRadius14' v-if='orderInfo.deliveryType=="express"'>
  193. <view class='item acea-row row-between'>
  194. <view>配送方式:</view>
  195. <view class='conter'>发货</view>
  196. </view>
  197. <view class='item acea-row row-between'>
  198. <view>快递公司:</view>
  199. <view class='conter'>{{orderInfo.deliveryName || ''}}</view>
  200. </view>
  201. <view class='item acea-row row-between'>
  202. <view>快递号:</view>
  203. <view class='conter'>{{orderInfo.deliveryId || ''}}</view>
  204. </view>
  205. </view>
  206. <view class='wrapper borRadius14' v-else-if='orderInfo.deliveryType=="send"'>
  207. <view class='item acea-row row-between'>
  208. <view>配送方式:</view>
  209. <view class='conter'>送货</view>
  210. </view>
  211. <view class='item acea-row row-between'>
  212. <view>配送人姓名:</view>
  213. <view class='conter'>{{orderInfo.deliveryName || ''}}</view>
  214. </view>
  215. <view class='item acea-row row-between'>
  216. <view>联系电话:</view>
  217. <view class='conter acea-row row-middle row-right'>{{orderInfo.deliveryId || ''}}<text
  218. class='copy' @tap='goTel'>拨打</text></view>
  219. </view>
  220. </view>
  221. <view class='wrapper borRadius14' v-else-if='orderInfo.deliveryType=="fictitious"'>
  222. <view class='item acea-row row-between'>
  223. <view>虚拟发货:</view>
  224. <view class='conter'>已发货,请注意查收</view>
  225. </view>
  226. </view>
  227. </view>
  228. <view class='wrapper borRadius14'>
  229. <view class='item acea-row row-between'>
  230. <view>商品总价:</view>
  231. <!-- 积分价格 -->
  232. <PointsPrice v-if="secondType === ProductTypeEnum.Integral" :pointsPrice="pointsPrice"
  233. :pointsGoodsStyle="hotPointsStyle"></PointsPrice>
  234. <!-- 其他价格 -->
  235. <view v-else class='conter'>¥{{orderInfo.proTotalPrice || 0}}</view>
  236. </view>
  237. <view class='item acea-row row-between' v-if="orderInfo.payPostage > 0">
  238. <view>运费:</view>
  239. <view class='conter'>¥{{orderInfo.payPostage || 0}}</view>
  240. </view>
  241. <view class='item acea-row row-between' v-if='orderInfo.svipDiscountPrice > 0'>
  242. <view>会员优惠:</view>
  243. <view class='conter'>-¥{{orderInfo.svipDiscountPrice || 0}}</view>
  244. </view>
  245. <view class='item acea-row row-between' v-if='orderInfo.merCouponPrice > 0'>
  246. <view>店铺优惠:</view>
  247. <view class='conter'>-¥{{orderInfo.merCouponPrice || 0}}</view>
  248. </view>
  249. <view class='item acea-row row-between' v-if='orderInfo.platCouponPrice > 0'>
  250. <view>平台优惠:</view>
  251. <view class='conter'>-¥{{orderInfo.platCouponPrice || 0}}</view>
  252. </view>
  253. <view class='item acea-row row-between' v-if="orderInfo.integralPrice > 0">
  254. <view>积分抵扣:</view>
  255. <view class='conter'>-¥{{orderInfo.integralPrice || 0}}</view>
  256. </view>
  257. <view v-show="secondType !== ProductTypeEnum.Integral" class='actualPay acea-row row-right'>
  258. 实付款<text class='money'>¥{{orderInfo.payPrice || 0}}</text>
  259. </view>
  260. </view>
  261. <view style='height:120rpx;'></view>
  262. <!-- 底部按钮 -->
  263. <view v-show="isShowBtn" class='footer acea-row row-right row-middle'>
  264. <view class="qs-btn" v-show="orderInfo.status==0" @click.stop="cancelOrder">取消订单</view>
  265. <view class='bnt bg_color' v-show="orderInfo.combinationId > 0" @tap='goJoinPink'>查看拼团</view>
  266. <view class='bnt cancel'
  267. v-show="Number(orderInfo.status) >1 &&Number(orderInfo.status) < 9 && orderInfo.status!=3&&shippingType===1"
  268. @tap='godeliverRecord'>发货记录
  269. </view>
  270. <view class='bnt bg_color' v-show="orderInfo.status==4 && orderInfo.refundStatus!==3" @tap='confirmOrder'>确认收货</view>
  271. <view class='bnt cancel' v-show="orderInfo.status==6 || orderInfo.status==9" @tap='delOrder'>删除订单
  272. </view>
  273. <view class='bnt bg_color' v-show="orderInfo.status==0" @tap='goPay(orderInfo)'>立即付款</view>
  274. <view class='bnt bg_color' v-show="(orderInfo.status>0) && isBuyAgain" @tap='goOrderConfirm'>
  275. 再次购买</view>
  276. </view>
  277. </view>
  278. </view>
  279. </view>
  280. </template>
  281. <script>
  282. // +----------------------------------------------------------------------
  283. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  284. // +----------------------------------------------------------------------
  285. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  286. // +----------------------------------------------------------------------
  287. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  288. // +----------------------------------------------------------------------
  289. // | Author: CRMEB Team <admin@crmeb.com>
  290. // +----------------------------------------------------------------------
  291. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  292. import {
  293. getOrderDetail,
  294. orderTake,
  295. orderDel,
  296. orderCancel,
  297. strToBase64Api,
  298. orderStatusImgApi
  299. } from '@/api/order.js';
  300. import {
  301. cartBatchAddApi
  302. } from '@/api/product.js';
  303. import orderGoods from "../components/orderGoods";
  304. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  305. import {
  306. toLogin
  307. } from '@/libs/login.js';
  308. import {
  309. mapGetters
  310. } from "vuex";
  311. // #ifdef MP
  312. import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
  313. // #endif
  314. import {
  315. setThemeColor
  316. } from '@/utils/setTheme.js'
  317. import {
  318. Debounce
  319. } from '@/utils/validate.js'
  320. import {
  321. ProductTypeEnum,
  322. ProductMarketingTypeEnum
  323. } from "../../../enums/productEnums";
  324. import systemFromInfo from '@/components/systemFromInfo';
  325. import PointsPrice from '@/components/PointsPrice.vue';
  326. /**
  327. * 积分商品推荐样式
  328. */
  329. const hotPointsStyle = {
  330. iconStyle: {
  331. width: '28rpx',
  332. height: '28rpx'
  333. },
  334. priceStyle: {
  335. fontSize: '28rpx',
  336. },
  337. unitStyle: {
  338. fontSize: '26rpx',
  339. },
  340. }
  341. const app = getApp();
  342. export default {
  343. components: {
  344. orderGoods,
  345. easyLoadimage,
  346. systemFromInfo,
  347. PointsPrice
  348. },
  349. data() {
  350. return {
  351. codeImg: '',
  352. qrcodeSize: 100,
  353. orderNo: '',
  354. cartInfo: [], //购物车产品
  355. orderInfo: {
  356. systemStore: {},
  357. pstatus: {}
  358. }, //订单详情
  359. status: {}, //订单底部按钮状态
  360. totalPrice: '0',
  361. id: 0, //订单id
  362. uniId: '',
  363. utils: this.$util,
  364. againStatus: 0,
  365. type: 0, //订单类型 0-普通订单,1-视频号订单,2-秒杀订单
  366. secondType: 0, //订单二级类型:0-普通订单,1-积分订单,2-虚拟订单,4-视频号订单,5-云盘订单,6-卡密订单
  367. isShow: true,
  368. theme: app.globalData.theme,
  369. bgColor: '#e93323',
  370. userAddress: [],
  371. shippingType: 1,
  372. statusPic: '',
  373. isUserAddress: false, //是否只显示一次收货地址
  374. ProductMarketingTypeEnum: ProductMarketingTypeEnum,
  375. ProductTypeEnum: ProductTypeEnum,
  376. orderExtend: [], //系统表单数据
  377. isSplitDelivery: false, //是否拆单发货
  378. deliveryType: '', // 配送方式
  379. hotPointsStyle: hotPointsStyle,
  380. urlDomain: this.$Cache.get("imgHost"),
  381. statusPng:['beforPay','beforSend','beforSend','beforSend','beforResaved','orderDone','orderDone','','','orderCancel']
  382. };
  383. },
  384. computed: {
  385. //是否可以再次购买
  386. isBuyAgain() {
  387. return this.type === ProductMarketingTypeEnum.Normal && this.secondType === ProductTypeEnum.Normal && !this
  388. .orderExtend.length
  389. },
  390. ...mapGetters(['isLogin', 'chatUrl', 'userInfo']),
  391. //积分价格
  392. pointsPrice() {
  393. return {
  394. redeemIntegral: this.orderInfo.redeemIntegral,
  395. price: this.orderInfo.proTotalPrice
  396. }
  397. },
  398. //是否展示底部操作按钮
  399. //<!-- 订单状态(0:待支付,1:待发货,2:部分发货, 3:待核销,4:待收货,5:已收货,6:已完成,9:已取消) -->
  400. // <!-- 已退款的订单详情中,不支持任何操作。 orderInfo.refundStatus !== 3,拼团已退款订单还可进行【查看拼团】操作-->
  401. isShowBtn() {
  402. return (this.orderInfo.status!=3 && this.orderInfo.status!=1) || this.orderInfo.refundStatus !== 3 || (this.orderInfo.refundStatus == 3 && this.type !== this.ProductMarketingTypeEnum.Groupbuying)
  403. },
  404. },
  405. onLoad: function(options) {
  406. if (!options.orderNo) return this.$util.Tips({
  407. title: '缺少参数'
  408. }, {
  409. tab: 3,
  410. url: 1
  411. });
  412. this.$set(this, 'orderNo', options.orderNo);
  413. this.bgColor = setThemeColor();
  414. uni.setNavigationBarColor({
  415. frontColor: '#ffffff',
  416. backgroundColor: this.bgColor,
  417. });
  418. },
  419. onShow() {
  420. if (this.isLogin) {
  421. this.getOrderInfo();
  422. } else {
  423. toLogin();
  424. }
  425. },
  426. onHide: function() {
  427. this.isClose = true;
  428. },
  429. // 滚动监听
  430. onPageScroll(e) {
  431. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  432. uni.$emit('scroll');
  433. },
  434. onReady: function() {
  435. // #ifdef H5
  436. this.$nextTick(function() {
  437. const clipboard = new ClipboardJS(".copy-data");
  438. clipboard.on("success", () => {
  439. this.$util.Tips({
  440. title: '复制成功'
  441. });
  442. });
  443. });
  444. // #endif
  445. },
  446. methods: {
  447. //发货记录
  448. godeliverRecord() {
  449. uni.showLoading({
  450. title: '加载中...'
  451. });
  452. let order_logistics = `/pages/goods/order_logistics/index?orderNo=${this.orderInfo.orderNo}`
  453. let send_record = `/pages/goods/send_record/index?orderNo=${this.orderNo}&index=0`
  454. if (this.isSplitDelivery) {
  455. uni.navigateTo({
  456. url: order_logistics
  457. });
  458. } else {
  459. let url = this.deliveryType === 'express' ? order_logistics : send_record
  460. uni.navigateTo({
  461. url: url
  462. })
  463. }
  464. },
  465. /**
  466. * 打开支付组件
  467. *
  468. */
  469. goPay: Debounce(function(item) {
  470. uni.showLoading({
  471. title: '加载中...'
  472. });
  473. uni.navigateTo({
  474. url: `/pages/goods/order_payment/index?orderNo=${item.orderNo}&payPrice=${item.payPrice}`
  475. });
  476. }),
  477. /**
  478. * 拨打电话
  479. */
  480. makePhone: function(e) {
  481. uni.makePhoneCall({
  482. phoneNumber: e
  483. })
  484. },
  485. /**
  486. * 打开地图
  487. *
  488. */
  489. showMaoLocation: function(e) {
  490. if (!e.merLatitude || !e.merLongitude) return this.$util.Tips({
  491. title: '缺少经纬度信息无法查看地图!'
  492. });
  493. //#ifdef H5
  494. if (this.$wechat.isWeixin() === true) {
  495. this.$wechat.seeLocation({
  496. latitude: parseFloat(e.merLatitude),
  497. longitude: parseFloat(e.merLongitude),
  498. name: e.merName,
  499. address: e.merAddressDetail,
  500. }).then(res => {
  501. console.log('success');
  502. })
  503. } else {
  504. //#endif
  505. uni.openLocation({
  506. latitude: parseFloat(e.merLatitude),
  507. longitude: parseFloat(e.merLongitude),
  508. scale: 8,
  509. name: e.merName,
  510. address: e.merAddressDetail,
  511. success: function() {
  512. },
  513. });
  514. // #ifdef H5
  515. }
  516. //#endif
  517. },
  518. orderStatusImg() {
  519. let that = this;
  520. orderStatusImgApi().then(res => {
  521. res.data.map(item => {
  522. if (item.title === 'await_pay' && this.orderInfo.status === 0) {
  523. this.statusPic = item.pic
  524. } else if (item.title === 'await_shipped' && this.orderInfo.status === 1) {
  525. this.statusPic = item.pic
  526. } else if (item.title === 'receiving' && this.orderInfo.status === 3) {
  527. this.statusPic = item.pic
  528. } else if (item.title === 'spike' && this.orderInfo.status === 2) {
  529. this.statusPic = item.pic
  530. } else if (item.title === 'complete' && this.orderInfo.status === 4) {
  531. this.statusPic = item.pic
  532. }
  533. })
  534. }).catch(err => {
  535. that.$util.Tips({
  536. title: err
  537. });
  538. });
  539. },
  540. /**
  541. * 获取订单详细信息
  542. *
  543. */
  544. getOrderInfo: function() {
  545. let that = this;
  546. uni.showLoading({
  547. title: "正在加载中"
  548. });
  549. getOrderDetail(that.orderNo).then(res => {
  550. uni.hideLoading();
  551. let data = res.data;
  552. that.$set(that, 'orderInfo', data);
  553. that.$set(that, 'id', data.id);
  554. that.$set(that, 'type', data.type);
  555. that.$set(that, 'secondType', data.secondType);
  556. that.$set(that, 'orderExtend', data.orderExtend ? JSON.parse(data.orderExtend) : []);
  557. that.orderStatusImg();
  558. that.userAddress = data.merchantOrderList.filter(item => {
  559. return item.shippingType === 1
  560. })
  561. that.isUserAddress = that.userAddress.length > 0 ? true : false;
  562. if (data.status !== 0 || data.status !== 9) {
  563. if (data.merchantOrderList[0].shippingType == 2) that.markCode(data.merchantOrderList[
  564. 0].verifyCode);
  565. }
  566. that.$set(that, 'shippingType', data.merchantOrderList[0].shippingType);
  567. that.$set(that, 'cartInfo', data.merchantOrderList[0].orderInfoList);
  568. that.$set(that, 'isSplitDelivery', data.merchantOrderList[0].isSplitDelivery);
  569. that.$set(that, 'deliveryType', data.merchantOrderList[0].deliveryType);
  570. if (that.orderInfo.refundStatus > 0) {
  571. uni.setNavigationBarColor({
  572. frontColor: '#fff',
  573. backgroundColor: '#666666'
  574. })
  575. }
  576. // if (data.combinationId > 0 || data.bargainId > 0 || data.seckillId > 0) {
  577. // this.againStatus = 1;
  578. // }
  579. }).catch(err => {
  580. that.$util.Tips({
  581. title: err
  582. }, {
  583. tab: 4,
  584. url: '/pages/user/index'
  585. });
  586. });
  587. },
  588. /**
  589. *
  590. * 生成二维码
  591. */
  592. markCode(text) {
  593. strToBase64Api({
  594. height: '145',
  595. text: text,
  596. width: '145'
  597. }).then(res => {
  598. this.codeImg = res.data.code
  599. });
  600. },
  601. /**
  602. *
  603. * 剪切订单号
  604. */
  605. // #ifndef H5
  606. handleCopy: function(num) {
  607. uni.setClipboardData({
  608. data: num
  609. });
  610. },
  611. // #endif
  612. /**
  613. * 打电话
  614. */
  615. goTel: function() {
  616. uni.makePhoneCall({
  617. phoneNumber: this.orderInfo.deliveryId
  618. })
  619. },
  620. /**
  621. * 去拼团详情
  622. *
  623. */
  624. goJoinPink: function() {
  625. uni.navigateTo({
  626. url: '/pages/activity/goods_combination_status/index?id=' + this.orderInfo.pinkId,
  627. });
  628. },
  629. /**
  630. * 再此购买
  631. *
  632. */
  633. goOrderConfirm: Debounce(function() {
  634. uni.showLoading({
  635. title: '加载中...'
  636. });
  637. let cartListRequest = []
  638. let that = this;
  639. this.cartInfo.map(item => {
  640. cartListRequest.push({
  641. productId: parseFloat(item.productId),
  642. productAttrUnique: item.attrValueId,
  643. cartNum: parseFloat(item.payNum)
  644. })
  645. })
  646. cartBatchAddApi(cartListRequest).then(function(res) {
  647. uni.navigateTo({
  648. url: '/pages/order_addcart/order_addcart'
  649. })
  650. }).catch(res => {
  651. return this.$util.Tips({
  652. title: res
  653. });
  654. });
  655. }),
  656. //确认收货
  657. confirmOrder: Debounce(function() {
  658. let that = this;
  659. let applyRefundNum = 0;
  660. that.orderInfo.merchantOrderList.map((item) => {
  661. item.orderInfoList.map((i) => {
  662. applyRefundNum = Number(i.applyRefundNum) + Number(i.refundNum);
  663. });
  664. });
  665. // 如果有售后中的,提示
  666. if (applyRefundNum >0) return uni.showModal({
  667. title: '提示',
  668. content: '请先撤销售后,再进行收货操作',
  669. confirmText: '我知道了',
  670. success(res) {
  671. if (res.confirm) {
  672. return
  673. }
  674. }
  675. });
  676. uni.showModal({
  677. title: '确认收货',
  678. content: '为保障权益,请收到货确认无误后,再确认收货',
  679. success: function(res) {
  680. if (res.confirm) {
  681. orderTake(that.orderNo).then(res => {
  682. return that.$util.Tips({
  683. title: '操作成功',
  684. icon: 'success'
  685. }, function() {
  686. that.getOrderInfo();
  687. });
  688. }).catch(err => {
  689. return that.$util.Tips({
  690. title: err
  691. });
  692. })
  693. }
  694. }
  695. })
  696. }),
  697. /**
  698. *
  699. * 删除订单
  700. */
  701. delOrder: Debounce(function() {
  702. uni.showModal({
  703. content: '确定删除该订单',
  704. cancelText: "取消",
  705. confirmText: "确定",
  706. showCancel: true,
  707. confirmColor: '#f55850',
  708. success: (res) => {
  709. if (res.confirm) {
  710. let that = this;
  711. orderDel(this.orderNo).then(res => {
  712. return that.$util.Tips({
  713. title: '删除成功',
  714. icon: 'success'
  715. }, {
  716. tab: 4,
  717. url: '/pages/user/index'
  718. });
  719. }).catch(err => {
  720. return that.$util.Tips({
  721. title: err
  722. });
  723. });
  724. } else {
  725. }
  726. }
  727. })
  728. }),
  729. cancelOrder: Debounce(function() {
  730. let self = this
  731. uni.showModal({
  732. title: '提示',
  733. content: '确认取消该订单?',
  734. success: function(res) {
  735. if (res.confirm) {
  736. orderCancel(self.orderNo)
  737. .then((data) => {
  738. self.$util.Tips({
  739. title: '取消成功'
  740. }, {
  741. tab: 4,
  742. url: '/pages/user/index'
  743. })
  744. }).catch((err) => {
  745. self.$util.Tips({
  746. title: err
  747. })
  748. self.getDetail();
  749. });
  750. } else if (res.cancel) {
  751. console.log('用户点击取消');
  752. }
  753. }
  754. });
  755. })
  756. }
  757. }
  758. </script>
  759. <style scoped lang="scss">
  760. @import '../static/css/order_details.scss';
  761. .orderStatusPng{
  762. width: 128rpx;
  763. height: 128rpx;
  764. }
  765. .picTxt{
  766. justify-content: space-between;
  767. }
  768. </style>