index.vue 7.2 KB

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