earnings.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <image class="bg" src="https://zhibo.liuniu946.com/img/earnings_bg.png" mode="scaleToFill"></image>
  5. <view class="shop-class">{{store_level == 1 ? '免费网店' : store_level == 2 ? '创业网店' : store_level == 3 ? '创业播主网店' : '播主店铺'}}</view>
  6. <view class="price">¥<text>{{ store_earnings || 0}}</text></view>
  7. <view class="text" @click="navto()">{{ store_name}} ></view>
  8. </view>
  9. <scroll-view scroll-y="true" >
  10. <!-- <empty v-if="List.length === 0"></empty> -->
  11. <template>
  12. <view class="item flex" v-for="(item,index) in List" :key="index">
  13. <view class="user flex">
  14. <view class="user_name flex">
  15. <view class="img"><image :src="item.avatar" mode="aspectFill"></image></view>
  16. <view class="name">{{ item.nickname }}</view>
  17. </view>
  18. <view class="type-item">
  19. {{ item.status_name }}
  20. </view>
  21. </view>
  22. <view class="order flex">
  23. <view class="order-left">
  24. <view class="order-bg"><image :src="item._info[0].cart_info.productInfo.image" mode="aspectFill"></image></view>
  25. <view class="order-text">
  26. <view class="order-name">{{ item._info[0].cart_info.productInfo.store_name }}</view>
  27. <view class="order-id">订单编号:{{ item.order_id}}</view>
  28. <view class="order-pifaPrice">原价:¥{{ item._info[0].cart_info.productInfo.ot_price}}</view>
  29. </view>
  30. </view>
  31. <view class="order-right">
  32. <view class="order-price">¥{{ item._info[0].cart_info.productInfo.price }}</view>
  33. <view class="number">x{{ item.total_num }}</view>
  34. <view class="order-relPrice">实付¥{{ item.pay_price }}</view>
  35. </view>
  36. </view>
  37. <view class="buttom flex">
  38. <view class="xiadanTime">下单时间:{{ item.add_time }}</view>
  39. <view v-if="item.status == 2 || item.status == 3" class="earning">收益:<text class="txt">¥{{ item.bill_info.number || '0'}} </text></view>
  40. <view v-else class="earning">预计收益:<text class="txt">¥{{ item.bill_info.number || '0'}}</text></view>
  41. </view>
  42. </view>
  43. </template>
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. import { userinfo } from '@/api/user.js';
  49. import { mapState, mapMutations } from 'vuex';
  50. import { getStoreInfo } from '@/api/anchor.js';
  51. import { getEarnings } from '@/api/order.js';
  52. import empty from '@/components/empty';
  53. export default {
  54. components: {
  55. empty,
  56. },
  57. data() {
  58. return {
  59. store_level: '',
  60. store_earnings: '',
  61. store_name: '',
  62. page: 1,
  63. limit: 10,
  64. loadingType: 'More',
  65. List: []
  66. }
  67. },
  68. computed: {
  69. ...mapState(['userInfo']),
  70. //计算总收益
  71. addPrice() {
  72. }
  73. },
  74. onLoad() {
  75. this.loadData();
  76. },
  77. methods: {
  78. async loadData(type = 'add',loading) {
  79. let obj = this;
  80. let data = {
  81. page: obj.page,
  82. limit: obj.limit,
  83. };
  84. if (type === 'add') {
  85. if (obj.loadingType === 'nomore') {
  86. return;
  87. }
  88. obj.loadingType = 'loading';
  89. } else {
  90. obj.loadingType = 'more';
  91. }
  92. if (type === 'refresh') {
  93. // 清空数组
  94. obj.page = 1;
  95. }
  96. getEarnings(data)
  97. .then(({ data }) => {
  98. console.log('-----',data.data);
  99. data.data.forEach((sj,index) => {
  100. obj.List.push(sj);
  101. })
  102. if (obj.limit == data.length) {
  103. obj.page++;
  104. obj.loadingType = 'more';
  105. } else {
  106. obj.loadingType = 'nomore';
  107. }
  108. if (type === 'refresh') {
  109. if (loading == 1) {
  110. uni.hideLoading();
  111. } else {
  112. uni.stopPullDownRefresh();
  113. }
  114. }
  115. })
  116. .catch(err => {
  117. console.log(err);
  118. });
  119. userinfo({}).then(({ data }) => {
  120. obj.store_level = data.store_info.type;
  121. obj.store_earnings = data.store_info.brokerage_price;
  122. obj.store_id = data.store_info.id;
  123. getStoreInfo({},this.store_id).then(({ data }) =>{
  124. obj.store_name = data.name
  125. })
  126. }).catch((e) => {
  127. console.log(e);
  128. });
  129. },
  130. navto(){
  131. uni.switchTab({
  132. url: '/pages/shop/shop'
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. page {
  140. height: 100%;
  141. background: #F1F1F1;
  142. margin: 0;
  143. }
  144. .top {
  145. height: 300rpx;
  146. overflow: hidden;
  147. display: flex;
  148. flex-direction: column;
  149. position: relative;
  150. .bg {
  151. position: absolute;
  152. top: 0;
  153. right: 0;
  154. width: 100%;
  155. height: 100%;
  156. }
  157. .shop-class {
  158. position: absolute;
  159. right: 0;
  160. top: 34rpx;
  161. width: 173rpx;
  162. height: 48rpx;
  163. background: #FFDAD2;
  164. border-radius: 23rpx 0rpx 0rpx 23rpx;
  165. font-size: 24rpx;
  166. line-height: 48rpx;
  167. text-align: center;
  168. font-family: PingFang SC;
  169. color: #FF0000;
  170. z-index: 1;
  171. }
  172. .price{
  173. z-index: 1;
  174. width: 100%;
  175. text-align: center;
  176. margin-top: 100rpx;
  177. font-family: PingFang SC;
  178. font-weight: bold;
  179. color: #FFFFFF;
  180. font-size: 47rpx;
  181. text {
  182. font-size: 72rpx;
  183. }
  184. }
  185. .text{
  186. z-index: 1;
  187. width: 100%;
  188. text-align: center;
  189. font-size: 24rpx;
  190. font-family: PingFang SC;
  191. font-weight: 500;
  192. color: #FFFEFF;
  193. }
  194. }
  195. .item {
  196. flex-direction: column;
  197. background: #FFFFFF;
  198. height: 336rpx;
  199. width: 95%;
  200. border-radius: 10rpx;
  201. margin: 0 auto;
  202. margin-top: 15rpx;
  203. margin-bottom: 15rpx;
  204. .user {
  205. width: 100%;
  206. justify-content: space-between;
  207. padding: 20rpx 30rpx 0rpx 27rpx;
  208. .user_name{
  209. width: 100%;
  210. .img {
  211. width: 64rpx;
  212. height: 64rpx;
  213. background: #ffaa7f;
  214. border-radius: 50%;
  215. flex-shrink: 0;
  216. image {
  217. width: 64rpx;
  218. height: 64rpx;
  219. border-radius: 50%;
  220. }
  221. }
  222. .name{
  223. margin-left: 15rpx;
  224. width: 100%;
  225. font-size: 26rpx;
  226. font-family: PingFang SC;
  227. font-weight: 500;
  228. color: #666666;
  229. }
  230. }
  231. .type-item {
  232. text-align: right;
  233. width: 20%;
  234. font-size: 28rpx;
  235. font-family: PingFang SC;
  236. font-weight: 500;
  237. color: #999999;
  238. }
  239. }
  240. .order {
  241. width: 100%;
  242. justify-content: space-between;
  243. padding: 0 31rpx 0rpx 27rpx;
  244. .order-left {
  245. width: 100%;
  246. display: flex;
  247. .order-bg {
  248. width: 134rpx;
  249. height: 150rpx;
  250. image {
  251. width: 134rpx;
  252. height: 150rpx;
  253. }
  254. }
  255. .order-text{
  256. padding-left: 18rpx;
  257. .order-name {
  258. text-overflow: ellipsis;
  259. overflow: hidden;
  260. white-space: nowrap;
  261. width:340rpx;
  262. font-size: 32rpx;
  263. font-family: PingFang SC;
  264. font-weight: bold;
  265. color: #333333;
  266. }
  267. .order-id {
  268. text-overflow: ellipsis;
  269. overflow: hidden;
  270. white-space: nowrap;
  271. width:340rpx;
  272. // width: 100%;
  273. margin-top: 19rpx;
  274. font-size: 1rpx;
  275. font-family: PingFang SC;
  276. font-weight: 500;
  277. color: #999999;
  278. }
  279. .order-pifaPrice {
  280. margin-top: 24rpx;
  281. font-size: 24rpx;
  282. font-family: PingFang SC;
  283. font-weight: 500;
  284. color: #999999;
  285. }
  286. }
  287. }
  288. .order-right {
  289. width: 30%;
  290. text-align: right;
  291. .order-prive {
  292. font-size: 26rpx;
  293. font-family: PingFang SC;
  294. font-weight: 500;
  295. color: #282828;
  296. }
  297. .number {
  298. color: #99A1AA;
  299. }
  300. .order-relPrice {
  301. margin-top: 40rpx;
  302. font-size: 26rpx;
  303. font-family: PingFang SC;
  304. font-weight: 500;
  305. color: #FF9090;
  306. }
  307. }
  308. }
  309. .buttom {
  310. width: 100%;
  311. justify-content: space-between;
  312. padding: 0 32rpx 26rpx 25rpx;
  313. .xiadanTime {
  314. font-size: 24rpx;
  315. font-family: PingFang SC;
  316. font-weight: 500;
  317. color: #999999;
  318. }
  319. .earning {
  320. font-size: 28rpx;
  321. font-family: PingFang SC;
  322. font-weight: 500;
  323. color: #333333;
  324. .txt {
  325. color: #FF0000;
  326. }
  327. }
  328. }
  329. }
  330. </style>