index.vue 7.1 KB

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