index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <!-- 已收货查看选择商品物流 -->
  5. <view class="first" v-if="type == 'order'">
  6. <view class="first_1">
  7. <picker class="picker" mode="selector" :range="info.goods" @change="goodsChange"
  8. range-key="goods_name">
  9. <view>{{goods_name||'请选择查看物流的商品'}}</view>
  10. </picker>
  11. </view>
  12. <view class="first_2" v-if="goods_name">
  13. <image class="image" :src="goods.goods_file&&goods.goods_file.length>0?goods.goods_file[0].url:''"
  14. mode="">
  15. <view class="other">
  16. <view class="name textOver">
  17. {{goods.goods_name}}
  18. </view>
  19. <view class="other_1 textOver">
  20. <text>规格:</text>
  21. <text>{{goods.name}}</text>
  22. </view>
  23. <view class="other_1 textOver">
  24. <text>金额:</text>
  25. <text>¥{{info.type=='0'?goods.price||goods.sell_money:goods.group_config.money}}</text>
  26. </view>
  27. <view class="other_1 textOver">
  28. <text>数量:</text>
  29. <text>×{{goods.buy_num}}</text>
  30. </view>
  31. </view>
  32. </image>
  33. </view>
  34. </view>
  35. <!-- 售后,尊荣商品查看物流 -->
  36. <view class="first" v-else></view>
  37. <view class="second">
  38. <tabs :tabs="tabs" @tabsChange="tabsChange">
  39. <view class="tabsList">
  40. <view class="second_1">
  41. <view class="second_1_1">
  42. <text>订单状态:</text>
  43. <text>{{is_check}}</text>
  44. </view>
  45. <view class="second_1_1">
  46. <text>物流单号:</text>
  47. <text>{{no}}</text>
  48. </view>
  49. </view>
  50. <view class="second_2">
  51. <uni-section title="物流记录" type="line" padding>
  52. <uni-steps :options="list" active-color="#007AFF" :active="active" direction="column" />
  53. </uni-section>
  54. </view>
  55. </view>
  56. </tabs>
  57. </view>
  58. </view>
  59. </view>
  60. </mobile-frame>
  61. </template>
  62. <script>
  63. import tabs from '@/components/tabs/index.vue';
  64. export default {
  65. components: {
  66. tabs
  67. },
  68. data() {
  69. return {
  70. id: '',
  71. // 类型
  72. type: '',
  73. // 商品选择
  74. goods_name: '',
  75. goods: {},
  76. // 标签页
  77. tabs: {
  78. active: '',
  79. menu: []
  80. },
  81. user: {},
  82. info: {},
  83. is_check: '',
  84. no: '',
  85. list: []
  86. };
  87. },
  88. onLoad: function(e) {
  89. const that = this;
  90. that.$set(that, `id`, e.id || '');
  91. that.$set(that, `type`, e.type || '');
  92. that.watchLogin()
  93. },
  94. methods: {
  95. watchLogin() {
  96. const that = this;
  97. uni.getStorage({
  98. key: 'token',
  99. success: function(res) {
  100. let user = that.$jwt(res.data);
  101. if (user) that.$set(that, `user`, user);
  102. that.searchInfo();
  103. }
  104. })
  105. },
  106. // 查商品详情
  107. async searchInfo() {
  108. const that = this;
  109. if (that.id) {
  110. let res;
  111. if (that.type == 'integral') {
  112. res = await that.$api(`/zrOrder/${that.id}`, `GET`, {}, `integral`)
  113. } else if (that.type == 'groupOrder') {
  114. res = await that.$api(`/groupOrder/${that.id}`, `GET`, {}, `group`)
  115. } else if (that.type == 'afterSale') {
  116. res = await that.$api(`/afterSale/${that.id}`, `GET`)
  117. that.$set(that.tabs, `active`, 'shop')
  118. that.$set(that.tabs, `menu`, [{
  119. title: '店铺物流',
  120. active: 'shop',
  121. }, {
  122. title: '用户物流',
  123. active: 'customer',
  124. }])
  125. } else if (that.type == 'groupAfterSale') {
  126. res = await that.$api(`/groupAfterSale/${that.id}`, `GET`, {}, 'group')
  127. that.$set(that.tabs, `active`, 'shop')
  128. that.$set(that.tabs, `menu`, [{
  129. title: '店铺物流',
  130. active: 'shop',
  131. }, {
  132. title: '用户物流',
  133. active: 'customer',
  134. }])
  135. } else {
  136. res = await that.$api(`/orderDetail/${that.id}`, 'GET')
  137. }
  138. if (res.errcode == '0') {
  139. if (that.type == 'order') {
  140. for (let val of res.data.goods) {
  141. val.goods_name = val.goods.name;
  142. val.goods_file = val.goods.file;
  143. }
  144. }
  145. that.$set(that, `info`, res.data);
  146. if (that.type != 'order') that.search();
  147. } else {
  148. uni.showToast({
  149. title: res.errmsg,
  150. icon: 'none'
  151. })
  152. }
  153. }
  154. },
  155. // 查物流信息
  156. async search() {
  157. const that = this;
  158. if (that.type == 'afterSale') {
  159. let arr = await that.$api(`/afterSale/getTransportInfo/${that.info.id}`, `GET`)
  160. if (arr.errcode == '0') {
  161. if (that.tabs.active == 'shop') {
  162. that.$set(that, `is_check`, arr.data?.shop.is_check);
  163. let list = arr.data?.shop.list.map((i) => ({
  164. desc: i.time,
  165. title: i.context
  166. }))
  167. that.$set(that, `list`, list);
  168. that.$set(that, `no`, arr.data?.shop.no);
  169. } else {
  170. that.$set(that, `is_check`, arr.data?.customer.is_check);
  171. let list = arr.data?.customer.list.map((i) => ({
  172. desc: i.time,
  173. title: i.context
  174. }))
  175. that.$set(that, `list`, list);
  176. that.$set(that, `no`, arr.data?.customer.no);
  177. }
  178. } else {
  179. uni.showToast({
  180. title: res.errmsg,
  181. icon: 'none'
  182. })
  183. }
  184. } else {
  185. if (that.type == 'integral') {
  186. let res = await that.$api(`/zrOrder/sot/${that.info._id}`, `GET`, {}, `integral`);
  187. if (res.errcode == '0') {
  188. that.$set(that, `is_check`, res.data.is_check);
  189. let list = res.data.list.map((i) => ({
  190. desc: i.time,
  191. title: i.context
  192. }))
  193. that.$set(that, `list`, list);
  194. that.$set(that, `no`, res.data.no);
  195. } else {
  196. uni.showToast({
  197. title: res.errmsg,
  198. icon: 'none'
  199. })
  200. }
  201. } else if (that.type == 'groupAfterSale') {
  202. let arr = await that.$api(`/orderOthers/afterSale/transport`, `POST`, {
  203. id: that.id
  204. }, `group`);
  205. if (arr.errcode == '0') {
  206. if (that.tabs.active == 'shop') {
  207. that.$set(that, `is_check`, arr.data?.shop.is_check);
  208. let list = arr.data?.shop.list.map((i) => ({
  209. desc: i.time,
  210. title: i.context
  211. }))
  212. that.$set(that, `list`, list);
  213. that.$set(that, `no`, arr.data?.shop.no);
  214. } else {
  215. that.$set(that, `is_check`, arr.data?.customer.is_check);
  216. let list = arr.data?.customer.list.map((i) => ({
  217. desc: i.time,
  218. title: i.context
  219. }))
  220. that.$set(that, `list`, list);
  221. that.$set(that, `no`, arr.data?.customer.no);
  222. }
  223. } else {
  224. uni.showToast({
  225. title: res.errmsg,
  226. icon: 'none'
  227. })
  228. }
  229. } else if (that.type == 'groupOrder') {
  230. let res = await that.$api(`/orderOthers/transport`, `POST`, {
  231. order: that.id
  232. }, `group`);
  233. if (res.errcode == '0') {
  234. that.$set(that, `is_check`, res?.data[0].is_check);
  235. let list = res?.data[0].list.map((i) => ({
  236. desc: i.time,
  237. title: i.context
  238. }))
  239. that.$set(that, `list`, list);
  240. that.$set(that, `no`, res?.data[0].no);
  241. } else {
  242. uni.showToast({
  243. title: res.errmsg,
  244. icon: 'none'
  245. })
  246. }
  247. } else {
  248. let data = that.tabs.menu.find((i) => i.no == that.tabs.active);
  249. if (data) {
  250. that.$set(that, `is_check`, data.is_check);
  251. let list = data.list.map((i) => ({
  252. desc: i.time,
  253. title: i.context
  254. }))
  255. that.$set(that, `list`, list);
  256. that.$set(that, `no`, data.no);
  257. } else {
  258. uni.showToast({
  259. title: '暂无物流信息!',
  260. icon: 'none'
  261. })
  262. }
  263. }
  264. }
  265. },
  266. // 选择指定商品查信息
  267. async goodsChange(e) {
  268. const that = this;
  269. let data = that.info.goods[e.detail.value];
  270. that.$set(that, `goods`, data);
  271. that.$set(that, `goods_name`, data.goods_name);
  272. let res = await that.$api(`/orderDetail/sot`, `POST`, {
  273. id: that.info._id,
  274. goods_id: data._id
  275. });
  276. if (res.errcode == '0') {
  277. for (let [index, item] of res.data.entries()) {
  278. item.title = `物流` + index
  279. item.active = item.no
  280. }
  281. that.$set(that.tabs, `active`, res?.data[0]?.no)
  282. that.$set(that.tabs, `menu`, res.data)
  283. that.search();
  284. } else {
  285. uni.showToast({
  286. title: res.errmsg,
  287. icon: 'none'
  288. })
  289. }
  290. },
  291. // 选择选项卡
  292. tabsChange(e) {
  293. const that = this;
  294. that.$set(that.tabs, `active`, e.active)
  295. that.search()
  296. },
  297. }
  298. }
  299. </script>
  300. <style lang="scss">
  301. .main {
  302. display: flex;
  303. flex-direction: column;
  304. width: 100vw;
  305. height: 100vh;
  306. .first {
  307. position: relative;
  308. width: 100vw;
  309. height: 100vh;
  310. background-color: #ff0000;
  311. .first_1 {
  312. width: 96vw;
  313. padding: 2vw;
  314. .picker {
  315. border: 1px solid #3333;
  316. border-radius: 5px;
  317. padding: 2vw;
  318. background: #fff;
  319. }
  320. }
  321. .first_2 {
  322. display: flex;
  323. width: 92vw;
  324. background-color: #fff;
  325. padding: 2vw;
  326. margin: 0 2vw;
  327. border-radius: 7px;
  328. .image {
  329. width: 22vw;
  330. height: 22vw;
  331. }
  332. .other {
  333. width: 65vw;
  334. padding: 0 0 0 2vw;
  335. .name {
  336. font-size: 16px;
  337. font-weight: bold;
  338. }
  339. .other_1 {
  340. text {
  341. font-size: 13px;
  342. color: #858585;
  343. }
  344. text:last-child {
  345. color: #000000;
  346. }
  347. }
  348. }
  349. }
  350. }
  351. .second {
  352. position: absolute;
  353. bottom: 0;
  354. width: 92vw;
  355. height: 60vh;
  356. overflow-y: auto;
  357. background: #fff;
  358. margin: 0 2vw;
  359. border-top-left-radius: 5px;
  360. border-top-right-radius: 5px;
  361. padding: 2vw;
  362. .tabsList {
  363. .second_1 {
  364. margin: 0 0 2vw 0;
  365. .second_1_1 {
  366. padding: 1vw 0;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. .uni-section .uni-section-header {
  373. padding: 1vw !important;
  374. }
  375. .uni-section .uni-section-content {
  376. padding: 0 !important;
  377. }
  378. </style>