123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540 |
- <template>
- <view class="container all-type-list-wrapper">
- <immediately-list
- ref="productList"
- :search-status="true"
- @operationConfim="hanldOperationConfim"
- @alertjietiConfim="hanldalertjietiConfim"
- @goCartPage="hanldToCartPage"
- :tabBars="tabBars"
- :tabIndex="tabIndex"
- @changetab="hanldChangeTab"
- />
- <!-- 单品规格弹窗 -->
- <cm-unit-popup
- v-if="popupShow"
- :popupShow="popupShow"
- :skuProduct="handleData"
- @skuClick="handleSkuClick"
- />
- <!-- 组合加入购物车 -->
- <view class="popup spec zuhe" :class="specClasszuhe" @touchmove.stop.prevent="discard" @tap="hideSpecs">
- <!-- 遮罩层 -->
- <view class="mask"></view>
- <view
- class="layer"
- @tap.stop="discard"
- :style="{ paddingBottom: isIphoneX ? '68rpx' : '36rpx', bottom: isIphoneX ? '-290rpx' : '-270rpx' }"
- >
- <view class="content zuhe-content">
- <view class="number-left">
- <text>种类:{{ productKind }}</text> <text>数量:{{ productTotalNum }}</text>
- </view>
- <view class="number-right">
- <view class="text">
- 总额:<text class="number-right-text">¥{{ productTotalAmount | NumFormat }}</text>
- </view>
- </view>
- </view>
- <view class="btn"> <view class="button add" @click="handlSupporAddCart">确定</view> </view>
- </view>
- </view>
- <!-- -->
- <view class="popup spec zuhe" :class="specClassjieti" @touchmove.stop.prevent="discard">
- <view class="mask"></view>
- <view class="jieti_box " @tap.stop="discard">
- <view class="jieti_box_one">
- <view class="jieti_left">
- <view>起订量</view>
- <view class="ladder-a" v-for="(item, index) in ladderPriceList" :key="index">
- {{ item.buyNumRangeShow }}
- </view>
- </view>
- <view class="jieti_right">
- <view>价格</view>
- <view class="" v-for="(item, index) in ladderPriceList" :key="index"
- >¥ {{ item.buyPrice | NumFormat }}</view
- >
- </view>
- </view>
- <view class="addbtn" @tap="hideSpecjieti">知道了</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import immediatelyList from './components/immediatelyList'
- import cmUnitPopup from './components/cm-unit-popup'
- export default {
- components: {
- immediatelyList,
- cmUnitPopup
- },
- data() {
- return {
- popupShow: false,
- clubId: '', //机构ID
- serviceProviderId: '', //协销ID
- serverUrl: '',
- emptyText: '',
- lastPageType: '',
- lastPageVal: '',
- isIphoneX: this.$store.state.isIphoneX,
- specClass: '', //规格弹窗css类,控制开关动画
- specClasszuhe: '', //组合加购物车弹窗
- specClassjieti: '', //阶梯展示弹窗
- ladderPriceList: {},
- handleData: {},
- isQuantity: false,
- isStock: false,
- minBuyNumber: 0,
- number: 0,
- buyRetailPrice: 0,
- hanldChangeTabIndex: 0,
- handleDataLadderPriceList: [],
- productKind: 0,
- productTotalNum: 0,
- productTotalAmount: 0,
- buyNumRangeShow: '', //起订量范围
- buyPrice: '', //起订量范围价格
- buyRetailPriceStep: 1,
- supporAddParams: {
- clubId: 0,
- serviceProviderId: 0,
- productInfo: '',
- type: 2
- }
- }
- },
- onLoad() {},
- filters: {
- NumFormat(value) {
- //处理金额
- return Number(value).toFixed(2)
- }
- },
- methods: {
- async initData(data) {
- const clubInfo = await this.$api.getComStorage('orderUserInfo')
- const userInfo = await this.$api.getStorage()
- this.clubId = this.supporAddParams.clubId = clubInfo.clubId ? clubInfo.clubId : 0
- this.serviceProviderId = this.supporAddParams.serviceProviderId = userInfo.serviceProviderId
- this.getClubProductNum()
- },
- handleSkuClick(sku) {
- // this.handleData.price = sku.price
- },
- getClubProductNum() {
- // 获取协销下机构购物车数量
- this.SellerService.GetSellerProductNum({
- clubId: this.clubId,
- serviceProviderId: this.serviceProviderId
- }).then(response => {
- this.$refs.productList.cartQuantity = response.data
- })
- },
- hanldChangeTab(index) {
- if (index == 1) {
- this.$refs.productList.getcombinationProduct()
- }
- },
- hanldalertjietiConfim(data) {
- this.ladderPriceList = data.ladderPriceList
- this.specClassjieti = 'show'
- },
- hanldOperationConfim(data) {
- //显示选择数量确认弹窗
- this.handleData = data
- console.log(this.handleData)
- if (this.$refs.productList.tabIndex == 1) {
- if (data.productKind == 0) {
- this.$util.msg(`请至少选购一种商品`, 2000)
- } else {
- this.specClasszuhe = 'show'
- this.productKind = data.productKind
- this.productTotalNum = data.productTotalNum
- this.productTotalAmount = data.productTotalAmount
- }
- } else {
- this.popupShow = true
- }
- },
- hideSpecs() {
- this.specClasszuhe = 'hide'
- setTimeout(() => {
- this.specClasszuhe = 'none'
- }, 200)
- },
- hideSpecjieti() {
- this.specClassjieti = 'hide'
- setTimeout(() => {
- this.specClassjieti = 'none'
- }, 200)
- },
- handlSupporAddCart() {
- //组合商品加入购物车
- let productInfo = []
- this.handleData.combinationProductList.forEach(pros => {
- if (pros.initProductNum > 0) {
- productInfo.push({ skuId: pros.skuId, count: pros.initProductNum })
- }
- })
- this.supporAddParams.productInfo = JSON.stringify(productInfo)
- this.handleCartBatchAddCart(this.supporAddParams)
- },
- handleCartBatchAddCart(params) {
- this.SellerService.ShoppingCartBatchAddCart(params)
- .then(response => {
- this.specClasszuhe = 'hide'
- this.$util.msg('加入购物车成功', 1500, true, 'success')
- this.getClubProductNum()
- this.clearProduct() //清空
- setTimeout(() => {
- this.specClasszuhe = 'none'
- }, 200)
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- clearProduct() {
- //成功加入购物车后清空所选值
- this.handleData.productKind = 0
- this.handleData.productTotalNum = 0
- this.handleData.productTotalAmount = 0
- this.handleData.combinationProductList.forEach(pros => {
- pros.initProductNum = 0
- })
- },
- hanldToCartPage() {
- this.$api.navigateTo('/pages/seller/cart/cart')
- },
- discard() {
- //丢弃
- }
- },
- onShow() {
- this.initData()
- }
- }
- </script>
- <style lang="scss">
- // 阶梯价格弹窗
- .jieti_box {
- width: 596rpx;
- // height: 496rpx;
- top: 10%;
- right: 50%;
- transform: translate(50%, 50%);
- position: absolute;
- background: #ffffff;
- color: #000;
- font-size: 28rpx;
- border-radius: 10rpx;
- text-align: center;
- line-height: 84rpx;
- padding: 20rpx;
- z-index: 99999;
- }
- .jieti_box_one {
- // width: 548rpx;
- overflow: hidden;
- border: 2rpx solid #f5f5f5;
- border-bottom: 0;
- margin: auto;
- }
- .jieti_left {
- width: 298rpx;
- float: left;
- }
- .jieti_left view {
- height: 84rpx;
- border-bottom: 2rpx solid #f5f5f5;
- border-right: 2rpx solid #f5f5f5;
- }
- .ladder-a {
- letter-spacing: 4rpx;
- }
- .jieti_right {
- width: 294rpx;
- float: right;
- }
- .jieti_right view {
- height: 84rpx;
- border-bottom: 2rpx solid #f5f5f5;
- }
- .addbtn {
- height: 84rpx;
- background: linear-gradient(135deg, rgba(242, 143, 49, 1) 0%, rgba(225, 86, 22, 1) 100%);
- text-align: center;
- font-size: 28rpx;
- color: #fff;
- line-height: 84rpx;
- border-radius: 42rpx;
- margin: 20rpx auto;
- }
- .zuhe-content {
- display: inline-block;
- }
- .number-left {
- float: left;
- }
- .number-right {
- margin-left: 30rpx;
- float: left;
- }
- .number-left text {
- margin-left: 30rpx;
- }
- .number-right-text {
- color: #ff2a2a;
- }
- page {
- background: $sub-bg-color;
- .all-type-list-wrapper {
- display: flex;
- flex-direction: column;
- }
- }
- /* 加入购物模态层*/
- @keyframes showPopup {
- 0% {
- opacity: 0;
- }
- 100% {
- opacity: 1;
- }
- }
- @keyframes hidePopup {
- 0% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
- @keyframes showLayer {
- 0% {
- transform: translateY(0);
- }
- 100% {
- transform: translateY(-100%);
- }
- }
- @keyframes hideLayer {
- 0% {
- transform: translateY(-100%);
- }
- 100% {
- transform: translateY(0);
- }
- }
- @keyframes showAmnation {
- 0% {
- top: -12rpx;
- opacity: 0;
- }
- 50% {
- top: -60rpx;
- opacity: 1;
- }
- 100% {
- top: -100rpx;
- opacity: 0;
- }
- }
- @keyframes hideAmnation {
- 0% {
- top: -100rpx;
- opacity: 0;
- }
- 100% {
- top: -12rpx;
- opacity: 0;
- }
- }
- .popup {
- position: fixed;
- top: 0;
- width: 100%;
- height: 100%;
- z-index: 999;
- display: none;
- .mask {
- position: fixed;
- top: 0;
- width: 100%;
- height: 100%;
- z-index: 21;
- background-color: rgba(0, 0, 0, 0.6);
- }
- .layer {
- position: fixed;
- z-index: 22;
- bottom: -360rpx;
- width: 702rpx;
- padding: 24rpx 24rpx 36rpx 24rpx;
- // height: 236rpx;
- border-radius: 20rpx 20rpx 0 0;
- background-color: #fff;
- display: flex;
- flex-wrap: wrap;
- align-content: space-between;
- .content {
- width: 100%;
- margin-top: 20rpx;
- }
- .btn {
- width: 100%;
- // height: 88rpx;
- display: flex;
- .button {
- width: 702rpx;
- height: 88rpx;
- color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: $font-size-28;
- border-radius: 44rpx;
- background: $btn-confirm;
- margin-top: 20rpx;
- }
- }
- }
- .layer-nunbox-m {
- font-size: 28rpx;
- }
- &.show {
- display: block;
- .mask {
- animation: showPopup 0.2s linear both;
- }
- .layer {
- animation: showLayer 0.2s linear both;
- }
- }
- &.hide {
- display: block;
- .mask {
- animation: hidePopup 0.2s linear both;
- }
- .layer {
- animation: hideLayer 0.2s linear both;
- }
- }
- &.none {
- display: none;
- }
- &.service {
- .row {
- margin: 30upx 0;
- .title {
- font-size: 30upx;
- margin: 10upx 0;
- }
- .description {
- font-size: 28upx;
- color: #999;
- }
- }
- }
- .layer-smimg {
- width: 158rpx;
- height: 158rpx;
- float: left;
- border-radius: 10rpx;
- margin-right: 24rpx;
- image {
- width: 158rpx;
- height: 158rpx;
- border-radius: 10rpx;
- }
- }
- .layer-nunbox {
- justify-content: space-between;
- align-items: center;
- width: 510rpx;
- height: 88rpx;
- padding: 10rpx 0 0 0;
- float: left;
- .layer-nunbox-t {
- width: 100%;
- height: 44rpx;
- position: relative;
- display: flex;
- margin-top: 10rpx;
- .layer-nunbox-text {
- line-height: 44rpx;
- font-size: $font-size-28;
- }
- .number-box {
- display: flex;
- justify-content: center;
- align-items: center;
- border: 2rpx solid #ffe6dc;
- border-radius: 30rpx;
- height: 48rpx;
- margin-left: 20rpx;
- .iconfont {
- font-size: $font-size-24;
- padding: 0 18rpx;
- color: #999999;
- text-align: center;
- line-height: 48rpx;
- font-weight: bold;
- background: #fef6f3;
- &.icon-jianhao {
- border-radius: 30rpx 0 0 30rpx;
- }
- &.icon-jiahao {
- border-radius: 0 30rpx 30rpx 0;
- }
- }
- .btn-input {
- width: 80rpx;
- height: 48rpx;
- line-height: 48rpx;
- background: #ffffff;
- border-radius: 4rpx;
- text-align: center;
- font-size: $font-size-28;
- }
- }
- .product-step {
- position: absolute;
- left: 45rpx;
- bottom: 0;
- height: 44rpx;
- background: #ffffff;
- }
- }
- .layer-nunbox-b {
- width: 100%;
- height: 44rpx;
- margin-top: 13rpx;
- }
- .text {
- line-height: 44rpx;
- font-size: $font-size-28;
- .p {
- color: #ff2a2a;
- }
- .p:first-child {
- margin-left: 30rpx;
- }
- .p.sm {
- font-size: $font-size-24;
- }
- }
- }
- }
- .zuhe .layer {
- bottom: -270rpx;
- height: 200rpx;
- }
- </style>
|