orderDetail.vue 9.2 KB

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