orderDetail.vue 9.2 KB

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