index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <!-- 已收货查看选择商品物流 -->
  5. <view class="first" v-if="type!='afterSale'&&type != 'integral'">
  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 == 'afterSale') {
  114. res = await that.$api(`/afterSale/${that.id}`, `GET`)
  115. that.$set(that.tabs, `active`, 'shop')
  116. that.$set(that.tabs, `menu`, [{
  117. title: '店铺物流',
  118. active: 'shop',
  119. }, {
  120. title: '用户物流',
  121. active: 'customer',
  122. }])
  123. } else {
  124. res = await that.$api(`/orderDetail/${that.id}`, 'GET')
  125. }
  126. if (res.errcode == '0') {
  127. if (that.type != 'afterSale' && that.type != 'integral') {
  128. for (let val of res.data.goods) {
  129. val.goods_name = val.goods.name;
  130. val.goods_file = val.goods.file;
  131. }
  132. }
  133. that.$set(that, `info`, res.data);
  134. if (that.type == 'afterSale' || that.type == 'integral') that.search();
  135. } else {
  136. uni.showToast({
  137. title: res.errmsg,
  138. icon: 'none'
  139. })
  140. }
  141. }
  142. },
  143. // 查物流信息
  144. async search() {
  145. const that = this;
  146. if (that.type == 'afterSale') {
  147. let arr = await that.$api(`/afterSale/getTransportInfo/${that.info.id}`, `GET`)
  148. if (arr.errcode == '0') {
  149. if (that.tabs.active == 'shop') {
  150. that.$set(that, `is_check`, arr.data?.shop.is_check);
  151. let list = arr.data?.shop.list.map((i) => ({
  152. desc: i.time,
  153. title: i.context
  154. }))
  155. that.$set(that, `list`, list);
  156. that.$set(that, `no`, arr.data?.shop.no);
  157. } else {
  158. that.$set(that, `is_check`, arr.data?.customer.is_check);
  159. let list = arr.data?.customer.list.map((i) => ({
  160. desc: i.time,
  161. title: i.context
  162. }))
  163. that.$set(that, `list`, list);
  164. that.$set(that, `no`, arr.data?.customer.no);
  165. }
  166. } else {
  167. uni.showToast({
  168. title: res.errmsg,
  169. icon: 'none'
  170. })
  171. }
  172. } else {
  173. if (that.type == 'integral') {
  174. let res = await that.$api(`/zrOrder/sot/${that.info._id}`, `GET`, {}, `integral`);
  175. if (res.errcode == '0') {
  176. that.$set(that, `is_check`, res.data.is_check);
  177. let list = res.data.list.map((i) => ({
  178. desc: i.time,
  179. title: i.context
  180. }))
  181. that.$set(that, `list`, list);
  182. that.$set(that, `no`, res.data.no);
  183. } else {
  184. uni.showToast({
  185. title: res.errmsg,
  186. icon: 'none'
  187. })
  188. }
  189. } else {
  190. let data = that.tabs.menu.find((i) => i.no == that.tabs.active);
  191. if (data) {
  192. that.$set(that, `is_check`, data.is_check);
  193. let list = data.list.map((i) => ({
  194. desc: i.time,
  195. title: i.context
  196. }))
  197. that.$set(that, `list`, list);
  198. that.$set(that, `no`, data.no);
  199. } else {
  200. uni.showToast({
  201. title: '暂无物流信息!',
  202. icon: 'none'
  203. })
  204. }
  205. }
  206. }
  207. },
  208. // 选择指定商品查信息
  209. async goodsChange(e) {
  210. const that = this;
  211. let data = that.info.goods[e.detail.value];
  212. that.$set(that, `goods`, data);
  213. that.$set(that, `goods_name`, data.goods_name);
  214. let res = await that.$api(`/orderDetail/sot`, `POST`, {
  215. id: that.info._id,
  216. goods_id: data._id
  217. });
  218. if (res.errcode == '0') {
  219. for (let [index, item] of res.data.entries()) {
  220. item.title = `物流` + index
  221. item.active = item.no
  222. }
  223. that.$set(that.tabs, `active`, res?.data[0]?.no)
  224. that.$set(that.tabs, `menu`, res.data)
  225. that.search();
  226. } else {
  227. uni.showToast({
  228. title: res.errmsg,
  229. icon: 'none'
  230. })
  231. }
  232. },
  233. // 选择选项卡
  234. tabsChange(e) {
  235. const that = this;
  236. that.$set(that.tabs, `active`, e.active)
  237. that.search()
  238. },
  239. }
  240. }
  241. </script>
  242. <style lang="scss">
  243. .main {
  244. display: flex;
  245. flex-direction: column;
  246. width: 100vw;
  247. height: 100vh;
  248. .first {
  249. position: relative;
  250. width: 100vw;
  251. height: 100vh;
  252. background-color: #ff0000;
  253. .first_1 {
  254. width: 96vw;
  255. padding: 2vw;
  256. .picker {
  257. border: 1px solid #3333;
  258. border-radius: 5px;
  259. padding: 2vw;
  260. background: #fff;
  261. }
  262. }
  263. .first_2 {
  264. display: flex;
  265. width: 92vw;
  266. background-color: #fff;
  267. padding: 2vw;
  268. margin: 0 2vw;
  269. border-radius: 7px;
  270. .image {
  271. width: 22vw;
  272. height: 22vw;
  273. }
  274. .other {
  275. width: 65vw;
  276. padding: 0 0 0 2vw;
  277. .name {
  278. font-size: 16px;
  279. font-weight: bold;
  280. }
  281. .other_1 {
  282. text {
  283. font-size: 13px;
  284. color: #858585;
  285. }
  286. text:last-child {
  287. color: #000000;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. .second {
  294. position: absolute;
  295. bottom: 0;
  296. width: 92vw;
  297. height: 60vh;
  298. overflow-y: auto;
  299. background: #fff;
  300. margin: 0 2vw;
  301. border-top-left-radius: 5px;
  302. border-top-right-radius: 5px;
  303. padding: 2vw;
  304. .tabsList {
  305. .second_1 {
  306. margin: 0 0 2vw 0;
  307. .second_1_1 {
  308. padding: 1vw 0;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .uni-section .uni-section-header {
  315. padding: 1vw !important;
  316. }
  317. .uni-section .uni-section-content {
  318. padding: 0 !important;
  319. }
  320. </style>