orderDetail.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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.simplify_status == 'merdelivered' ||
  28. orderDetail.simplify_status == 'delivered' ||
  29. orderDetail.simplify_status == 'undelivered'
  30. "
  31. >
  32. <text class="_label">物流单号</text>
  33. <view class="num">
  34. <text>{{ orderDetail.delivery_company || "暂无填写物流公司" }}</text>
  35. <text>{{ "&nbsp;" + "|" + "&nbsp;" }}</text>
  36. <text>{{ orderDetail.delivery_no || "暂无填写物流单号" }}</text>
  37. <image
  38. class="cope-icon"
  39. src="../../static/mine/349.png"
  40. @click="cope(orderDetail.delivery_no)"
  41. mode=""
  42. ></image>
  43. </view>
  44. </view>
  45. </view>
  46. <commodityDetailVue
  47. :status="orderDetail.simplify_status"
  48. :commodityInformation="orderDetail"
  49. />
  50. <view class="order">
  51. <view class="order-number">
  52. <text> 订单编号 </text>
  53. <view>
  54. {{ orderDetail.order_no }} |
  55. <text decode @click="cope(orderDetail.order_no)">{{
  56. "&nbsp;" + "复制"
  57. }}</text>
  58. </view>
  59. </view>
  60. <view class="order-number">
  61. <text> 支付方式 </text>
  62. <view> {{ orderDetail.pay_type_name }} </view>
  63. </view>
  64. <view class="order-number">
  65. <text> 支付时间 </text>
  66. <view> {{ orderDetail.updated_at }} </view>
  67. </view>
  68. <view class="order-number">
  69. <text> 创建时间 </text>
  70. <view> {{ orderDetail.created_at }} </view>
  71. </view>
  72. <view class="order-number">
  73. <text> 运输方式 </text>
  74. <view>
  75. {{ transportType }}
  76. </view>
  77. </view>
  78. <!-- <view class="order-number">
  79. <text> 包裹类型 </text>
  80. <view> 海运 </view>
  81. </view> -->
  82. <!-- <view class="order-number">
  83. <text> 包裹数量 </text>
  84. <view> 210 </view>
  85. </view> -->
  86. </view>
  87. <view class="footer" v-if="orderDetail.simplify_status != 'undelivered'">
  88. <button
  89. class="status-2"
  90. v-if="orderDetail.simplify_status == 'unfill'"
  91. @click="toPay"
  92. >
  93. 缴纳保证金
  94. </button>
  95. <button
  96. class="status-1"
  97. v-if="orderDetail.simplify_status == 'undelivered'"
  98. >
  99. 备注
  100. </button>
  101. <button
  102. class="status-2"
  103. v-if="orderDetail.simplify_status == 'undelivered'"
  104. @click="toSendOutGoods"
  105. >
  106. 立即发货
  107. </button>
  108. <button
  109. class="status-1"
  110. v-if="orderDetail.simplify_status == 'delivered'"
  111. >
  112. 查看物流
  113. </button>
  114. <button
  115. class="status-2"
  116. v-if="orderDetail.simplify_status == 'undifference'"
  117. @click="toPayOrder"
  118. >
  119. 立即付款
  120. </button>
  121. </view>
  122. </view>
  123. </template>
  124. <script>
  125. import commodityDetailVue from "./component/commodityDetail.vue";
  126. export default {
  127. components: {
  128. commodityDetailVue,
  129. },
  130. data() {
  131. return {
  132. status: 6,
  133. show: false,
  134. title: "",
  135. orderDetail: {},
  136. transportType: "",
  137. };
  138. },
  139. onLoad(option) {
  140. //获取上个页面传输的值,通过该值获取接口数据
  141. this.status = option.orderStatus;
  142. if (option.status == "unfill") {
  143. this.getUnfillOrderDetail(option.orderStatus);
  144. } else {
  145. this.getDetail(option.orderStatus);
  146. }
  147. },
  148. onShow() {
  149. this.getDetail(option.orderStatus);
  150. },
  151. methods: {
  152. //复制
  153. cope(e) {
  154. uni.setClipboardData({
  155. data: e,
  156. success() {
  157. uni.showToast({
  158. title: "复制成功",
  159. icon: "none",
  160. });
  161. },
  162. });
  163. },
  164. getUnfillOrderDetail(id) {
  165. uni.$u.http
  166. .post(`/api/order/merchant_order_detail`, { id })
  167. .then((res) => {
  168. this.orderDetail = res;
  169. //直接在dom中使用会报错,首先判断字段存不存在,重新复制后使用
  170. if (res.container) {
  171. this.transportType = res.container.transport_type.name;
  172. }
  173. this.title = "待缴纳保证金";
  174. });
  175. },
  176. //获取订单详情
  177. getDetail(id) {
  178. uni.$u.http.get(`/api/order/read?id=${id}`).then((res) => {
  179. this.orderDetail = res;
  180. //直接在dom中使用会报错,首先判断字段存不存在,重新复制后使用
  181. if (res.container) {
  182. this.transportType = res.container.transport_type.name;
  183. }
  184. this.title = res.status_name;
  185. //根据订单状态,显示不同的字段
  186. // if (res.simplify_status == "unfill") {
  187. // this.title = "待缴纳保证金";
  188. // } else if (res.simplify_status == "undelivered") {
  189. // this.title = "待团长发货";
  190. // } else if (res.simplify_status == "merdelivered") {
  191. // this.title = "待总部发货";
  192. // } else if (res.simplify_status == "delivered") {
  193. // this.title = "总部已发货";
  194. // }
  195. });
  196. },
  197. //跳转支付
  198. toPay() {
  199. uni.navigateTo({
  200. url: `/pageA/payorder?num=${this.orderDetail.earnest_money}&orderid=${this.orderDetail.id}`,
  201. });
  202. },
  203. //跳转支付
  204. toPayOrder() {
  205. uni.navigateTo({
  206. url: `/pageA/payorder?num=${this.orderDetail.fill_price}&orderid=${this.orderDetail.id}&orderType=difference`,
  207. });
  208. },
  209. //跳转发货页面
  210. toSendOutGoods() {
  211. uni.navigateTo({
  212. url: `/pageD/deliverGoods/deliverGoods?id=${this.orderDetail.id}`,
  213. });
  214. },
  215. },
  216. created() {
  217. //设置顶部标题栏颜色
  218. uni.setNavigationBarColor({
  219. frontColor: "#000000",
  220. backgroundColor: "#f4f4f4",
  221. });
  222. },
  223. };
  224. </script>
  225. <style scoped lang="scss">
  226. .page {
  227. padding: 20rpx 24rpx 180rpx;
  228. .title {
  229. .payment {
  230. font-size: 44rpx;
  231. font-weight: 600;
  232. margin-bottom: 20rpx;
  233. }
  234. .timer {
  235. font-size: 28rpx;
  236. color: #666;
  237. }
  238. }
  239. .address {
  240. background-color: #fff;
  241. border-radius: 16rpx;
  242. padding: 34rpx 24rpx 28rpx;
  243. margin-top: 24rpx;
  244. .name-phone {
  245. display: flex;
  246. align-items: center;
  247. align-items: flex-end;
  248. .phone {
  249. font-size: 26rpx;
  250. color: #666;
  251. }
  252. }
  253. .address-detail {
  254. margin-top: 20rpx;
  255. font-size: 24rpx;
  256. color: #444;
  257. margin-left: 60rpx;
  258. }
  259. .logistics {
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. font-size: 28rpx;
  264. padding-top: 20rpx;
  265. border-top: 2rpx solid #f4f4f4;
  266. margin-top: 20rpx;
  267. ._label {
  268. color: #222;
  269. }
  270. .num {
  271. color: #555;
  272. display: flex;
  273. align-items: center;
  274. }
  275. .cope-icon {
  276. width: 28rpx;
  277. height: 28rpx;
  278. margin-left: 6rpx;
  279. }
  280. }
  281. }
  282. .order {
  283. background-color: #fff;
  284. border-radius: 16rpx;
  285. color: rgba(54, 54, 54, 0.7);
  286. font-size: 28rpx;
  287. margin-top: 20rpx;
  288. padding: 20rpx 20rpx;
  289. .order-number {
  290. display: flex;
  291. justify-content: space-between;
  292. margin-bottom: 32rpx;
  293. }
  294. }
  295. .contact {
  296. padding: 20rpx 0;
  297. background-color: #fff;
  298. display: flex;
  299. justify-content: center;
  300. align-items: center;
  301. border-radius: 16rpx;
  302. margin-top: 20rpx;
  303. margin-bottom: 160rpx;
  304. }
  305. .footer {
  306. position: fixed;
  307. bottom: 0;
  308. left: 0;
  309. background-color: #fff;
  310. display: flex;
  311. justify-content: flex-end;
  312. align-items: center;
  313. padding-top: 20rpx;
  314. padding-bottom: 80rpx;
  315. height: 66rpx;
  316. width: 100%;
  317. .status-1 {
  318. background-color: #fff;
  319. border-radius: 34rpx;
  320. margin: 0;
  321. padding: 0;
  322. font-size: 28rpx;
  323. color: #222;
  324. width: 168rpx;
  325. height: 68rpx;
  326. margin-right: 20rpx;
  327. border: 2rpx solid #979797;
  328. }
  329. .status-2 {
  330. background-color: #ffffff;
  331. border-radius: 34rpx;
  332. margin: 0;
  333. padding: 0;
  334. font-size: 28rpx;
  335. color: #f83224;
  336. height: 68rpx;
  337. border: 2rpx solid #f83224;
  338. margin-right: 24rpx;
  339. line-height: 68rpx;
  340. padding: 0 34rpx;
  341. }
  342. }
  343. .transition {
  344. width: 164rpx;
  345. height: 88rpx;
  346. background: #ffffff;
  347. box-shadow: 0rpx 0rpx 20rpx -6rpx rgba(0, 0, 0, 0.3);
  348. position: fixed;
  349. bottom: 160rpx;
  350. text-align: center;
  351. line-height: 88rpx;
  352. font-size: 26rpx;
  353. color: #222;
  354. }
  355. }
  356. </style>