orderDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <view class="page">
  3. <!-- 订单状态 -->
  4. <view class="title">
  5. <view>
  6. <view class="payment">
  7. {{ title }}
  8. </view>
  9. </view>
  10. </view>
  11. <!-- 订单状态 -->
  12. <!-- 地址信息 -->
  13. <view class="address">
  14. <view class="name-phone">
  15. <u-icon name="map" size="22"></u-icon>
  16. <view style="margin: 0 20rpx; font-size: 32rpx">{{
  17. orderDetail.address_name
  18. }}</view>
  19. <text class="phone">{{ orderDetail.address_mobile }}</text>
  20. </view>
  21. <view class="address-detail">
  22. {{ orderDetail.full_address }}
  23. </view>
  24. <view
  25. class="logistics"
  26. v-if="
  27. orderDetail.status == 'undelivered' ||
  28. orderDetail.status == 'domestic_delivered'
  29. "
  30. >
  31. <text class="_label">{{ i18n.logisticsNumber }}</text>
  32. <view class="num" v-if="orderDetail.logistics.length">
  33. <text>{{ orderDetail.logistics[0].delivery_company }}</text>
  34. <text>{{ "&nbsp;" + "|" + "&nbsp;" }}</text>
  35. <text>{{ orderDetail.logistics[0].delivery_no }}</text>
  36. <image
  37. class="cope-icon"
  38. src="../../static/mine/349.png"
  39. @click="cope(orderDetail.delivery_no)"
  40. mode=""
  41. ></image>
  42. </view>
  43. </view>
  44. </view>
  45. <commodityDetailVue
  46. :status="orderDetail.simplify_status"
  47. :commodityInformation="orderDetail"
  48. :language="language"
  49. />
  50. <view class="order">
  51. <view class="order-number">
  52. <text> {{ i18n.OrderNumber }} </text>
  53. <view>
  54. {{ orderDetail.order_no }} |
  55. <text decode @click="cope(orderDetail.order_no)">{{
  56. "&nbsp;" + i18n.cope
  57. }}</text>
  58. </view>
  59. </view>
  60. <view class="order-number">
  61. <text> {{ i18n.payMethod }} </text>
  62. <view> {{ orderDetail.pay_type_name }} </view>
  63. </view>
  64. <view class="order-number">
  65. <text> {{ i18n.payTime }} </text>
  66. <view> {{ orderDetail.updated_at }} </view>
  67. </view>
  68. <view class="order-number">
  69. <text> {{ i18n.creationTime }} </text>
  70. <view> {{ orderDetail.created_at }} </view>
  71. </view>
  72. <view class="order-number">
  73. <text> {{ i18n.modeTransport }} </text>
  74. <view>
  75. {{ transportType }}
  76. </view>
  77. </view>
  78. </view>
  79. <view
  80. class="footer"
  81. v-if="
  82. orderDetail.status == 'domestic_delivered' ||
  83. orderDetail.status == 'delivered'
  84. "
  85. >
  86. <button
  87. class="status-1"
  88. v-if="
  89. orderDetail.status == 'domestic_delivered' ||
  90. orderDetail.status == 'delivered'
  91. "
  92. @click.stop="toLogistics"
  93. >
  94. {{ i18n.checkLogistics }}
  95. </button>
  96. <!-- <button
  97. class="status-2"
  98. @click="toPayOrder"
  99. v-if="orderDetail.status == 'undifference'"
  100. >
  101. 立即付款
  102. </button> -->
  103. </view>
  104. <view
  105. class="footer"
  106. v-else-if="orderDetail.goods[0].delivery_status == 'merdelivered'"
  107. >
  108. <button class="status-2" @click="toSendOutGoods">
  109. {{ i18n.immediateDelivery }}
  110. </button></view
  111. >
  112. <view
  113. class="footer"
  114. v-else-if="orderDetail.goods[0].delivery_status == 'unfill'"
  115. >
  116. <button class="status-2" @click="toPay">
  117. {{ i18n.PayDeposit }}
  118. </button></view
  119. >
  120. <Remark :show="remarkShow" @remarkClose="remarkClose" />
  121. </view>
  122. </template>
  123. <script>
  124. import commodityDetailVue from "./component/commodityDetail.vue";
  125. import Remark from "../components/remark.vue";
  126. export default {
  127. components: {
  128. commodityDetailVue,
  129. Remark,
  130. },
  131. data() {
  132. return {
  133. status: 6,
  134. show: false,
  135. title: "",
  136. orderDetail: {},
  137. transportType: "",
  138. remarkShow: false,
  139. payStatus: "",
  140. language: this._language, //当前用户选择的语言
  141. };
  142. },
  143. onLoad(option) {
  144. //获取上个页面传输的值,通过该值获取接口数据
  145. this.status = option.orderStatus;
  146. this.payStatus = option.status;
  147. if (option.status == "unfill") {
  148. this.getUnfillOrderDetail(option.orderStatus);
  149. } else {
  150. this.getDetail(option.orderStatus);
  151. }
  152. },
  153. computed: {
  154. i18n() {
  155. return this.$t("index");
  156. },
  157. },
  158. onShow() {
  159. if (this.payStatus == "unfill") {
  160. this.getUnfillOrderDetail(this.status);
  161. } else {
  162. this.getDetail(this.status);
  163. }
  164. },
  165. methods: {
  166. //复制
  167. cope(e) {
  168. uni.setClipboardData({
  169. data: e,
  170. success() {
  171. uni.showToast({
  172. title: this.i18n.replicatingSuccess,
  173. icon: "none",
  174. });
  175. },
  176. });
  177. },
  178. //查看物流进度
  179. toLogistics(value) {
  180. uni.navigateTo({
  181. url: `/pageD/logisticsProgress/logisticsProgress?package=0&orderStatus=${this.orderDetail.status}&orderNumber=${this.orderDetail.order_no}`,
  182. });
  183. },
  184. //打开备注弹框
  185. addRemark() {
  186. this.remarkShow = true;
  187. },
  188. //关闭备注弹框
  189. remarkClose(value) {
  190. this.remarkShow = false;
  191. console.log(this.remarkShow);
  192. //没有接口,有接口再补充
  193. if (value) {
  194. }
  195. },
  196. getUnfillOrderDetail(id) {
  197. uni.$u.http
  198. .post(`/api/order/merchant_order_detail`, { id })
  199. .then((res) => {
  200. this.orderDetail = res;
  201. //直接在dom中使用会报错,首先判断字段存不存在,重新复制后使用
  202. if (res.container) {
  203. if (this.language == "zh-CN") {
  204. this.transportType = res.container.transport_type.name_cn;
  205. } else if (this.language == "en-US") {
  206. this.transportType = res.container.transport_type.name_en;
  207. } else if (this.language == "es-ES") {
  208. this.transportType = res.container.transport_type.name_es;
  209. } else {
  210. this.transportType = res.container.transport_type.name_ita;
  211. }
  212. }
  213. this.title = this.i18n.depositPaid;
  214. });
  215. },
  216. //获取订单详情
  217. getDetail(id) {
  218. uni.$u.http
  219. .post(`/api/order/merchant_order_detail`, { id })
  220. .then((res) => {
  221. this.orderDetail = res;
  222. //直接在dom中使用会报错,首先判断字段存不存在,重新复制后使用
  223. if (res.container) {
  224. if (this.language == "zh-CN") {
  225. this.transportType = res.container.transport_type.name_cn;
  226. } else if (this.language == "en-US") {
  227. this.transportType = res.container.transport_type.name_en;
  228. } else if (this.language == "es-ES") {
  229. this.transportType = res.container.transport_type.name_es;
  230. } else {
  231. this.transportType = res.container.transport_type.name_ita;
  232. }
  233. }
  234. this.title = res.status_name;
  235. });
  236. },
  237. //跳转支付
  238. toPay() {
  239. //所有需要缴纳保证金的金额相加
  240. let goodsMoney = 0;
  241. this.orderDetail.goods.map((item) => {
  242. goodsMoney += Number(item.earnest_money);
  243. });
  244. uni.navigateTo({
  245. url: `/pageA/payorder?sum=${goodsMoney}&orderid=${this.orderDetail.id}&orderType=bond`,
  246. });
  247. },
  248. //跳转支付
  249. toPayOrder() {
  250. uni.navigateTo({
  251. url: `/pageA/payorder?sum=${this.orderDetail.fill_price}&orderid=${this.orderDetail.id}&orderType=difference`,
  252. });
  253. },
  254. //跳转发货页面
  255. toSendOutGoods() {
  256. uni.navigateTo({
  257. url: `/pageD/deliverGoods/deliverGoods?id=${this.orderDetail.id}`,
  258. });
  259. },
  260. },
  261. created() {
  262. //设置顶部标题栏颜色
  263. uni.setNavigationBarColor({
  264. frontColor: "#000000",
  265. backgroundColor: "#f4f4f4",
  266. });
  267. },
  268. };
  269. </script>
  270. <style scoped lang="scss">
  271. .page {
  272. padding: 20rpx 24rpx 180rpx;
  273. .title {
  274. .payment {
  275. font-size: 44rpx;
  276. font-weight: 600;
  277. margin-bottom: 20rpx;
  278. }
  279. .timer {
  280. font-size: 28rpx;
  281. color: #666;
  282. }
  283. }
  284. .address {
  285. background-color: #fff;
  286. border-radius: 16rpx;
  287. padding: 34rpx 24rpx 28rpx;
  288. margin-top: 24rpx;
  289. .name-phone {
  290. display: flex;
  291. align-items: center;
  292. align-items: flex-end;
  293. .phone {
  294. font-size: 26rpx;
  295. color: #666;
  296. }
  297. }
  298. .address-detail {
  299. margin-top: 20rpx;
  300. font-size: 24rpx;
  301. color: #444;
  302. margin-left: 60rpx;
  303. }
  304. .logistics {
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. font-size: 28rpx;
  309. padding-top: 20rpx;
  310. border-top: 2rpx solid #f4f4f4;
  311. margin-top: 20rpx;
  312. ._label {
  313. color: #222;
  314. }
  315. .num {
  316. color: #555;
  317. display: flex;
  318. align-items: center;
  319. }
  320. .cope-icon {
  321. width: 28rpx;
  322. height: 28rpx;
  323. margin-left: 6rpx;
  324. }
  325. }
  326. }
  327. .order {
  328. background-color: #fff;
  329. border-radius: 16rpx;
  330. color: rgba(54, 54, 54, 0.7);
  331. font-size: 28rpx;
  332. margin-top: 20rpx;
  333. padding: 20rpx 20rpx;
  334. .order-number {
  335. display: flex;
  336. justify-content: space-between;
  337. margin-bottom: 32rpx;
  338. }
  339. }
  340. .contact {
  341. padding: 20rpx 0;
  342. background-color: #fff;
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. border-radius: 16rpx;
  347. margin-top: 20rpx;
  348. margin-bottom: 160rpx;
  349. }
  350. .footer {
  351. position: fixed;
  352. bottom: 0;
  353. left: 0;
  354. background-color: #fff;
  355. display: flex;
  356. justify-content: flex-end;
  357. align-items: center;
  358. padding-top: 20rpx;
  359. padding-bottom: 80rpx;
  360. height: 66rpx;
  361. width: 100%;
  362. .status-1 {
  363. background-color: #fff;
  364. border-radius: 34rpx;
  365. margin: 0;
  366. padding: 0;
  367. font-size: 28rpx;
  368. color: #222;
  369. width: 168rpx;
  370. height: 68rpx;
  371. margin-right: 20rpx;
  372. border: 2rpx solid #979797;
  373. }
  374. .status-2 {
  375. background-color: #ffffff;
  376. border-radius: 34rpx;
  377. margin: 0;
  378. padding: 0;
  379. font-size: 28rpx;
  380. color: #f83224;
  381. height: 68rpx;
  382. border: 2rpx solid #f83224;
  383. margin-right: 24rpx;
  384. line-height: 68rpx;
  385. padding: 0 34rpx;
  386. }
  387. }
  388. .transition {
  389. width: 164rpx;
  390. height: 88rpx;
  391. background: #ffffff;
  392. box-shadow: 0rpx 0rpx 20rpx -6rpx rgba(0, 0, 0, 0.3);
  393. position: fixed;
  394. bottom: 160rpx;
  395. text-align: center;
  396. line-height: 88rpx;
  397. font-size: 26rpx;
  398. color: #222;
  399. }
  400. }
  401. </style>