index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view class="RuKuContainer">
  3. <view class="orderList">
  4. <view v-for="(item,index) in list" :key="item.id" class="orderItem">
  5. <view class="Header" :class="item.toggle ? 'open' : ''" @click="item.toggle = !item.toggle">
  6. <view class="num">第{{ item.number }}次发货,共{{ item.get_express.length }}箱</view>
  7. <view class="type">{{ item.express_com }}</view>
  8. <view class="time">{{ item.created_at | dateFormatter('yyyy/MM/dd') }}</view>
  9. </view>
  10. <view v-if="item.toggle" class="hideBodyd">
  11. <view class="hideBodyd_box" @click="goDetail(item,index)">
  12. <image src="../../static/new_stock/finish.png"
  13. v-if="item.get_order && item.get_order.track_status == 2" class="state"></image>
  14. <image src="../../static/new_stock/no_finish.png" v-else class="state"></image>
  15. <view class="boxTop">
  16. <view>
  17. 订单编号:
  18. <text style="color:#3394F8;">{{ data.order_num }}</text>
  19. </view>
  20. <view class="">
  21. 收货人:{{ data.address.nickname.length > 8 ? data.address.nickname.slice(0, 6) + '..' : data.address.nickname }}
  22. <text style="margin-left: 10rpx;">{{ data.address.mobile }}</text>
  23. </view>
  24. <view>
  25. 地址:
  26. {{ `${data.address.province}${data.address.city}${ data.address.town }${ data.address.address }` }}
  27. </view>
  28. <view class="">
  29. 箱数:{{ item.get_express.length }}箱
  30. </view>
  31. </view>
  32. <view class="boxBottom">
  33. 查看详情
  34. </view>
  35. </view>
  36. <!-- <view class="hideBody_top">
  37. <view class="bianhao">
  38. 订单编号:
  39. <text style="color:#3394F8;">5654646434546546</text>
  40. </view>
  41. <view class="mingxi">
  42. 未发明细
  43. </view>
  44. </view> -->
  45. <!-- <view
  46. v-for="(btem,i) in item.get_express"
  47. :key="i"
  48. class="hideItem"
  49. >
  50. <view class="box_fix" v-if="btem.is_gift === 1"></view>
  51. <view class="hideNum">
  52. <view class="num">第{{ i+1 }}箱</view>
  53. <view class="orderNum">单号:{{ btem.express_number }}</view>
  54. </view>
  55. <view class="control" v-if="btem.is_gift === 0">
  56. <view
  57. class="textBtn"
  58. @click="toInfo(btem)"
  59. >
  60. 货物详情
  61. </view>
  62. <view
  63. class="textBtn"
  64. @click="logisticsQuery(btem)"
  65. >
  66. 物流查询
  67. </view>
  68. <view
  69. class="btn"
  70. :class="!(item.is_per && !btem.put_status) ? 'disable' : ''"
  71. @click="toRuKu(item, btem)"
  72. >
  73. 入库
  74. </view>
  75. </view>
  76. <view class="control" v-if="btem.is_gift === 1">
  77. <view class="searche" @click="giftsList(btem)">礼品详情</view>
  78. <view class="searcht" @click="logisticsQuery(btem)">物流查询</view>
  79. </view>
  80. </view> -->
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import {
  88. goodsInfo
  89. } from "@/apis/stock.js"
  90. export default {
  91. data() {
  92. return {
  93. list: [],
  94. order_id: '',
  95. initOpenId: '',
  96. order_num: ''
  97. }
  98. },
  99. onLoad(options) {
  100. this.data = JSON.parse(decodeURIComponent(options.data))
  101. this.getOrderInfo()
  102. },
  103. methods: {
  104. // 订单详情
  105. goDetail(item, index) {
  106. uni.navigateTo({
  107. url: "../lading_detail/detail?num=" + index + '&order_num=' + this.data.order_num + "&item=" +
  108. encodeURIComponent(JSON.stringify(item))
  109. })
  110. },
  111. giftsList(btem) {
  112. if (btem.remark === null) {
  113. btem.remark = ''
  114. }
  115. var obj = eval(btem.notes); //由JSON字符串转换为JSON对象
  116. uni.navigateTo({
  117. url: `../gifts_list/gifts_list?remark=${btem.remark}&item=${encodeURIComponent(JSON.stringify(obj))}`,
  118. });
  119. },
  120. // 获取详情
  121. getOrderInfo() {
  122. uni.showLoading()
  123. const _this = this
  124. goodsInfo({
  125. id: _this.data.order_id
  126. }).then(res => {
  127. uni.hideLoading()
  128. if (res.code === 200) {
  129. let openId = uni.getStorageSync('rukuOpenId')
  130. _this.list = res.data.list.map((item, idx) => {
  131. item.toggle = openId && Number(openId) === Number(item.id)
  132. idx == 0 ? this.$set(item, 'toggle', true) : this.$set(item, 'toggle', false);
  133. return item
  134. })
  135. console.log(_this.list)
  136. } else {
  137. uni.showModal({
  138. content: res.message || "获取货物详情失败",
  139. showCancel: false
  140. })
  141. }
  142. }).catch(() => {
  143. uni.hideLoading()
  144. uni.showModal({
  145. content: "获取货物详情失败",
  146. showCancel: false
  147. })
  148. })
  149. },
  150. // 详情
  151. toInfo(data) {
  152. if (data.remark === null) {
  153. data.remark = ''
  154. }
  155. this.toUrlLink('stock/ing_ruku?status=0&order_id=' + data.id + '&remark=' + data.remark)
  156. },
  157. // 物流查询
  158. logisticsQuery(item) {
  159. uni.navigateTo({
  160. url: '../logistics-details/logistics-details?id=' + item.id + '&express_com=' + item
  161. .express_com + '&express_number=' + item.express_number
  162. });
  163. },
  164. // 入库
  165. toRuKu(item, btem) {
  166. if (!(item.is_per && !btem.put_status)) return false
  167. const _this = this
  168. uni.setStorage({
  169. key: 'rukuOpenId',
  170. data: item.id,
  171. success() {
  172. _this.toUrlLink('stock/ing_ruku?status=1&order_id=' + btem.id)
  173. }
  174. })
  175. },
  176. toUrlLink(url) {
  177. if (!url) return false
  178. uni.navigateTo({
  179. url: `../${url}`
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. page {
  187. display: flex;
  188. flex-direction: column;
  189. }
  190. .RuKuContainer {
  191. width: 100%;
  192. flex: 1;
  193. background-color: #F9F9FB;
  194. .btn {
  195. width: 140rpx;
  196. height: 56rpx;
  197. border-radius: 8rpx;
  198. background-color: #EA4A41;
  199. color: #FFFFFF;
  200. font-size: 28rpx;
  201. line-height: 56rpx;
  202. text-align: center;
  203. text-align: center;
  204. }
  205. .orderList {
  206. width: 100%;
  207. .orderItem {
  208. width: 100%;
  209. margin-bottom: 30rpx;
  210. padding: 0 30rpx;
  211. background-color: #ffffff;
  212. .Header {
  213. width: 100%;
  214. height: 104rpx;
  215. background-color: #ffffff;
  216. box-sizing: border-box;
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. .num {
  221. color: #333333;
  222. font-size: 32rpx;
  223. line-height: 44rpx;
  224. font-weight: bold;
  225. }
  226. .type,
  227. .time {
  228. color: #999999;
  229. font-size: 28rpx;
  230. line-height: 40rpx;
  231. }
  232. &::after {
  233. content: "";
  234. display: block;
  235. width: 30rpx;
  236. height: 30rpx;
  237. background-image: url(../../static/new_my/arrow.png);
  238. background-position: center;
  239. background-size: cover;
  240. background-repeat: no-repeat;
  241. }
  242. &.open {
  243. &::after {
  244. transform: rotate(90deg) !important;
  245. }
  246. }
  247. }
  248. .hideBodyd {
  249. width: 100%;
  250. padding-bottom: 30rpx;
  251. background-color: #fff;
  252. &_box {
  253. background-color: #F8F8F8;
  254. border-radius: 24rpx;
  255. padding: 30rpx 30rpx 0 30rpx;
  256. position: relative;
  257. .state {
  258. width: 108rpx;
  259. height: 98rpx;
  260. position: absolute;
  261. top: 0;
  262. right: 20rpx;
  263. }
  264. .boxTop {
  265. padding-bottom: 15rpx;
  266. view {
  267. font-size: 32rpx;
  268. color: #333;
  269. margin-bottom: 15rpx;
  270. white-space: nowrap;
  271. overflow: hidden;
  272. text-overflow: ellipsis;
  273. }
  274. }
  275. .boxBottom {
  276. line-height: 84rpx;
  277. text-align: center;
  278. border-top: 2rpx solid #eee;
  279. color: #FB231F;
  280. font-size: 32rpx;
  281. }
  282. }
  283. }
  284. .hideBody {
  285. width: 100%;
  286. padding-bottom: 30rpx;
  287. background-color: #fff;
  288. &_top {
  289. display: flex;
  290. justify-content: space-between;
  291. align-items: center;
  292. .bianhao {
  293. font-size: 32rpx;
  294. font-weight: bold;
  295. }
  296. .mingxi {
  297. width: 140rpx;
  298. height: 56rpx;
  299. text-align: center;
  300. line-height: 56rpx;
  301. background: #FB231F;
  302. border-radius: 8rpx;
  303. color: #fff;
  304. }
  305. }
  306. .hideItem {
  307. width: calc(100% - 60rpx);
  308. margin: 0 auto 30rpx auto;
  309. padding: 30rpx;
  310. box-sizing: border-box;
  311. background-color: #fff;
  312. border-radius: 24rpx;
  313. position: relative;
  314. &:nth-last-of-type(1) {
  315. margin-bottom: 0;
  316. }
  317. .box_fix {
  318. width: 6rpx;
  319. height: 84rpx;
  320. background: #FB231F;
  321. position: absolute;
  322. top: 56rpx;
  323. left: 0;
  324. }
  325. .hideNum {
  326. display: flex;
  327. align-items: center;
  328. justify-content: space-between;
  329. padding-bottom: 20rpx;
  330. border-bottom: 1px solid #EEEEEE;
  331. margin-bottom: 26rpx;
  332. color: #333333;
  333. font-size: 32rpx;
  334. line-height: 44rpx;
  335. .num {
  336. width: 120rpx;
  337. text-align: left;
  338. }
  339. .orderNum {
  340. flex: 1;
  341. min-width: 0;
  342. }
  343. }
  344. .control {
  345. width: 100%;
  346. display: flex;
  347. align-items: center;
  348. justify-content: space-between;
  349. .textBtn,
  350. .btn {
  351. width: calc((100% - 120rpx) / 3);
  352. }
  353. .searcht {
  354. color: $base-color;
  355. width: 100%;
  356. text-align: center;
  357. font-size: 28rpx;
  358. }
  359. .searche {
  360. color: $base-color;
  361. width: 100%;
  362. text-align: center;
  363. font-size: 28rpx;
  364. border-right: 2rpx solid #eee;
  365. }
  366. .textBtn {
  367. color: #EA4A41;
  368. font-size: 32rpx;
  369. line-height: 44rpx;
  370. text-align: left;
  371. position: relative;
  372. margin-right: 60rpx;
  373. &::after {
  374. content: "";
  375. display: block;
  376. width: 1px;
  377. height: 26rpx;
  378. background-color: #EEEEEE;
  379. position: absolute;
  380. top: 50%;
  381. right: 0;
  382. transform: translateY(-50%);
  383. }
  384. }
  385. .btn {
  386. &.disable {
  387. background-color: #F9F9FB !important;
  388. color: #999999 !important;
  389. border: 1px solid #EEEEEE;
  390. box-sizing: border-box;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. </style>