123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <view class="PanKuContainer">
- <view class="all">
- <view class="num">
- 库存:总共
- <text class="spec">
- {{ infoList.reduce((a, b) => a + Number(b.total), 0) }}
- </text>
- 套
- </view>
- </view>
- <view
- class="goodList"
- >
- <view
- v-for="(item, i) in infoList"
- :key="i"
- class="goodItem"
- >
- <view class="top">
- <view
- class="avatar"
- :style="{ backgroundImage: `url(${item.imgurl})` }"
- />
- <view class="info">
- <view class="name">{{ item.name }}</view>
- <view class="fixed">一年零一天不满意退钱</view>
- </view>
- </view>
- <view class="skuContainer">
- <view
- class="header"
- :class="item.toggle ? 'open' : ''"
- @click="item.toggle = !item.toggle"
- >
- <view class="icon"></view>
- <view class="name">{{ item.attr }}</view>
- </view>
- <view v-if="item.toggle" class="skuList">
- <view class="skuHeader">
- <view class="type">规格</view>
- <view class="size">尺码</view>
- <view class="num">数量</view>
- </view>
- <view
- v-for="(btem, bi) in item.spec"
- :key="bi"
- class="skuItem"
- >
- <view class="type">{{ btem.sex ? '男款' : '女款' }}</view>
- <view class="size">{{ btem.size }}</view>
- <view class="num">{{ btem.num }}</view>
- </view>
- </view>
- <view class="dataAll">
- <view class="sex">
- 男款:{{ item.men }}套
- /
- 女款:{{ item.women }}套
- </view>
- <view class="num">
- 合计:<text class="spec">{{ item.total }}套</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { allStock } from "@/apis/stock.js"
- export default {
- data() {
- return {
- infoList: []
- }
- },
- onLoad() {
- let _this = this
- uni.showLoading()
- allStock().then(res => {
- uni.hideLoading()
- if (res.code === 200) {
- Object.keys(res.data).forEach(k => {
- if(res.data[k].spec.length > 0) {
- res.data[k].toggle = false
- res.data[k].attr = _this.changeKey(k)
- res.data[k].men = res.data[k].spec.filter(({ sex }) => sex).reduce((a, b) => a + Number(b.num), 0)
- res.data[k].women = res.data[k].spec.filter(({ sex }) => !sex).reduce((a, b) => a + Number(b.num), 0)
- res.data[k].total = res.data[k].spec.reduce((a, b) => a + Number(b.num), 0)
- _this.infoList.push(res.data[k])
- }
- })
- } else {
- uni.showModal({
- content: res.message || "获取详情失败",
- showCancel: false
- })
- }
- }).catch(() => {
- uni.hideLoading()
- uni.showModal({
- content: "获取详情失败",
- showCancel: false
- })
- })
- },
- methods: {
- changeKey(k) {
- let out = ''
- switch(k) {
- case 'hard':
- out = '精装版'
- break;
- case 'new_old':
- out = '纯棉版'
- break;
- case 'old':
- out = '高腰版'
- break;
- case 'simple':
- out = '简约版'
- break;
- case 'youth':
- out = '青春版'
- break;
- default:
- out = '简约版'
- break
- }
- return out
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- display: flex;
- flex-direction: column;
- }
- .PanKuContainer {
- width: 100%;
- flex: 1;
- background-color: #F9F9FB;
- padding: 30rpx;
- .btn {
- width: 140rpx;
- height: 56rpx;
- border-radius: 8rpx;
- background-color: #EA4A41;
- color: #FFFFFF;
- font-size: 28rpx;
- line-height: 56rpx;
- text-align: center;
- text-align: center;
- }
- .all {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 30rpx;
- .num {
- color: #333333;
- font-size: 36rpx;
- line-height: 50rpx;
- font-weight: bold;
- .spec {
- color: #EA4A41 !important;
- }
- }
- }
- .reviseBtn {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- height: 100rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #FFFFFF;
- color: #FFFFFF;
- font-size: 32rpx;
- padding: 0 30rpx;
- .type {
- color: #999999;
- font-size: 28rpx;
- margin-right: 10rpx;
- }
- .all {
- color: #333333;
- font-size: 28rpx;
- }
- .num {
- font-size: 40rpx;
- color: #EA4A41;
- }
- .unit {
- font-size: 28rpx;
- color: #EA4A41;
- }
- .submitBtn {
- width: 192rpx;
- height: 68rpx;
- line-height: 68rpx;
- text-align: center;
- border-radius: 68rpx;
- background: linear-gradient(to right, #F97C55, #F44545);
- color: #FFFFFF;
- font-size: 28rpx;
- }
- }
- .goodList {
- width: 100%;
- .goodItem {
- width: 100%;
- margin-bottom: 30rpx;
- box-sizing: border-box;
- .top {
- width: 100%;
- display: flex;
- align-items: stretch;
- justify-content: space-between;
- margin-bottom: 40rpx;
- .avatar {
- width: 180rpx;
- height: 144rpx;
- background-color: #eeeeee;
- background-position: center;
- background-size: cover;
- background-repeat: no-repeat;
- border-radius: 8rpx;
- }
- .info {
- display: flex;
- justify-content: center;
- flex-direction: column;
- flex: 1;
- overflow: hidden;
- margin-left: 20rpx;
- .name {
- color: #333333;
- font-size: 32rpx;
- line-height: 44rpx;
- margin-bottom: 20rpx;
- }
- .fixed {
- color: #F76454;
- font-size: 28rpx;
- height: 40rpx;
- line-height: 40rpx;
- border: 1px solid #F76454;
- box-sizing: border-box;
- width: 328rpx;
- border-radius: 40rpx;
- color: #F76454;
- text-align: center;
- }
- }
- }
- .skuContainer {
- width: 100%;
- background-color: #ffffff;
- box-sizing: border-box;
- border-radius: 24rpx;
- overflow: hidden;
- .header {
- width: 100%;
- height: 104rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- border-bottom: 1px solid #EEEEEE;
- .icon {
- width: 30rpx;
- height: 30rpx;
- border-radius: 50%;
- background-color: rgba(234, 74, 65, 0.36);
- margin-right: 10rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- &::before {
- content: "";
- display: block;
- width: 18rpx;
- height: 18rpx;
- border-radius: 50%;
- background-color: #EA4A41;
- }
- }
- .name {
- color: #333333;
- font-size: 32rpx;
- line-height: 44rpx;
- }
- &::after {
- display: block;
- content: "";
- margin-left: auto;
- width: 30rpx;
- height: 30rpx;
- background-image: url(../../static/new_my/arrow.png);
- background-position: center;
- background-size: cover;
- background-repeat: no-repeat;
- }
- &.open {
- &::after {
- transform: rotate(90deg) !important;
- }
- }
- }
- .skuList{
- width: 100%;
- .skuHeader, .skuItem {
- width: 100%;
- height: 100rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #EEEEEE;
- .type, .size, .num {
- flex: 1;
- overflow: hidden;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .type {
- justify-content: flex-start;
- }
- .size{
- justify-content: center;
- }
- .num {
- justify-content: flex-end;
- }
- }
- .skuHeader {
- color: #999999;
- font-size: 28rpx;
- line-height: 40rpx;
- }
- }
- .dataAll {
- width: 100%;
- height: 116rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .sex {
- color: #333333;
- font-size: 28rpx;
- }
- .num {
- color: #999999;
- font-size: 28rpx;
- .spec {
- color: #EA4A41 !important;
- font-size: 40rpx !important;
- font-weight: bolder;
- }
- }
- }
- }
- }
- }
- }
- </style>
|