index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
  6. </view>
  7. <view class="two">
  8. <tabs :tabs="tabs" @tabsChange="tabsChange">
  9. <view class="tabsList">
  10. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  11. <view class="list-scroll-view">
  12. <view class="list" v-for="(item,index) in list" :key="index">
  13. <view class="list_1">
  14. <view class="l">
  15. <text class="iconfont icon-shangdian"></text>
  16. <text>{{item.shop}}</text>
  17. </view>
  18. <view class="r">
  19. {{item.status=='0'?'待付款':'已付款'}}
  20. </view>
  21. </view>
  22. <view class="list_2">
  23. <view class="l">
  24. <image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''"
  25. mode=""></image>
  26. </view>
  27. <view class="c">
  28. <view class="name">
  29. {{item.name}}
  30. </view>
  31. </view>
  32. <view class="r">
  33. <view class="price">
  34. ¥{{item.price}}
  35. </view>
  36. <view class="num">
  37. ×{{item.buy_num}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="other">
  42. <text>共{{item.market_num}}件商品</text>
  43. <text>总价¥{{item.money}}</text>
  44. </view>
  45. <view class="btn">
  46. <button v-if="item.status=='0'" type="default" @click="toCancel(item)" size="mini">取消订单</button>
  47. <button v-if="item.status=='0'" type="default" @click="toPay(item)" size="mini">付款</button>
  48. <button v-if="item.status=='3'" type="default" @click="toAfter(item)" size="mini">申请售后</button>
  49. <button v-if="item.status=='3'" type="default" @click="toRefund(item)" size="mini">申请退款</button>
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. </tabs>
  56. </view>
  57. </view>
  58. </mobile-frame>
  59. </template>
  60. <script>
  61. import tabs from '@/components/tabs/index.vue';
  62. export default {
  63. components: {
  64. tabs
  65. },
  66. data() {
  67. return {
  68. user: {},
  69. status: '',
  70. searchInfo: {},
  71. tabs: {
  72. active: '-0',
  73. menu: [ //菜单列表
  74. {
  75. title: '全部订单',
  76. active: '-0'
  77. },
  78. {
  79. title: '待付款',
  80. active: '0'
  81. },
  82. {
  83. title: '待发货',
  84. active: '1'
  85. },
  86. {
  87. title: '待收货',
  88. active: '2'
  89. },
  90. {
  91. title: '已收货',
  92. active: '3'
  93. }
  94. ]
  95. },
  96. list: [ //订单列表
  97. {
  98. shop: '官方自营店',
  99. status: '0',
  100. url: [{
  101. name: "20220928155634.jpg",
  102. uri: "/files/point/20220928155634.jpg",
  103. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  104. }],
  105. name: '饮用水',
  106. price: 58,
  107. buy_num: 1,
  108. market_num: 1,
  109. money: 58
  110. }
  111. ]
  112. };
  113. },
  114. onLoad: function(e) {
  115. const that = this;
  116. that.$set(that, `status`, e.status);
  117. // 监听用户是否登录
  118. that.watchLogin();
  119. },
  120. onShow: function() {},
  121. methods: {
  122. // 监听用户是否登录
  123. watchLogin() {
  124. const that = this;
  125. uni.getStorage({
  126. key: 'token',
  127. success: function(res) {
  128. let user = that.$jwt(res.data);
  129. if (user) that.$set(that, `user`, user);
  130. that.$set(that.tabs, `active`, that.status);
  131. that.search();
  132. },
  133. fail: function(err) {
  134. uni.navigateTo({
  135. url: `/pages/login/index`
  136. })
  137. }
  138. });
  139. },
  140. // 查询列表
  141. async search() {
  142. const that = this;
  143. let user = that.user;
  144. let status = that.status;
  145. console.log(status);
  146. },
  147. // 分页
  148. toPage(e) {
  149. },
  150. // 输入框
  151. toInput(e) {
  152. const that = this;
  153. that.$set(that.searchInfo, `name`, e.detail.value)
  154. },
  155. // 取消订单
  156. toCancel(e) {
  157. console.log(e);
  158. },
  159. // 付款
  160. toPay(e) {
  161. console.log(e);
  162. },
  163. // 申请售后
  164. toAfter(e) {
  165. console.log(e);
  166. },
  167. // 申请退款
  168. toRefund(e) {
  169. console.log(e);
  170. },
  171. // 选择选项卡
  172. tabsChange(e) {
  173. const that = this;
  174. that.$set(that.tabs, `active`, e.active)
  175. that.$set(that, `status`, e.active);
  176. that.search()
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. .main {
  183. display: flex;
  184. flex-direction: column;
  185. width: 100vw;
  186. height: 100vh;
  187. .one {
  188. padding: 2vw;
  189. input {
  190. padding: 2vw;
  191. background-color: var(--f1Color);
  192. font-size: var(--font14Size);
  193. border-radius: 5px;
  194. }
  195. }
  196. .two {
  197. position: relative;
  198. flex-grow: 1;
  199. background-color: var(--f9Color);
  200. .tabsList {
  201. position: relative;
  202. width: 100vw;
  203. height: 82vh;
  204. .list {
  205. background-color: #fff;
  206. margin: 0 2vw 2vw 2vw;
  207. padding: 2vw;
  208. .list_1 {
  209. margin: 0 0 1vw 0;
  210. display: flex;
  211. flex-direction: row;
  212. justify-content: space-between;
  213. }
  214. .list_2 {
  215. margin: 0 0 1vw 0;
  216. display: flex;
  217. .l {
  218. width: 20vw;
  219. .image {
  220. width: 100%;
  221. height: 20vw;
  222. border-radius: 5px;
  223. }
  224. }
  225. .c {
  226. width: 60vw;
  227. padding: 0 2vw;
  228. }
  229. .r {
  230. width: 15vw;
  231. text-align: right;
  232. }
  233. }
  234. .other {
  235. margin: 0 0 2vw 0;
  236. text-align: right;
  237. text {
  238. font-size: 14px;
  239. padding: 0 0 0 2vw;
  240. }
  241. }
  242. .btn {
  243. text-align: right;
  244. margin: 2vw 0 0 0;
  245. border-top: 1px solid #f1fff1;
  246. button {
  247. margin: 2vw 0 0 2vw;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. // .two {
  255. // position: relative;
  256. // flex-grow: 1;
  257. // background-color: var(--f9Color);
  258. // .two_1 {
  259. // background-color: var(--fffColor);
  260. // padding: 2vw;
  261. // display: flex;
  262. // flex-direction: row;
  263. // }
  264. // .two_2 {
  265. // display: flex;
  266. // flex-direction: column;
  267. // .list {
  268. // width: 100vw;
  269. // margin: 2vw 0 0 0;
  270. // background-color: var(--mainColor);
  271. // .list_1 {
  272. // display: flex;
  273. // flex-direction: row;
  274. // justify-content: space-between;
  275. // padding: 2vw;
  276. // .name {
  277. // font-size: var(--font14Size);
  278. // text {
  279. // margin: 0 1vw 0 0;
  280. // }
  281. // }
  282. // .status {
  283. // font-size: var(--font14Size);
  284. // color: var(--ff0Color);
  285. // }
  286. // }
  287. // .list_2 {
  288. // display: flex;
  289. // flex-direction: row;
  290. // justify-content: space-between;
  291. // padding: 2vw;
  292. // background-color: var(--f8Color);
  293. // .image {
  294. // width: 20vw;
  295. // height: 20vw;
  296. // margin: 0 2vw 0 0;
  297. // }
  298. // .other {
  299. // display: flex;
  300. // flex-direction: column;
  301. // flex-grow: 1;
  302. // .name {
  303. // font-size: var(--font14Size);
  304. // font-weight: bold;
  305. // margin: 0 0 2vw 0;
  306. // }
  307. // .other_1 {
  308. // font-size: var(--font12Size);
  309. // color: var(--f85Color);
  310. // }
  311. // }
  312. // .money {
  313. // font-size: var(--font12Size);
  314. // .num {
  315. // text-align: right;
  316. // }
  317. // }
  318. // }
  319. // .list_3 {
  320. // display: flex;
  321. // justify-content: flex-end;
  322. // padding: 2vw;
  323. // border-bottom: 0.5vw solid var(--f9Color);
  324. // font-size: var(--font12Size);
  325. // text {
  326. // margin: 0 1vw;
  327. // }
  328. // }
  329. // .list_4 {
  330. // padding: 2vw;
  331. // text-align: right;
  332. // button {
  333. // margin: 0 1vw 0 2vw;
  334. // }
  335. // }
  336. // }
  337. // }
  338. // }
  339. // }
  340. .scroll-view {
  341. position: absolute;
  342. top: 0;
  343. left: 0;
  344. right: 0;
  345. bottom: 0;
  346. .list-scroll-view {
  347. display: flex;
  348. flex-direction: column;
  349. }
  350. }
  351. </style>