index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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. <!-- <view v-show="tabs.active=='0'">全部</view>
  53. <view v-show="tabs.active=='1'">待付款</view>
  54. <view v-show="tabs.active=='2'">待发货</view>
  55. <view v-show="tabs.active=='3'">待收货/消费</view>
  56. <view v-show="tabs.active=='4'">待评价</view> -->
  57. </tabs>
  58. </view>
  59. <!-- <view class="one">
  60. <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
  61. </view>
  62. <view class="two">
  63. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  64. <view class="list-scroll-view">
  65. <view class="two_1">
  66. </view>
  67. <view class="two_2">
  68. <view class="list" v-for="(item,index) in list" :key="index">
  69. <view class="list_1">
  70. <view class="name">
  71. <text @click="toDel(item)" class="iconfont icon-shangdian"></text>
  72. <text>{{item.shop}}</text>
  73. </view>
  74. <view class="status">{{item.status=='0'?'待付款':'已付款'}}</view>
  75. </view>
  76. <view class="list_2">
  77. <image class="image" :src="item.url" mode=""></image>
  78. <view class="other">
  79. <view class="name">{{item.name}}</view>
  80. <view class="other_1">
  81. 口味: {{item.num||'暂无'}}
  82. </view>
  83. </view>
  84. <view class="money">
  85. <text>¥</text>
  86. <text>{{item.money}}</text>
  87. <view class="num">
  88. ×{{item.num}}
  89. </view>
  90. </view>
  91. </view>
  92. <view class="list_3">
  93. <text>共{{item.num}}件商品</text>
  94. <view class="money">
  95. <text>总价¥</text>
  96. <text>{{item.money}}</text>
  97. </view>
  98. </view>
  99. <view class="list_4">
  100. <button type="default" size="mini" plain="true"
  101. @click="toCancel(item)">取消订单</button>
  102. <button type="warn" size="mini" plain="true" @click="toPay(item)">付款</button>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </scroll-view>
  108. </view> -->
  109. </view>
  110. </mobile-frame>
  111. </template>
  112. <script>
  113. import tabs from '@/components/tabs/index.vue';
  114. export default {
  115. components: {
  116. tabs
  117. },
  118. data() {
  119. return {
  120. user: {},
  121. status: '0',
  122. searchInfo: {},
  123. tabs: {
  124. active: '0',
  125. menu: [ //菜单列表
  126. {
  127. title: '全部',
  128. active: '0'
  129. },
  130. {
  131. title: '待付款',
  132. active: '1'
  133. },
  134. {
  135. title: '待发货',
  136. active: '2'
  137. },
  138. {
  139. title: '待收货/消费',
  140. active: '3'
  141. },
  142. {
  143. title: '待评价',
  144. active: '4'
  145. }
  146. ]
  147. },
  148. list: [ //订单列表
  149. {
  150. shop: '官方自营店',
  151. status: '1',
  152. url: [{
  153. name: "20220928155634.jpg",
  154. uri: "/files/point/20220928155634.jpg",
  155. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  156. }],
  157. name: '饮用水',
  158. price: 58,
  159. buy_num: 1,
  160. market_num: 1,
  161. money: 58
  162. }, {
  163. shop: '官方自营店',
  164. status: '1',
  165. url: [{
  166. name: "20220928155634.jpg",
  167. uri: "/files/point/20220928155634.jpg",
  168. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  169. }],
  170. name: '饮用水',
  171. price: 58,
  172. buy_num: 1,
  173. market_num: 1,
  174. money: 58
  175. }, {
  176. shop: '官方自营店',
  177. status: '1',
  178. url: [{
  179. name: "20220928155634.jpg",
  180. uri: "/files/point/20220928155634.jpg",
  181. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  182. }],
  183. name: '饮用水',
  184. price: 58,
  185. buy_num: 1,
  186. market_num: 1,
  187. money: 58
  188. }, {
  189. shop: '官方自营店',
  190. status: '1',
  191. url: [{
  192. name: "20220928155634.jpg",
  193. uri: "/files/point/20220928155634.jpg",
  194. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  195. }],
  196. name: '饮用水饮用水饮用水饮用水饮用水饮用水饮用水饮用水饮用水饮用水饮用水',
  197. price: 58,
  198. buy_num: 1,
  199. market_num: 1,
  200. money: 58
  201. }, {
  202. shop: '官方自营店',
  203. status: '1',
  204. url: [{
  205. name: "20220928155634.jpg",
  206. uri: "/files/point/20220928155634.jpg",
  207. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  208. }],
  209. name: '饮用水',
  210. price: 58,
  211. buy_num: 1,
  212. market_num: 1,
  213. money: 58
  214. }, {
  215. shop: '官方自营店',
  216. status: '1',
  217. url: [{
  218. name: "20220928155634.jpg",
  219. uri: "/files/point/20220928155634.jpg",
  220. url: "https://broadcast.waityou24.cn/files/point/20220928155634.jpg"
  221. }],
  222. name: '饮用水',
  223. price: 58,
  224. buy_num: 1,
  225. market_num: 1,
  226. money: 58
  227. }
  228. ]
  229. };
  230. },
  231. onLoad: function(e) {
  232. const that = this;
  233. that.$set(that, `status`, e.status);
  234. // 监听用户是否登录
  235. that.watchLogin();
  236. },
  237. onShow: function() {},
  238. methods: {
  239. // 监听用户是否登录
  240. watchLogin() {
  241. const that = this;
  242. uni.getStorage({
  243. key: 'token',
  244. success: function(res) {
  245. let user = that.$jwt(res.data);
  246. if (user) that.$set(that, `user`, user);
  247. that.$set(that.tabs, `active`, that.status);
  248. that.search();
  249. },
  250. fail: function(err) {
  251. uni.navigateTo({
  252. url: `/pages/login/index`
  253. })
  254. }
  255. });
  256. },
  257. // 查询列表
  258. async search() {
  259. const that = this;
  260. let user = that.user;
  261. let status = that.status;
  262. console.log(status);
  263. },
  264. // 分页
  265. toPage(e) {
  266. },
  267. // 输入框
  268. toInput(e) {
  269. const that = this;
  270. that.$set(that.searchInfo, `name`, e.detail.value)
  271. },
  272. // 取消订单
  273. toCancel(e) {
  274. console.log(e);
  275. },
  276. // 付款
  277. toPay(e) {
  278. console.log(e);
  279. },
  280. // 选择选项卡
  281. tabsChange(e) {
  282. const that = this;
  283. that.$set(that.tabs, `active`, e.active)
  284. that.$set(that, `status`, e.active);
  285. that.search()
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="scss">
  291. .main {
  292. display: flex;
  293. flex-direction: column;
  294. width: 100vw;
  295. height: 100vh;
  296. .one {
  297. padding: 2vw;
  298. input {
  299. padding: 2vw;
  300. background-color: var(--f1Color);
  301. font-size: var(--font14Size);
  302. border-radius: 5px;
  303. }
  304. }
  305. .two {
  306. position: relative;
  307. flex-grow: 1;
  308. background-color: var(--f9Color);
  309. .tabsList {
  310. position: relative;
  311. width: 100vw;
  312. height: 82vh;
  313. .list {
  314. background-color: #fff;
  315. margin: 0 2vw 2vw 2vw;
  316. padding: 2vw;
  317. .list_1 {
  318. margin: 0 0 1vw 0;
  319. display: flex;
  320. flex-direction: row;
  321. justify-content: space-between;
  322. }
  323. .list_2 {
  324. margin: 0 0 1vw 0;
  325. display: flex;
  326. .l {
  327. width: 20vw;
  328. .image {
  329. width: 100%;
  330. height: 20vw;
  331. border-radius: 5px;
  332. }
  333. }
  334. .c {
  335. width: 60vw;
  336. padding: 0 2vw;
  337. }
  338. .r {
  339. width: 15vw;
  340. text-align: right;
  341. }
  342. }
  343. .other {
  344. margin: 0 0 2vw 0;
  345. text-align: right;
  346. text {
  347. font-size: 14px;
  348. padding: 0 0 0 2vw;
  349. }
  350. }
  351. .btn {
  352. text-align: right;
  353. margin: 2vw 0 0 0;
  354. border-top: 1px solid #f1fff1;
  355. button {
  356. margin: 2vw 0 0 2vw;
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. // .two {
  364. // position: relative;
  365. // flex-grow: 1;
  366. // background-color: var(--f9Color);
  367. // .two_1 {
  368. // background-color: var(--fffColor);
  369. // padding: 2vw;
  370. // display: flex;
  371. // flex-direction: row;
  372. // }
  373. // .two_2 {
  374. // display: flex;
  375. // flex-direction: column;
  376. // .list {
  377. // width: 100vw;
  378. // margin: 2vw 0 0 0;
  379. // background-color: var(--mainColor);
  380. // .list_1 {
  381. // display: flex;
  382. // flex-direction: row;
  383. // justify-content: space-between;
  384. // padding: 2vw;
  385. // .name {
  386. // font-size: var(--font14Size);
  387. // text {
  388. // margin: 0 1vw 0 0;
  389. // }
  390. // }
  391. // .status {
  392. // font-size: var(--font14Size);
  393. // color: var(--ff0Color);
  394. // }
  395. // }
  396. // .list_2 {
  397. // display: flex;
  398. // flex-direction: row;
  399. // justify-content: space-between;
  400. // padding: 2vw;
  401. // background-color: var(--f8Color);
  402. // .image {
  403. // width: 20vw;
  404. // height: 20vw;
  405. // margin: 0 2vw 0 0;
  406. // }
  407. // .other {
  408. // display: flex;
  409. // flex-direction: column;
  410. // flex-grow: 1;
  411. // .name {
  412. // font-size: var(--font14Size);
  413. // font-weight: bold;
  414. // margin: 0 0 2vw 0;
  415. // }
  416. // .other_1 {
  417. // font-size: var(--font12Size);
  418. // color: var(--f85Color);
  419. // }
  420. // }
  421. // .money {
  422. // font-size: var(--font12Size);
  423. // .num {
  424. // text-align: right;
  425. // }
  426. // }
  427. // }
  428. // .list_3 {
  429. // display: flex;
  430. // justify-content: flex-end;
  431. // padding: 2vw;
  432. // border-bottom: 0.5vw solid var(--f9Color);
  433. // font-size: var(--font12Size);
  434. // text {
  435. // margin: 0 1vw;
  436. // }
  437. // }
  438. // .list_4 {
  439. // padding: 2vw;
  440. // text-align: right;
  441. // button {
  442. // margin: 0 1vw 0 2vw;
  443. // }
  444. // }
  445. // }
  446. // }
  447. // }
  448. // }
  449. .scroll-view {
  450. position: absolute;
  451. top: 0;
  452. left: 0;
  453. right: 0;
  454. bottom: 0;
  455. .list-scroll-view {
  456. display: flex;
  457. flex-direction: column;
  458. }
  459. }
  460. </style>