order.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view >
  3. <view class="container">
  4. <!-- 空白页 -->
  5. <empty v-if="cartList.length < 1"></empty>
  6. <view class="header flex1" v-if="cartList.length >= 1">
  7. <view class="header-1">累计推广<text>{{cartList.length}}</text>件商品</view>
  8. </view>
  9. <scroll-view v-if="cartList.length >= 1">
  10. <!-- 列表 -->
  11. <view class="cart-list" v-for="(item, index) in cartList" :key="index">
  12. <view class="header-select flex1" @click="check('all')">
  13. <view class="flex-upDown-center">
  14. <view><image :src="item.avatar"></image></view>
  15. <view class="word-1">{{item.nickname}}</view>
  16. </view>
  17. </view>
  18. <view class="cart" >
  19. <scroll-view v-if="item.cart_info.length > 1" class="goods-box" scroll-x>
  20. <view v-for="(goodsItem, goodsIndex) in item.cart_info" :key="goodsIndex" class="goods-item">
  21. <image class="goods-img" :src="goodsItem.productInfo.image" mode="scaleToFill"></image>
  22. </view>
  23. </scroll-view>
  24. <view v-if="item.cart_info.length == 1" class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.cart_info" :key="goodsIndex">
  25. <image class="goods-img" :src="goodsItem.productInfo.image" mode="scaleToFill"></image>
  26. <view class="right">
  27. <view class="flex1">
  28. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  29. <text class="price">{{ item.pay_price|moneyNum }}</text>
  30. </view>
  31. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x {{ goodsItem.cart_num }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- <view class="time">一级订单:2019545845554548</view> -->
  36. <view class="time">下单时间:{{item.time}}</view>
  37. <view class="money" v-if="item.type == 'brokerage'">返佣:{{item.number}}</view>
  38. <view class="money" v-if="item.type == 'pay_money'">支付金额:{{item.number}}</view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import { recommen } from '@/api/order.js';
  46. import { mapState } from 'vuex';
  47. import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue'
  48. import uniSwipeActionItem from '@/components/uni-swipe-action-item/uni-swipe-action-item.vue'
  49. import empty from '@/components/empty';
  50. export default {
  51. components: {
  52. uniSwipeAction,
  53. uniSwipeActionItem,
  54. empty
  55. },
  56. data() {
  57. return {
  58. page: 1,
  59. limit: 10,
  60. ischeck:false,//
  61. total: 0, //总价格
  62. allChecked: false, //全选状态 true|false
  63. empty: false, //空白页现实 true|false
  64. cartList: [],
  65. options:[
  66. {
  67. text: '删除',
  68. style: {
  69. backgroundColor: '#FC4141'
  70. }
  71. }
  72. ]
  73. };
  74. },
  75. onShow() {
  76. // 只有登录时才加载数据
  77. if (this.hasLogin) {
  78. this.loadData();
  79. }
  80. console.log(this.empty,102)
  81. },
  82. // watch: {
  83. // //显示空白页
  84. // cartList(e) {
  85. // let empty = e.length === 0 ? true : false;
  86. // if (this.empty !== empty) {
  87. // this.empty = empty;
  88. // }
  89. // }
  90. // },
  91. computed: {
  92. ...mapState(['hasLogin'])
  93. },
  94. methods: {
  95. //请求数据
  96. loadData() {
  97. let that = this;
  98. let page = that.page;
  99. let limit = that.limit;
  100. // let data = {
  101. // page: page,
  102. // limit: limit
  103. // };
  104. recommen({}).then(({data}) => {
  105. that.cartList = data.list[0].child;
  106. console.log(that.cartList.length,'that.cartList')
  107. });
  108. },
  109. }
  110. };
  111. </script>
  112. <style lang="scss">
  113. page {
  114. min-height: 100%;
  115. }
  116. .container {
  117. padding-bottom: 134rpx;
  118. background-color: $page-color-base;
  119. height: 100%;
  120. position: relative;
  121. line-height: 1;
  122. /* 空白页 */
  123. .empty {
  124. position: fixed;
  125. left: 0;
  126. top: 0;
  127. width: 100%;
  128. height: 100vh;
  129. padding-bottom: 100rpx;
  130. display: flex;
  131. justify-content: center;
  132. flex-direction: column;
  133. align-items: center;
  134. background: #fff;
  135. .emptyImg {
  136. width: 300rpx;
  137. height: 250rpx;
  138. margin-bottom: 30rpx;
  139. }
  140. .empty-tips {
  141. display: flex;
  142. font-size: $font-sm + 2rpx;
  143. color: $font-color-disabled;
  144. .navigator {
  145. color: $uni-color-primary;
  146. margin-left: 16rpx;
  147. }
  148. }
  149. }
  150. .header{
  151. padding: 30rpx 33rpx;
  152. background:#FFFFFF;
  153. .header-1{
  154. font-size:28rpx;
  155. font-weight:600;
  156. color:#222222;
  157. text{
  158. color:#FC4141;
  159. }
  160. }
  161. .header-2{
  162. font-size:28rpx;
  163. font-weight:400;
  164. color:#333333;
  165. }
  166. }
  167. /* 列表 */
  168. .cart-list{
  169. padding: 25rpx 33rpx;
  170. background-color: #FFFFFF;
  171. margin:20rpx 25rpx 0 25rpx;
  172. border-radius: 10rpx;
  173. .header-select {
  174. padding-top: 20rpx;
  175. width: 100%;
  176. background-color: #FFFFFF;
  177. image{
  178. width: 65rpx;
  179. height: 65rpx;
  180. border-radius: 50%;
  181. margin-right: 25rpx;
  182. }
  183. text{
  184. font-size:28rpx;
  185. font-weight:400;
  186. color:#fd5b23;
  187. }
  188. .checked-img{
  189. font-size: 28rpx;
  190. margin-right: 10rpx;
  191. color: $font-color-disabled;
  192. }
  193. .checked-img.checked {
  194. color: $background-color;
  195. }
  196. .word-1{
  197. font-size:26rpx;
  198. font-weight:600;
  199. color:#222222;
  200. }
  201. .word-1{
  202. font-size:30rpx;
  203. font-weight:400;
  204. color:#1d2023;
  205. }
  206. }
  207. .cart{
  208. width: 100%;
  209. background-color: #FFFFFF;
  210. padding-top: 20rpx;
  211. /* 多条商品 */
  212. .goods-box {
  213. height: 160rpx;
  214. padding: 20rpx 0;
  215. white-space: nowrap;
  216. .goods-item {
  217. width: 120rpx;
  218. height: 120rpx;
  219. display: inline-block;
  220. margin-right: 24rpx;
  221. }
  222. .goods-img {
  223. display: block;
  224. width: 120rpx;
  225. height: 120rpx;
  226. }
  227. }
  228. /* 单条商品 */
  229. .goods-box-single {
  230. display: flex;
  231. padding: 20rpx 0;
  232. .goods-img {
  233. display: block;
  234. width: 120rpx;
  235. height: 120rpx;
  236. }
  237. .right {
  238. flex: 1;
  239. display: flex;
  240. flex-direction: column;
  241. padding: 0 0rpx 0 24rpx;
  242. overflow: hidden;
  243. .title {
  244. font-size: $font-base + 2rpx;
  245. color: $font-color-dark;
  246. line-height: 1;
  247. width: 80%;
  248. }
  249. .attr-box {
  250. display: flex;
  251. justify-content: flex-end;
  252. font-size: $font-sm + 2rpx;
  253. color: $font-color-light;
  254. }
  255. .price {
  256. display: inline;
  257. font-size: $font-base + 2rpx;
  258. color: $font-color-dark;
  259. &:before {
  260. content: '¥';
  261. font-size: $font-sm;
  262. }
  263. }
  264. }
  265. }
  266. }
  267. .time{
  268. font-size:24rpx;
  269. font-weight:400;
  270. color:#999999;
  271. padding-bottom: 20rpx;
  272. &:nth-last-of-type(2)
  273. {
  274. border-bottom: 1px solid #F0F0F0;
  275. }
  276. }
  277. .money{
  278. font-size:28rpx;
  279. font-weight:500;
  280. color:#1d2023;
  281. margin-top: 30rpx;
  282. text-align: right;
  283. }
  284. }
  285. /* 底部栏 */
  286. .action-section {
  287. width: 100%;
  288. background:#ffffff;
  289. box-shadow:0px -3px 7px 0px #e6e6e6;
  290. padding:21rpx 36rpx;
  291. display: flex;
  292. justify-content:space-between;
  293. position: fixed;
  294. bottom: 50px;
  295. .checkbox {
  296. display: flex;
  297. justify-content:space-between;
  298. align-items: center;
  299. .checked-img{
  300. font-size: 28rpx;
  301. margin-right: 10rpx;
  302. color: $font-color-disabled;
  303. }
  304. .checked-img.checked {
  305. color: $background-color;
  306. }
  307. .checked-word{
  308. font-size:30rpx;
  309. font-weight:400;
  310. color:#1d2023;
  311. }
  312. }
  313. .total-box {
  314. display: flex;
  315. justify-content:space-between;
  316. .word {
  317. font-size:26rpx;
  318. font-weight:500;
  319. color:#333333;
  320. margin-right: 16rpx;
  321. }
  322. .price {
  323. font-size:26rpx;
  324. font-weight:550;
  325. color:#FA2740;
  326. margin-right: 34rpx;
  327. }
  328. .confirm-btn{
  329. width:160rpx;
  330. height:64rpx;
  331. background:$base-color;
  332. border-radius:32rpx;
  333. display: flex;
  334. justify-content:center;
  335. align-items: center;
  336. }
  337. }
  338. }
  339. }
  340. </style>