orderDet.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. <template>
  2. <view v-if="isShowView">
  3. <!--pages/orderDet/orderDet.wxml-->
  4. <!-- 售后 -->
  5. <view class="examine" v-if="orderRefundList.length > 0 && isOldOrder()" @tap="gorefundDetOld">
  6. <view class="cont dflex">
  7. <view v-if="
  8. (orderRefundList[0].refundState == 39 && orderRefund.refundType == 1) ||
  9. (orderRefundList[0].refundState == 40 && orderRefund.refundType == 1) ||
  10. orderRefundList[0].refundState == 30 ||
  11. orderRefundList[0].refundState == 31
  12. ">
  13. <text style="font-size:28rpx;color:#FE0419">您已提交退款申请,等待审核中</text>
  14. <view style="font-size:24rpx;color:#999999">{{ orderRefund.createDat ? orderRefund.createDat : '' }}
  15. </view>
  16. </view>
  17. <view v-if="
  18. (orderRefundList[0].refundState == 41 && orderRefund.refundType == 1) ||
  19. (orderRefundList[0].refundState == 35 && orderRefund.refundType == 2 && orderRefund.refundMethod != 2)
  20. ">
  21. <text style="font-size:28rpx;color:#FE0419"
  22. v-if="orderRefund.refundMethod == null && orderRefundList[0].refundState == 35">
  23. 您提交的退款申请审核完成,请选择退货方式
  24. </text>
  25. <text style="font-size:28rpx;color:#FE0419" v-else>
  26. 您提交的退款申请审核完成{{ orderRefundList[0].refundState == 41 && orderRefund.refundType == 1 ? ',等待卖家退款中' : ',请填写物流信息' }}
  27. </text>
  28. <view style="font-size:24rpx;color:#999999">
  29. {{ orderRefundList[0].refundState == 41 && orderRefund.refundType == 1 ? orderRefund.refundReviewTime : orderRefund.refundGoodReviewTime }}
  30. </view>
  31. </view>
  32. <view
  33. v-if="orderRefundList[0].refundState == 36 && orderRefund.refundType == 2 && orderRefund.refundMethod == 2">
  34. <text style="font-size:28rpx;color:#FE0419">您提交的退款申请审核完成,请您把商品送回门店</text>
  35. <view style="font-size:24rpx;color:#999999">
  36. {{ orderRefundList[0].refundState == 41 && orderRefund.refundType == 1 ? orderRefund.refundReviewTime : orderRefund.refundGoodReviewTime }}
  37. </view>
  38. </view>
  39. <block v-if="orderRefund.refundType == 1">
  40. <view v-if="orderRefundList[0].refundState == 32">
  41. <text style="font-size:28rpx;color:#FE0419">您提交的退款申请,审核失败,请联系商家</text>
  42. <view style="font-size:28rpx">
  43. 失败原因:{{ !orderRefund.refundFalseRes ? '' : orderRefund.refundFalseRes }}</view>
  44. <view style="font-size:24rpx;color:#999999">
  45. {{ orderRefund.refundOverTime ? orderRefund.refundOverTime : '' }}</view>
  46. </view>
  47. </block>
  48. <block v-if="orderRefund.refundType == 2">
  49. <view v-if="orderRefundList[0].refundState == 32">
  50. <text style="font-size:28rpx;color:#FE0419">您提交的退货申请,审核失败,请联系商家</text>
  51. <view style="font-size:28rpx">
  52. 失败原因:{{ !orderRefund.refundFalseRes ? '' : orderRefund.refundFalseRes }}</view>
  53. <view style="font-size:24rpx;color:#999999">
  54. {{ orderRefund.refundOverTime ? orderRefund.refundOverTime : '' }}</view>
  55. </view>
  56. <view
  57. v-if="orderRefundList[0].refundState == 36 && (orderRefund.refundMethod == 1 || orderRefund.refundMethod == 3)">
  58. <text style="font-size:28rpx;color:#FE0419">商品已寄回,等待卖家确认收货</text>
  59. <view style="font-size:24rpx;color:#999999">
  60. {{ orderRefund.refundMethod == 1 ? orderRefund.expressTime : orderRefund.refundGoodReviewTime }}
  61. </view>
  62. </view>
  63. <view
  64. v-if="orderRefundList[0].refundState == 40 || orderRefundList[0].refundState == 39 || orderRefundList[0].refundState == 41">
  65. <text style="font-size:28rpx;color:#FE0419">您寄回的商品卖家已接收,等待卖家退款中</text>
  66. <view style="font-size:24rpx;color:#999999">
  67. {{ orderRefund.receiveTime ? orderRefund.receiveTime : '' }}</view>
  68. </view>
  69. </block>
  70. <view v-if="orderRefundList[0].refundState >= 42">
  71. <block v-if="orderRefundList[0].refundState == 43">
  72. <text style="font-size:28rpx;color:#FE0419">退款完成</text>
  73. <view style="font-size:24rpx;color:#999999">
  74. {{ orderRefund.refundOverTime ? orderRefund.refundOverTime : '' }}</view>
  75. </block>
  76. <block v-else>
  77. <text style="font-size:28rpx;color:#FE0419">退款失败</text>
  78. <view style="font-size:24rpx;color:#999999">{{ refundFalseRes ? refundFalseRes : '' }}</view>
  79. </block>
  80. </view>
  81. <image src="/mine/static/mine/images/tuikuan.png"></image>
  82. </view>
  83. </view>
  84. <view class="top">
  85. <block v-if="orderType != 17 && orderType != 18 && orderType != 16">
  86. <view class="status" v-if="(state < 8 && state >= 1) || (state >= 20 && state < 30)">
  87. <view :class="'li ' + (state >= 1 ? 'ing' : '')">
  88. <text></text>
  89. 待付款
  90. </view>
  91. <view :class="'li ' + (state >= 20 || state > 1 ? 'ing' : '')" v-if="isOtc == 1">
  92. <text></text>
  93. 开处方
  94. </view>
  95. <view :class="'li ' + (state == 22 ? 'ing' : '')" v-if="state == 22">
  96. <text></text>
  97. 开方失败
  98. </view>
  99. <view :class="'li ' + (state >= 25 || (state > 1 && state != 22) ? 'ing' : '')" v-if="isOtc == 1">
  100. <text></text>
  101. {{ state != 22 ? '处方审核' : '重新开方' }}
  102. </view>
  103. <view :class="'li ' + (state == 27 ? 'ing' : '')" v-if="state == 27">
  104. <text></text>
  105. 审方失败
  106. </view>
  107. <view :class="'li ' + (state > 1 && state < 20 ? 'ing' : '')">
  108. <text></text>
  109. {{ mode != 1 ? stateName : '待自提' }}
  110. </view>
  111. <view :class="'li ' + (state > 3 && state < 20 ? 'ing' : '')" v-if="mode != 1">
  112. <text></text>
  113. 待收货
  114. </view>
  115. <view :class="'li ' + (state == 7 || state == 6 ? 'ing' : '')">
  116. <text></text>
  117. {{ mode != 1 ? '已完成' : '已自提' }}
  118. </view>
  119. </view>
  120. </block>
  121. </view>
  122. <!-- 门店自提 -->
  123. <block v-if="mode == 1">
  124. <block v-if="orderType != 17 && orderType != 18 && orderType != 16">
  125. <view class="tihuo bgfff r10 dflex" v-if="state >= 3 && state <= 7">
  126. <view class="tihuoma dflex">
  127. <image src="/static/pages/images/thico.png"></image>
  128. 提货号码:
  129. <text>{{ code }}</text>
  130. </view>
  131. <!-- <view class="thmbtn" @tap="showCode" v-if="codeUrl">
  132. <image src="/static/pages/images/ewmico.png"></image>
  133. 查看提货码
  134. </view> -->
  135. </view>
  136. <view class="mdaddr bgfff r10">
  137. <view class="mdinfo">
  138. <view class="areas dflex">
  139. 自提点:{{ shopName ? shopName : merchantName }}
  140. <image src="/static/pages/images/dwico.png" class="dwico"></image>
  141. </view>
  142. <text>地址:{{ shopAddress ? shopAddress : address }}</text>
  143. <text>营业时间: 8:30~22:30 节假日不休息</text>
  144. </view>
  145. <view class="mdphone" @tap="callPhone">
  146. 门店电话:
  147. <text>{{ merchantPhone ? merchantPhone : '无' }}</text>
  148. <image src="/static/pages/images/call.png"></image>
  149. </view>
  150. <image src="/static/pages/images/dzbg.png" class="dzbg"></image>
  151. </view>
  152. </block>
  153. </block>
  154. <!-- 门店自提 -->
  155. <!-- 物流配送 -->
  156. <view class="top" v-else>
  157. <view class="addr">
  158. <text class="areas">{{ address }}</text>
  159. <view class="addrb ddflex">
  160. <view class="fflex">
  161. 收货人: {{ name }}
  162. <text>{{ phone }}</text>
  163. </view>
  164. </view>
  165. <!-- <view class="qdkf ddflex" v-if="state <= 3">如需修改地址,请联系<button open-type="contact" hover-class="none">售后客服</button></view>
  166. <view class="qdkf ddflex" v-if="state > 3 && state < 20 && state != 7">订单已发货,不支持修改地址</view>
  167. -->
  168. <image src="/static/pages/images/dzbg.png" class="dzbg"></image>
  169. </view>
  170. <!-- &&state!=7订单未完成 -->
  171. <view class="psfs dflex" v-if="deliverState" @tap="goUrl" :data-url="url">
  172. <image src="/static/pages/images/psico.png" class="psico"></image>
  173. <view class="flex">
  174. <view v-if="deliverExtend == 1">{{ deliverMode }}:{{ deliverState }}</view>
  175. <view v-else>查看快递</view>
  176. <text v-if="deliverExtend == 1">{{ deliverTime }}</text>
  177. </view>
  178. <image src="/static/pages/images/more.png" class="rico1"></image>
  179. </view>
  180. <!-- 配送人员&&state!=7 -->
  181. <view class="psy dflex" v-if="deliverMode == '自主配送'">
  182. <text>配送员信息</text>
  183. <view class="psy-info flex dflex">
  184. <view class="psy-phone dflex" @tap="callDeliver">
  185. <image src="/static/pages/images/psyico.png"></image>
  186. 电话骑士
  187. </view>
  188. <view class="psy-name">{{ deliveryUserName }}</view>
  189. </view>
  190. </view>
  191. </view>
  192. <!-- 产品信息 -->
  193. <view class="list" v-if="state == 8 || state == 1">
  194. <view class="dpname">
  195. <image class="l-s-img" src="/static/pages/images/dpico.png"></image>
  196. {{ shopName ? shopName : merchantName }}
  197. </view>
  198. <view v-for="(item, index) in products" :key="index" class="li" @tap="toDetail" :data-id="item.id">
  199. <view class="li-info dflex">
  200. <view class="cimgs">
  201. <image :src="item.pic" mode="aspectFit" class="cimg"></image>
  202. <image src="/static/pages/images/jishida.png" mode="aspectFit" class="type"
  203. v-if="orderType == 5"></image>
  204. <image src="/static/pages/images/tuangou.png" mode="aspectFit" class="type"
  205. v-if="orderType == 2"></image>
  206. </view>
  207. <view class="zhinfo">
  208. <view class="zhtit">{{ item.title }}</view>
  209. <view v-if="item.propertiesList && item.propertiesList.length > 0" class="guigecontent">
  210. 规格:
  211. <text v-for="(itemGuige, index2) in item.propertiesList" :key="index2" class="guige"
  212. decode="true">{{ itemGuige.value }}&nbsp;</text>
  213. </view>
  214. <view class="jiage">
  215. <view class="zhjia" v-if="orderType != 11">¥{{ item.salePrice }}</view>
  216. <view class="zhjia" v-if="orderType == 11">{{ item.integral }}积分+¥{{ item.salePrice }}
  217. </view>
  218. <view class="num">×{{ item.quantity }}</view>
  219. </view>
  220. </view>
  221. </view>
  222. <!-- <view class="lis wuliu dflex">
  223. <image src="../../static/pages/images/psico_y.png" class="lis-img"></image>
  224. <view class="flex y-txt">查看物流</view>
  225. <image src="../static/mine/images/rico2.png" class="rico"></image>
  226. </view>
  227. <view class="lis zhuang dflex">
  228. <image src="../static/mine/images/tuikuan.png" class="lis-img"></image>
  229. <view class="flex r-txt">售后信息</view>
  230. <image src="../static/mine/images/rico2.png" class="rico"></image>
  231. </view> -->
  232. </view>
  233. </view>
  234. <view v-else class="list" v-for="(items, index) in deliverListss" :key="index">
  235. <view class="dpname" @click="deliverLog(items)">
  236. <image class="l-s-img" src="/static/pages/images/dpico.png"></image>
  237. <view class="flex">
  238. <!-- {{ items.supplierName ? items.supplierName : (shopName ? shopName : merchantName) + '自营' }} -->
  239. {{ shopName ? shopName : merchantName }}
  240. </view>
  241. <view :class="'dflex ' + (items.state == 2 || items.state == 3 ? 'dd-stared' : 'dd-sta ')"
  242. v-if="mode != 1">
  243. {{ items.state == 1 ? '未发货' : items.state == 2 ? '待收货' : items.state == 3 ? '已签收' : items.state == 4 ? '已完成' : '' }}
  244. <image src="/static/pages/images/more.png" class="rico"
  245. v-if="items.state == 2 || items.state == 3" />
  246. </view>
  247. </view>
  248. <view v-for="(item, index1) in items.extendDTOList" :key="index1" class="li">
  249. <view class="li-info dflex" @tap="toDetail" :data-id="item.productId">
  250. <view class="cimgs">
  251. <image :src="item.pic" mode="aspectFit" class="cimg"></image>
  252. <image src="/static/pages/images/jishida.png" mode="aspectFit" class="type"
  253. v-if="orderType == 5"></image>
  254. <image src="/static/pages/images/tuangou.png" mode="aspectFit" class="type"
  255. v-if="orderType == 2"></image>
  256. </view>
  257. <view class="zhinfo">
  258. <view class="zhtit">{{ item.productName }}</view>
  259. <view v-if="item.specsList && item.specsList.length > 0" class="guigecontent">
  260. 规格:
  261. <text v-for="(itemGuige, index2) in item.specsList" :key="index2" class="guige"
  262. decode="true">{{ itemGuige.value }}&nbsp;</text>
  263. </view>
  264. <view class="jiage">
  265. <view class="zhjia" v-if="orderType != 11">¥{{ item.money }}</view>
  266. <view class="zhjia" v-if="orderType == 11">{{ item.integral }}积分+¥{{ item.money }}</view>
  267. <view class="num">×{{ item.deliverQuantity }}</view>
  268. </view>
  269. </view>
  270. </view>
  271. <view class="lis zhuang dflex" v-if="item.refundOrderList && item.refundOrderList.length > 0"
  272. v-for="(its, idx) in item.refundOrderList" @click="gorefundDet(its)" :data-its="its" :key="idx">
  273. <image src="../static/mine/images/tuikuan.png" class="lis-img"></image>
  274. <view class="flex r-txt">{{ refundHintText(its) }}</view>
  275. <image src="../static/mine/images/rico2.png" class="rico"></image>
  276. </view>
  277. </view>
  278. </view>
  279. <view class="ddinfo">
  280. <view class="li">
  281. <text>订单编号</text>
  282. <view class="ddid dflex">
  283. {{ id }}
  284. <text class="copy" @tap="copy()">复制</text>
  285. </view>
  286. </view>
  287. <view class="li">
  288. <text>创建时间</text>
  289. <view>{{ createDate }}</view>
  290. </view>
  291. <view class="li" v-if="deliverTime">
  292. <text>{{ mode == 1 ? '自提' : '发货' }}时间</text>
  293. <view>{{ deliverTime }}</view>
  294. </view>
  295. <view class="li">
  296. <text>订单金额</text>
  297. <view class="price">¥{{ money }}</view>
  298. </view>
  299. <view class="li" v-if="expressFee">
  300. <text>快递费</text>
  301. <view class="price">¥{{ expressFee }}</view>
  302. </view>
  303. <view class="li" v-if="discountMoney && orderType != 11">
  304. <text>优惠券</text>
  305. <view class="price">-¥{{ discountMoney }}</view>
  306. </view>
  307. <view class="li" v-if="discountMoney && orderType == 11">
  308. <text>使用积分</text>
  309. <view class="price">{{ discountMoney }}</view>
  310. </view>
  311. <view class="li" v-if="balancePayMoney">
  312. <text>余额扣除</text>
  313. <view class="price">-¥{{ balancePayMoney }}</view>
  314. </view>
  315. <view class="li" v-if="offlinePaymentMoney">
  316. <text>线下余额扣除</text>
  317. <view class="price">-¥{{ offlinePaymentMoney }}</view>
  318. </view>
  319. <view class="li">
  320. <text>{{ state == 1 || state == 8 ? '应付' : '实付' }}金额</text>
  321. <view class="price">¥{{ payMoney }}</view>
  322. </view>
  323. </view>
  324. <view class="ddinfo" v-if="note">
  325. <view class="li">
  326. <text>备注:</text>
  327. <view>{{ note }}</view>
  328. </view>
  329. </view>
  330. <view class="ddinfo" v-if="state == 22 && orderDrugUser.reasons">
  331. <view class="dli">
  332. <text>开方失败原因:</text>
  333. <view>{{ orderDrugUser.reasons }}</view>
  334. </view>
  335. </view>
  336. <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 100) + 'rpx'"></view>
  337. <view class="bot" :style="'padding-bottom:' + (bottomBlankHeight + 20) + 'rpx'">
  338. <view @tap="deleteOrder" v-if="state == 8">删除订单</view>
  339. <view @tap="cancelOrder" v-if="state == 1">取消订单</view>
  340. <!-- <block
  341. v-if="config.is_open_invoice == 1 && (state == 2 || state == 3 || state == 4 || state == 5 || state == 6 || state == 7)">
  342. <view @tap="applyInvoice" v-if="invoiceState == 0">申请开票</view>
  343. <view @tap="toInvoice" v-else>查看发票</view>
  344. </block> -->
  345. <view @tap="txOrder" v-if="state == 3 && isReminder == 1">提醒发货</view>
  346. <block v-if="orderType != 4">
  347. <!-- <view
  348. class="sta-btn"
  349. @tap="refundmod"
  350. :data-id="id"
  351. :data-index="index"
  352. v-if="
  353. isRefundStock == 1||(refund > 0 && state >= 2 && state <= 6 && orderType !== 4 && isrefund == 1 && payTime != null && reimburse && canRefund) ||
  354. (state >= 20 && state < 30 && isOtc == '1' && isrefund == 1 && payTime != null && reimburse && canRefund)
  355. "
  356. >
  357. 申请售后
  358. </view> -->
  359. <block v-if="state != 1 && state != 8 && state != 9 && state != 10 && orderType!= 18">
  360. <block v-if="state >= 30 && state <= 43"></block>
  361. <view v-else class="sta-btn" @tap="isRefundStock == 1 ? refundmod() : refundmods()">申请售后</view>
  362. </block>
  363. </block>
  364. <view @tap="payOrder" v-if="state == 1" class="confirm">立即付款</view>
  365. <view class="confirm" @tap="confirmOrder" :data-index="index" v-if="state == 5 || state == 6" :data-id="id">
  366. 确认收货</view>
  367. <navigator :url="'/activity/group/ptDetail/ptDetail?id=' + groupId + '&merchantId=' + merchantId"
  368. v-if="orderType == 4 && state != 8 && groupId && state > 1" class="confirm">
  369. 我的拼团
  370. </navigator>
  371. <navigator v-if="state > 5 && (state != 20 && state != 22 && state != 27)" open-type="reLaunch"
  372. hover-class="none"
  373. :url="header.appId == 'ZQ1VK5oc17I387E' ? '/pages/timelyDelivery/index' : '/pages/service/index'"
  374. class="confirm">
  375. 继续购物
  376. </navigator>
  377. <navigator v-if="state == 22 || state == 20 || state == 27" hover-class="none"
  378. :url="'/prescription/Consultation/index?orderId=' + id" class="confirm">
  379. 重新开方
  380. </navigator>
  381. <button open-type="contact" v-if="state == 3 || state == 25 || state == 26">
  382. <view class="confirm">联系客服</view>
  383. </button>
  384. <!-- <navigator url="/pages/shop/shop"wx:if="{{state > 5 }}" open-type="reLaunch" hover-class="none" class="confirm">继续购物</navigator> -->
  385. </view>
  386. <!-- 自提取货码 -->
  387. <block v-if="isShow">
  388. <view class="mask" @tap="eliminate"></view>
  389. <view class="qhpop">
  390. <view class="close">
  391. <image src="/static/pages/images/close.png" @tap="eliminate"></image>
  392. </view>
  393. <view class="thma">
  394. 我的提货码
  395. <text>{{ code }}</text>
  396. </view>
  397. <view class="qrcode">
  398. <!-- <canvas class='canvas' canvas-id='canvas' bindlongtap='save' style="width:150px;height:150px"></canvas> -->
  399. <image :src="codeUrl"></image>
  400. </view>
  401. <view class="save" @tap="saveImage">保存到相册</view>
  402. </view>
  403. </block>
  404. <canvas canvas-id="invite" class="canvas" style="width:295px;height:428px;"></canvas>
  405. <!-- 申请售后弹窗 -->
  406. <view class="ceng" v-if="popShow" @click="cancel()"></view>
  407. <view class="popup" v-if="popShow">
  408. <view class="pop-tit">提示</view>
  409. <view class="pop-tip">当前{{ stateName }},如有售后问题,请咨询客服</view>
  410. <view class="pop-btn dflex">
  411. <view class="pop-cancel" @click="cancel()">取消</view>
  412. <button open-type="contact" class="pop-contact">咨询客服</button>
  413. </view>
  414. </view>
  415. </view>
  416. </template>
  417. <script>
  418. // pages/orderDet/orderDet.js
  419. const app = getApp(); // const QRCode = require('../../utils/weapp.qrcode.js')
  420. // const QRCode = require('../../utils/weapp.qrcode.js')
  421. const req = require('../../utils/request.js');
  422. const requsetmessage = require('../../utils/requestmessage.js');
  423. import h5util from "../../utils/h5util";
  424. // state : 1 未付款 2 待确认 3 待发货 4 待提货 5 配送中 6 已签收 7 订单完成
  425. // 8 订单取消 9 退货中 10 完成退货 11 支付失败 15 进行中
  426. // 售后状态
  427. // 30 售后待审核 32 售后审核失败 35 商品待退回 36 商品退回中
  428. // 39 退款申请 40 退款待支付 41 退款中 42 退款失败
  429. // 43 退款成功
  430. // 处方订单
  431. // 20 未开方 21 开方中 22 开方失败 25 待审方
  432. // 26 审方中 27 审方失败,
  433. // 49 用户取消售后
  434. export default {
  435. data() {
  436. return {
  437. isShowView: false,
  438. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  439. deliverListss: '',
  440. isShow: false,
  441. isrefund: '',
  442. id: '',
  443. config: '',
  444. show: false,
  445. codeUrl: '',
  446. deliverExtend: 0,
  447. url: '',
  448. imgUrl: '',
  449. pageList: '',
  450. orderRefund: '',
  451. header: req.header,
  452. orderRefundList: [],
  453. reimburse: false,
  454. canRefund: true,
  455. state: '',
  456. popShow: false,
  457. query: {},
  458. isPay: false,
  459. };
  460. },
  461. onLoad: async function(options) {
  462. this.query = options;
  463. let id = options.id;
  464. this.setData({
  465. isrefund: options.isrefund
  466. }); // req.getRequest('/api/order/detail', {
  467. // id: id
  468. // }, data => {
  469. // that.setData(data);
  470. // if (data.state >= 30 && data.state <= 43) {
  471. // this.getrefundDet(id)
  472. // }
  473. // })
  474. this.setData({
  475. id: id
  476. });
  477. // console.log(options.code);
  478. await this.getConfig();
  479. },
  480. async onShow() {
  481. // #ifdef H5
  482. if (this.isPay) {
  483. this.isPay = false;
  484. req.checkPaySuccess(this.id, sucs => {
  485. console.log('付款结果>>>>', sucs);
  486. this.payJumpSuc(sucs);
  487. });
  488. }
  489. // #endif
  490. if (this.query.scene) {
  491. await this.loadCodeParams();
  492. }
  493. await req.silenceLogin()
  494. let that = this;
  495. await req.getRequest(
  496. '/api/order/detail', {
  497. id: this.id
  498. },
  499. data => {
  500. this.deliverListss = data.deliverList;
  501. // console.log('获取到的退款单11111>>>>>',data.orderRefundList);
  502. // console.log('获取到的退款单>>>>>',this.deliverListss);
  503. data.refund = data.products.filter(it => it.quantity - (it.refundStock ? it.refundStock : 0) >
  504. 0).length;
  505. // console.log(data)
  506. that.setData(data);
  507. that.state = data.state;
  508. if (!data.orderRefundList) {
  509. this.orderRefundList = [];
  510. this.reimburse = true;
  511. } else if (data.orderRefundList.length < 1) {
  512. this.orderRefundList = [];
  513. this.reimburse = true;
  514. } else {
  515. // this.getrefundDet(data.orderRefundList[0].id);
  516. this.orderRefund = data.orderRefundList[0];
  517. let orderRefundList = data.orderRefundList;
  518. this.orderRefundList = orderRefundList;
  519. if (orderRefundList[0].refundState == 43 || orderRefundList[0].refundState == 32) {
  520. this.reimburse = true;
  521. } else {
  522. this.reimburse = false;
  523. }
  524. }
  525. // if (data.state >= 30 && data.state <= 43) {
  526. // this.getrefundDet(this.id);
  527. // }
  528. if (data.mode == 1 && data.state >= 3 && data.state <= 7) {
  529. if (data.orderType != 17 && data.orderType != 18 && data.orderType != 16) {
  530. this.getCodeUrl();
  531. this.generatePoster();
  532. }
  533. }
  534. if (data.mode != 1 && data.state >= 5 && data.state <= 7) {
  535. this.deliverExtendFun();
  536. }
  537. this.isShowView = true;
  538. }
  539. );
  540. },
  541. methods: {
  542. payJumpSuc(sucs) {
  543. if (sucs) {
  544. //支付成功
  545. if (this.isOtc == 1) {
  546. app.globalData.redirectTab('product/pay/pay?isSuccess=true&orderId=' + this.id + '&isRx=1');
  547. } else {
  548. app.globalData.redirectTab('product/pay/pay?isSuccess=true');
  549. }
  550. // let d = {};
  551. // d.state = 3;
  552. // that.setData(d);
  553. } else {
  554. req.msg('支付失败');
  555. }
  556. },
  557. goUrl(e) {
  558. // var dataset = e.currentTarget.dataset;
  559. let url = e.currentTarget.dataset.url;
  560. if (this.deliverState == '完成') {
  561. url = url + '&isReceived=true';
  562. }
  563. uni.navigateTo({
  564. url: url
  565. });
  566. },
  567. eliminate() {
  568. this.setData({
  569. isShow: false
  570. });
  571. },
  572. refundHintText(orderRefundItem) {
  573. var text = '';
  574. if (
  575. (orderRefundItem.refundState == 39 && (orderRefundItem.refundType == 1 || orderRefundItem.refundType ==
  576. 3)) ||
  577. (orderRefundItem.refundState == 40 && (orderRefundItem.refundType == 1 || orderRefundItem.refundType ==
  578. 3)) ||
  579. orderRefundItem.refundState == 30 ||
  580. orderRefundItem.refundState == 31
  581. ) {
  582. text = '您已提交退款申请,等待审核中';
  583. }
  584. if (
  585. ((orderRefundItem.refundState == 41 || orderRefundItem.refundState == 40) && (orderRefundItem
  586. .refundType == 1 || orderRefundItem.refundType == 3)) ||
  587. (orderRefundItem.refundState == 35 && orderRefundItem.refundType == 2 && orderRefundItem
  588. .refundMethod != 2)
  589. ) {
  590. if (orderRefundItem.refundMethod == null && orderRefundItem.refundState == 35) {
  591. text = '您提交的退款申请审核完成,请选择退货方式';
  592. } else {
  593. text =
  594. '您提交的退款申请审核完成' +
  595. ((orderRefundItem.refundState == 41 || orderRefundItem.refundState == 40) && (orderRefundItem
  596. .refundType == 1 || orderRefundItem.refundType == 3) ?
  597. ',等待卖家退款中' :
  598. ',请填写物流信息');
  599. }
  600. }
  601. if (orderRefundItem.refundState == 36 && orderRefundItem.refundType == 2 && orderRefundItem.refundMethod ==
  602. 2) {
  603. text = '您提交的退款申请审核完成,请您把商品送回门店';
  604. } else if (orderRefundItem.refundType == 1 || orderRefundItem.refundType == 3) {
  605. if (orderRefundItem.refundState == 32) {
  606. text = '您提交的退款申请,审核失败,请联系商家' + (!orderRefundItem.refundFalseRes ? '' : ';原因:') + orderRefundItem
  607. .refundFalseRes;
  608. }
  609. } else if (orderRefundItem.refundType == 2) {
  610. if (orderRefundItem.refundState == 32) {
  611. text = '您提交的退货申请,审核失败,请联系商家' + (!orderRefundItem.refundFalseRes ? '' : ';失败原因:') + orderRefundItem
  612. .refundFalseRes;
  613. } else if (orderRefundItem.refundState == 36 && (orderRefundItem.refundMethod == 1 || orderRefundItem
  614. .refundMethod == 3)) {
  615. text = '商品已寄回,等待卖家确认收货';
  616. } else if (orderRefundItem.refundState == 40 || orderRefundItem.refundState == 39 || orderRefundItem
  617. .refundState == 41) {
  618. text = '您寄回的商品卖家已接收,等待卖家退款中';
  619. }
  620. }
  621. if (orderRefundItem.refundState >= 42) {
  622. if (orderRefundItem.refundState == 43) {
  623. text = '退款完成';
  624. } else {
  625. if (orderRefundItem.refundState == 49) {
  626. text = '已取消售后';
  627. } else {
  628. text = '退款失败';
  629. }
  630. }
  631. }
  632. return text;
  633. },
  634. getConfig() {
  635. var _this = this;
  636. return new Promise((resolve, reject) => {
  637. req.g(
  638. '/api/config',
  639. res => {
  640. // console.log('配置数据====' + JSON.stringify(res));
  641. _this.setData({
  642. config: res
  643. });
  644. resolve();
  645. },
  646. true
  647. );
  648. });
  649. },
  650. getCodeUrl() {
  651. let that = this; //获取小程序码
  652. const params = {
  653. // page: 'pages/index/index',
  654. page: 'pages/web/web',
  655. scene: this.query.code
  656. }; // return new Promise((resolve, reject) => {
  657. req.getRequest('/api/program/codev', params, url => {
  658. // console.log(url);
  659. that.setData({
  660. show: true,
  661. codeUrl: url
  662. });
  663. that.generatePoster(url); // resolve();
  664. // })
  665. });
  666. },
  667. // 获取分单发货的
  668. deliverExtendFun() {
  669. req.postRequest(
  670. '/api/order/deliverExtend', {
  671. id: this.query.id
  672. },
  673. res => {
  674. let url;
  675. if (res && res.length >= 2) {
  676. url = '/mine/deliverExtend/deliverExtend?orderId=' + this.id;
  677. this.setData({
  678. deliverExtend: 2,
  679. url: url
  680. });
  681. } else {
  682. url = '/mine/logistics/logistics?id=' + this.deliverId + '&orderId=' + this.id;
  683. this.setData({
  684. deliverExtend: 1,
  685. url: url
  686. });
  687. }
  688. }
  689. );
  690. },
  691. //检验是否为老的订单退款数据
  692. isOldOrder() {
  693. if (this.orderRefundList.length > 0) {
  694. var rRefundList = [];
  695. if (this.deliverList && this.deliverList.length > 0) {
  696. for (var i = 0; i < this.deliverList.length; i++) {
  697. var extendDTOList = this.deliverList[i].extendDTOList;
  698. for (var k = 0; k < extendDTOList.length; k++) {
  699. rRefundList = rRefundList.concat(extendDTOList[k].refundOrderList);
  700. }
  701. }
  702. }
  703. if (this.orderRefundList[0].refundState == 49) {
  704. //售后取消
  705. return false;
  706. } else {
  707. return rRefundList.length <= 0;
  708. }
  709. }
  710. return false;
  711. },
  712. deliverLog(items) {
  713. if (items.mode != 1 && (items.state == 2 || items.state == 3)) {
  714. uni.navigateTo({
  715. url: '/mine/logistics/logistics?id=' + items.id + '&orderId=' + items.orderId
  716. });
  717. }
  718. },
  719. generatePoster(url) {
  720. let that = this;
  721. that.generate(url, imgUrl => {
  722. that.setData({
  723. imgUrl: imgUrl
  724. });
  725. });
  726. },
  727. isAuth(fun) {
  728. if (!uni.saveImageToPhotosAlbum) {
  729. uni.showModal({
  730. title: '提示',
  731. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  732. });
  733. return;
  734. } //可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
  735. // #ifndef H5
  736. uni.getSetting({
  737. success(res) {
  738. // console.log(res);
  739. if (!res.authSetting['scope.writePhotosAlbum']) {
  740. // 接口调用询问
  741. uni.authorize({
  742. scope: 'scope.writePhotosAlbum',
  743. success() {
  744. // console.log("2-授权《保存图片》权限成功");
  745. fun(true);
  746. },
  747. fail() {
  748. fun(false);
  749. }
  750. });
  751. } else {
  752. // 拒绝授权
  753. fun(true);
  754. }
  755. },
  756. fail(res) {
  757. fun(false);
  758. }
  759. });
  760. // #endif
  761. },
  762. saveImage() {
  763. let that = this;
  764. that.isAuth(success => {
  765. if (success) {
  766. // console.log("图片地址=====" + that.imgUrl);
  767. uni.saveImageToPhotosAlbum({
  768. filePath: that.imgUrl,
  769. success(res) {
  770. uni.showToast({
  771. title: '图片保存成功',
  772. icon: 'none',
  773. success() {},
  774. fail() {
  775. uni.showToast({
  776. title: '图片保存失败'
  777. });
  778. }
  779. });
  780. }
  781. });
  782. }
  783. });
  784. },
  785. getImageInfo(url) {
  786. return new Promise((resolve, reject) => {
  787. if (!url) {
  788. resolve();
  789. return false;
  790. }
  791. uni.getImageInfo({
  792. src: url,
  793. success: resolve,
  794. fail: reject
  795. });
  796. });
  797. },
  798. generate(url, success) {
  799. // 获取商品图片
  800. // const picPromise = this.getImageInfo(this.data.config.Distribution_Poster_Background)
  801. // const avatarPromise = this.getImageInfo(this.data.config.CONFIG_PROJECT_LOGO)
  802. // 获取小程序码图
  803. const codePromise = this.getImageInfo(url);
  804. let that = this;
  805. Promise.all([codePromise]).then(([code]) => {
  806. // 创建绘图上下文
  807. const ctx = uni.createCanvasContext('invite', this); // 绘制背景,填充满整个canvas画布
  808. let width = 295,
  809. height = 428; //默认背景
  810. ctx.setFillStyle('#f6f6f6');
  811. ctx.fillRect(0, 0, width, height); //白色背景
  812. ctx.save();
  813. that.roundRect(ctx, 0, 0, 428, 500, 10);
  814. ctx.restore();
  815. ctx.fillStyle = '#333';
  816. ctx.font = '20px PingFang SC';
  817. ctx.fillText('我的提货码', 100, 65);
  818. if (code) {
  819. ctx.drawImage(code.path, 62, 140, 165, 165);
  820. }
  821. ctx.save();
  822. ctx.fillStyle = '#FE0419';
  823. ctx.font = '18px PingFang SC';
  824. ctx.fillText(that.query.code, 130, 100); //logo
  825. // ctx.save();
  826. // ctx.beginPath()
  827. // ctx.arc(35, 35, 20, 0, 2 * Math.PI, true) //画一个圆形裁剪区域
  828. // ctx.clip() //裁剪
  829. // ctx.drawImage(avatar.path, 15, 15, 40, 40) //绘制图片
  830. // 完成作画
  831. ctx.draw(false, function() {
  832. uni.canvasToTempFilePath({
  833. canvasId: 'invite',
  834. success: function(res) {
  835. success.call(this, res.tempFilePath);
  836. },
  837. fail: function(res) {
  838. // console.log(res);
  839. }
  840. },
  841. that
  842. );
  843. });
  844. });
  845. },
  846. loadCodeParams() {
  847. let _ts = this;
  848. return new Promise((resolve, reject) => {
  849. if (!_ts.query.scene) {
  850. resolve();
  851. return false;
  852. }
  853. req.getRequest(
  854. '/api/code/params', {
  855. scene: _ts.query.scene
  856. },
  857. data => {
  858. this.id = data.scene
  859. resolve();
  860. }
  861. );
  862. });
  863. },
  864. /**
  865. *
  866. * @param {CanvasContext} ctx canvas上下文
  867. * @param {number} x 圆角矩形选区的左上角 x坐标
  868. * @param {number} y 圆角矩形选区的左上角 y坐标
  869. * @param {number} w 圆角矩形选区的宽度
  870. * @param {number} h 圆角矩形选区的高度
  871. * @param {number} r 圆角的半径
  872. */
  873. roundRect: function(ctx, x, y, w, h, r) {
  874. // 开始绘制
  875. ctx.beginPath(); // 因为边缘描边存在锯齿,最好指定使用 transparent 填充
  876. // 这里是使用 fill 还是 stroke都可以,二选一即可
  877. ctx.setFillStyle('white'); // ctx.setStrokeStyle('transparent')
  878. // 左上角
  879. ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5); // border-top
  880. ctx.moveTo(x + r, y);
  881. ctx.lineTo(x + w - r, y);
  882. ctx.lineTo(x + w, y + r); // 右上角
  883. ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2); // border-right
  884. ctx.lineTo(x + w, y + h - r);
  885. ctx.lineTo(x + w - r, y + h); // 右下角
  886. ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5); // border-bottom
  887. ctx.lineTo(x + r, y + h);
  888. ctx.lineTo(x, y + h - r); // 左下角
  889. ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI); // border-left
  890. ctx.lineTo(x, y + r);
  891. ctx.lineTo(x + r, y); // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应
  892. ctx.fill(); // ctx.stroke()
  893. ctx.closePath(); // 剪切
  894. ctx.clip();
  895. },
  896. showCode() {
  897. this.setData({
  898. isShow: true
  899. });
  900. },
  901. callPhone: function() {
  902. uni.makePhoneCall({
  903. phoneNumber: this.merchantPhone
  904. });
  905. },
  906. payOrder: async function() {
  907. this.isPay = true;
  908. let that = this;
  909. if (!this.id) return false;
  910. let mode = that.mode;
  911. if (that.mode == 2 && that.orderType == 5) {
  912. mode = 3;
  913. }
  914. // #ifdef MP-WEIXIN
  915. if (that.isOtc == 1) {
  916. await requsetmessage.recipel(mode).then(res => {});
  917. } else if (mode == 1) {
  918. await requsetmessage.selfRaising().then(res => {
  919. // console.log("自提", res);
  920. });
  921. } else if (mode == 2) {
  922. await requsetmessage.distribution().then(res => {
  923. // console.log("配送", res);
  924. });
  925. } else {
  926. await requsetmessage.jisda().then(res => {
  927. // console.log("及时达", res);
  928. });
  929. }
  930. // #endif
  931. //支付成功
  932. h5util.jumpPay({
  933. orderId:this.id,
  934. isRx:this.isOtc == 1?true:''
  935. })
  936. // req.payOrder(this.id, success => {
  937. // this.payJumpSuc(success);
  938. // });
  939. },
  940. txOrder() {
  941. req.postRequest(
  942. '/api/order/reminderOrder', {
  943. orderId: this.id
  944. },
  945. () => {
  946. req.msg('发货提醒成功');
  947. }
  948. );
  949. },
  950. cancelOrder() {
  951. let that = this;
  952. req.msgConfirm('确定取消该订单?', () => {
  953. req.postRequest(
  954. '/api/order/cancel', {
  955. id: this.id
  956. },
  957. () => {
  958. let d = {};
  959. d.state = 8;
  960. that.setData(d);
  961. }
  962. );
  963. });
  964. },
  965. confirmOrder(event) {
  966. //确认收货
  967. // let index = event.currentTarget.dataset.index;
  968. // let page = this.data.pageList[index];
  969. let id = event.currentTarget.dataset.id;
  970. let that = this;
  971. req.msgConfirm('确认执行该操作?', () => {
  972. req.postRequest(
  973. '/api/order/receiving', {
  974. id: id
  975. },
  976. () => {
  977. let d = {};
  978. d['stateName'] = '订单完成';
  979. d['state'] = 7;
  980. that.setData(d);
  981. uni.navigateBack();
  982. }
  983. );
  984. });
  985. },
  986. deleteOrder() {
  987. let that = this;
  988. req.msgConfirm('确定删除该订单?', () => {
  989. req.postRequest(
  990. '/api/order/delete', {
  991. id: this.id
  992. },
  993. () => {
  994. let pages = getCurrentPages();
  995. var prevPage = pages[pages.length - 2];
  996. let pageList = prevPage.data.pageList;
  997. pageList.splice(pageList.findIndex(it => it.id == that.id), 1);
  998. prevPage.$vm.setData({
  999. pageList: pageList
  1000. });
  1001. uni.navigateBack();
  1002. }
  1003. );
  1004. });
  1005. },
  1006. toDetail(e) {
  1007. let id = e.currentTarget.dataset.id;
  1008. app.globalData.openPage('product/detail/detail?id=' + id);
  1009. },
  1010. refundmod(event) {
  1011. //申请退款
  1012. uni.navigateTo({
  1013. url: '/mine/refund/refundType/refundType?id=' + this.id
  1014. });
  1015. },
  1016. refundmods() {
  1017. this.popShow = true;
  1018. },
  1019. cancel() {
  1020. this.popShow = false;
  1021. },
  1022. // 退款详情
  1023. gorefundDetOld() {
  1024. uni.navigateTo({
  1025. url: '/mine/refund/refundDetails/refundDetails?id=' + this.orderRefund.id + '&isrefund=' + this
  1026. .orderRefund.refundType
  1027. });
  1028. },
  1029. gorefundDet(its) {
  1030. // console.log('进入退款详情>>>>>', its);
  1031. uni.navigateTo({
  1032. url: '/mine/refund/refundDetails/refundDetails?id=' + its.id + '&isrefund=' + its.refundType
  1033. });
  1034. },
  1035. getrefundDet(id) {
  1036. req.getRequest(
  1037. '/api/orderRefund/queryRefund', {
  1038. orderId: id
  1039. },
  1040. data => {
  1041. this.setData({
  1042. orderRefund: data
  1043. });
  1044. }
  1045. );
  1046. },
  1047. //电话骑士
  1048. callDeliver() {
  1049. uni.makePhoneCall({
  1050. phoneNumber: this.deliveryUserPhone
  1051. });
  1052. },
  1053. copy() {
  1054. let that = this;
  1055. let id = this.id;
  1056. uni.setClipboardData({
  1057. data: id,
  1058. complete() {
  1059. req.msg('复制成功');
  1060. }
  1061. });
  1062. },
  1063. // 申请开票
  1064. applyInvoice() {
  1065. uni.navigateTo({
  1066. url: '/invoice/apply/apply?orderId=' + this.id + '&money=' + this.money
  1067. });
  1068. },
  1069. toInvoice() {
  1070. uni.navigateTo({
  1071. url: '/mine/invoice/invoice'
  1072. });
  1073. }
  1074. }
  1075. };
  1076. </script>
  1077. <style>
  1078. @import './orderDet.css';
  1079. </style>