stock.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="StockContainer">
  3. <view class="dataTop" @click="toUrlLink('stock/total')">
  4. <view class="allList">
  5. <view class="all">
  6. <view class="num">
  7. {{ Number(info.hard) + Number(info.simple) + Number(info.old) + Number(info.new_old) + Number(info.youth) }}
  8. </view>
  9. <view class="name">总库存(套)</view>
  10. </view>
  11. <view class="all">
  12. <view class="num">
  13. {{ Number(info.hard) * 149 + Number(info.simple) * 79 + Number(info.old) * 89 + Number(info.new_old) * 47 + Number(info.youth) * 89 }}
  14. </view>
  15. <view class="name">总金额(元)</view>
  16. </view>
  17. </view>
  18. <view class="typeList">
  19. <view class="typeItem">
  20. <view class="num">{{ info.hard || 0 }}</view>
  21. <view class="name">精装版</view>
  22. </view>
  23. <view class="typeItem">
  24. <view class="num">{{ info.simple || 0 }}</view>
  25. <view class="name">简约版</view>
  26. </view>
  27. <view class="typeItem">
  28. <view class="num">{{ info.old || 0 }}</view>
  29. <view class="name">高腰版</view>
  30. </view>
  31. <view class="typeItem">
  32. <view class="num">{{ info.new_old || 0 }}</view>
  33. <view class="name">纯棉版</view>
  34. </view>
  35. <view class="typeItem">
  36. <view class="num">{{ info.youth || 0 }}</view>
  37. <view class="name">青春版</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="control ruku" @click="toUrlLink('stock/ruku_type')">
  42. <view class="left">
  43. <view class="name">入库</view>
  44. <view class="more">
  45. <view>查看详情</view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="control chuku" @click="toUrlLink('stock/chuku')">
  50. <view class="left">
  51. <view class="name">出库</view>
  52. <view class="more">
  53. <view>查看详情</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="control panku" @click="toUrlLink(info.status ? 'stock/first_panku' : 'stock/panku')">
  58. <view class="left">
  59. <view class="name">盘库</view>
  60. <view class="more">
  61. <view>查看详情</view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. myStock
  70. } from "@/apis/stock.js"
  71. export default {
  72. data() {
  73. return {
  74. info: {
  75. hard: 0,
  76. simple: 0,
  77. new_old: 0,
  78. old: 0,
  79. status: true
  80. }
  81. }
  82. },
  83. onShow() {
  84. this.getMyStock()
  85. },
  86. methods: {
  87. // 我的库存
  88. getMyStock() {
  89. uni.showLoading()
  90. myStock().then(res => {
  91. uni.hideLoading()
  92. if (res.code === 200) {
  93. this.info = res.data
  94. } else {
  95. uni.showModal({
  96. content: res.message || '获取我的库存失败',
  97. showCancel: false
  98. })
  99. }
  100. }).catch(() => {
  101. uni.hideLoading()
  102. uni.showModal({
  103. content: '获取我的库存失败',
  104. showCancel: false
  105. })
  106. })
  107. },
  108. toUrlLink(url) {
  109. if (!url) return false
  110. uni.navigateTo({
  111. url: `../${url}`
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. page {
  119. display: flex;
  120. flex-direction: column;
  121. }
  122. .StockContainer {
  123. flex: 1;
  124. width: 100%;
  125. padding: 30rpx;
  126. background-color: #F9F9FB;
  127. .dataTop {
  128. width: 100%;
  129. height: 342rpx;
  130. background-image: url(../../static/new_stock/top.png);
  131. background-position: center;
  132. background-size: cover;
  133. padding: 24rpx;
  134. box-sizing: border-box;
  135. display: flex;
  136. align-items: center;
  137. justify-content: space-between;
  138. flex-direction: column;
  139. margin-bottom: 30rpx;
  140. border-radius: 24rpx;
  141. .num {
  142. font-size: 40rpx;
  143. color: #FFFFFF;
  144. line-height: 56rpx;
  145. margin-bottom: 6rpx;
  146. text-align: center;
  147. }
  148. .name {
  149. color: #FFFFFF;
  150. font-size: 28rpx;
  151. line-height: 40rpx;
  152. text-align: center;
  153. }
  154. .allList {
  155. width: 100%;
  156. display: flex;
  157. align-items: center;
  158. justify-content: space-between;
  159. .all {
  160. flex: 1;
  161. overflow: hidden;
  162. display: flex;
  163. flex-direction: column;
  164. align-items: center;
  165. }
  166. }
  167. .all .num {
  168. font-size: 60rpx !important;
  169. line-height: 84rpx !important;
  170. }
  171. .typeList {
  172. width: 100%;
  173. display: flex;
  174. align-items: center;
  175. justify-content: space-between;
  176. margin-bottom: 28rpx;
  177. .typeItem {
  178. width: 25%;
  179. }
  180. }
  181. }
  182. .control {
  183. width: 100%;
  184. height: 300rpx;
  185. border-radius: 24rpx;
  186. background-size: 100% auto !important;
  187. background-position: bottom !important;
  188. background-repeat: no-repeat !important;
  189. padding: 68rpx 62rpx;
  190. box-sizing: border-box;
  191. margin-bottom: 30rpx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. &::after {
  196. content: "";
  197. display: block;
  198. width: 142rpx;
  199. height: 142rpx;
  200. background-position: center;
  201. background-size: 100% auto;
  202. background-repeat: no-repeat;
  203. }
  204. &.ruku {
  205. background: url(../../static/new_stock/control.png), linear-gradient(to bottom, #FB6FAC 0%, #FFAACF 100%);
  206. &::after {
  207. background-image: url(../../static/new_stock/ruku.png);
  208. }
  209. .more {
  210. color: #FF58A0;
  211. &::after {
  212. border-left-color: #FF58A0;
  213. }
  214. }
  215. }
  216. &.chuku {
  217. background: url(../../static/new_stock/control.png), linear-gradient(to bottom, #FFD063 0%, #FBB92F 100%);
  218. &::after {
  219. background-image: url(../../static/new_stock/chuku.png);
  220. }
  221. .more {
  222. color: #ECA103;
  223. &::after {
  224. border-left-color: #ECA103;
  225. }
  226. }
  227. }
  228. &.panku {
  229. background: url(../../static/new_stock/control.png), linear-gradient(to bottom, #FA924F 0%, #FF7B39 100%);
  230. &::after {
  231. background-image: url(../../static/new_stock/panku.png);
  232. }
  233. .more {
  234. color: #FF6619;
  235. &::after {
  236. border-left-color: #FF6619;
  237. }
  238. }
  239. }
  240. .name {
  241. color: #FFFFFF;
  242. font-size: 56rpx;
  243. line-height: 80rpx;
  244. margin-bottom: 20rpx;
  245. }
  246. .more {
  247. width: 200rpx;
  248. height: 60rpx;
  249. border-radius: 60rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. background-color: #ffffff;
  254. font-size: 28rpx;
  255. line-height: 40rpx;
  256. &::after {
  257. content: "";
  258. display: block;
  259. width: 0;
  260. height: 0;
  261. border: 10rpx solid transparent;
  262. border-left-width: 16rpx;
  263. margin-left: 10rpx;
  264. }
  265. }
  266. }
  267. }
  268. </style>