12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067 |
- <template>
- <view class="app-recommended-product">
- <view class="app-display-classification" v-if="showCat">
- <scroll-view class="app-scroll-view dir-left-nowrap" scroll-x scroll-with-animation>
- <text class="app-nav-item" @click="change(index)"
- :class="{'app-active-current': catStyle === 1 && activeCurrent === index,
- 'app-active-current-round': catStyle === 2 && activeCurrent === index,
- 'app-current-round': catStyle === 2
- }"
- :key="index"
- v-for="(item, index) in catList"
- >{{item.menuName}}</text>
- </scroll-view>
- </view>
- <view class="app-content" v-if="!showCat">
- <!-- 列表模式 -->
- <view class="app-list-mode" v-if="listStyle === -1">
- <view :class="{'app-border': goodsStyle === 2}" :key="index" v-for="(item, index) in list">
- <app-form-id @click="jump(item)">
- <view class="app-item dir-left-nowrap">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image" :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''" :src="item.cover_pic"></image>
- <view class="app-item-content dir-top-nowrap" :class="{'main-right': showGoodsName === false}">
- <text class="app-name" v-if="showGoodsName">{{item.name}}</text>
- <view class="app-price-button dir-left-nowrap" :class="{'main-between': showGoodsPrice, 'main-right': !showGoodsPrice}">
- <text v-if="showGoodsPrice" class="app-text">{{item.price_content}}</text>
- <template v-if="showBuyBtn">
- <button v-if="buyBtn === 'text'"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart'"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add'"
- ></icon>
- </template>
- </view>
- </view>
- </view>
- </app-form-id>
- </view>
- </view>
- <!-- 左右滑动 -->
- <view class="app-swipe-left-right" v-if="listStyle === 0">
- <scroll-view class="scroll-view" scroll-with-animation scroll-x>
- <view class="app-item" :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}" v-for="(item, index) in list" :key="index">
- <app-form-id @click="jump(item)">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image" :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''" :src="item.cover_pic"></image>
- <view class="app-price-button-name dir-top-nowrap">
- <text v-if="showGoodsName" class="app-name" :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}">{{item.name}}</text>
- <view class="app-price-button dir-left-nowrap cross-bottom"
- :class="{
- 'app-price-goods-style': goodsStyle === 3 || goodsStyle === 4,
- 'main-right': showGoodsPrice === false
- }">
- <text v-if="showGoodsPrice" class="app-price" :class="{'app-price-goods-style': goodsStyle === 3 || goodsStyle === 4}">{{item.price_content}}</text>
- <template v-if="goodsStyle !== 3 && goodsStyle !== 4">
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-if="buyBtn === 'cart'"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add'"
- ></icon>
- </template>
- </view>
- </view>
- </app-form-id>
- </view>
- </scroll-view>
- </view>
- <!-- 一行一个 -->
- <view class="app-one-per-line" v-if="listStyle === 1">
- <view class="app-item" :class="{'app-border': goodsStyle === 2 || goodsStyle === 4, 'app-square': goodsCoverProportion === '1-1',
- 'app-rectangle': goodsCoverProportion === '3-2'
- }" v-for="(item, index) in list" :key="index">
- <app-form-id @click="jump(item)">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image"
- :mode="fill === 1 && goodsCoverProportion === '3-2'? 'center' :goodsCoverProportion === '3-2' && fill === 2 ? 'aspectFit': fill === 1 && goodsCoverProportion === '1-1' ? 'scaleToFill' : goodsCoverProportion === '1-1' && fill === 2 ? 'scaleToFill' : ''"
- :class="{
- 'app-square-image': goodsCoverProportion === '1-1',
- 'app-rectangle-image': goodsCoverProportion === '3-2',
- }"
- :src="item.cover_pic"
- ></image>
- <text class="app-text" :style="{textAlign: goodsStyle === 3 ? 'center' : ''}" v-if="showGoodsName">{{item.name}}</text>
- <view v-if="showBuyBtn && showGoodsPrice"
- class="app-button-price dir-left-nowrap cross-center"
- :class="{'main-between': goodsStyle !== 3 || goodsStyle !== 4, 'main-center' : goodsStyle === 3 || goodsStyle === 4}"
- :style="{position: showGoodsPrice === false ? 'relative' : ''}">
- <text v-if="showGoodsPrice" class="app-price">{{item.price_content}}</text>
- <view v-if="showBuyBtn" :class="{'app-button-no-price' : showGoodsPrice === false}">
- <button v-if="buyBtn === 'text' && goodsStyle !== 3 && goodsStyle !== 4"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"></icon>
- </view>
- </view>
- </app-form-id>
- </view>
- </view>
- <!-- 一行两个 -->
- <view class="app-one-line-two dir-left-wrap" v-if="listStyle === 2">
- <view class="app-item"
- :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}"
- v-for="(item, index) in list"
- :key="index"
- >
- <app-form-id @click="jump(item)">
- <image
- class="app-icon"
- :src="goodsTagPicUrl"
- v-if="showGoodsTag"
- ></image>
- <image class="app-image"
- :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''"
- :src="item.cover_pic"
- ></image>
- <text v-if="showGoodsName"
- class="app-name"
- :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}"
- >{{item.name}}</text>
- <view
- class="app-price-buttons dir-left-nowrap cross-center"
- :class="{'main-between': showGoodsPrice, 'main-right': !showGoodsPrice, 'main-center': goodsStyle === 3 || goodsStyle === 4}"
- >
- <text v-if="showGoodsPrice"
- class="app-price"
- >{{item.price_content}}</text>
- <template v-if="showBuyBtn">
- <button
- v-if="buyBtn === 'text' && goodsStyle !== 3 && goodsStyle !== 4"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- </template>
- </view>
- </app-form-id>
- </view>
- </view>
- <!-- 一行三个 -->
- <view class="app-one-line-three dir-left-wrap" v-if="listStyle === 3">
- <view class="app-item"
- v-for="(item, index) in list"
- :key="index"
- :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}"
- >
- <app-form-id @click="jump(item)">
- <image
- class="app-icon"
- :src="goodsTagPicUrl"
- v-if="showGoodsTag"
- ></image>
- <image class="app-image"
- :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''"
- :src="item.cover_pic"
- ></image>
- <text class="app-name"
- :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}"
- v-if="showGoodsName">{{item.name}}</text>
- <view class="app-price-buttons dir-left-nowrap cross-center"
- :class="{'main-between': goodsStyle !== 3 && goodsStyle !== 4, 'main-center': goodsStyle === 3 || goodsStyle === 4}"
- >
- <text class="app-price"
- v-if="showGoodsPrice"
- >{{item.price_content}}</text>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- </view>
- </app-form-id>
- </view>
- </view>
- </view>
- <view class="app-content" v-if="showCat">
- <!-- 列表模式 -->
- <view class="app-list-mode" v-if="listStyle === -1">
- <view class="app-page" v-for="(page, number) in catList" :key="number" v-if="activeCurrent === number">
- <view :class="{'app-border': goodsStyle === 2}" :key="index" v-for="(item, index) in page.goodsList">
- <app-form-id @click="jump(item)">
- <view class="app-item dir-left-nowrap">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image" :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''" :src="item.cover_pic"></image>
- <view class="app-item-content dir-top-nowrap" :class="{'main-right': showGoodsName === false}">
- <text class="app-name" v-if="showGoodsName">{{item.name}}</text>
- <view class="app-price-button dir-left-nowrap" :class="{'main-between': showGoodsPrice, 'main-right': !showGoodsPrice}">
- <text v-if="showGoodsPrice" class="app-text">{{item.price_content}}</text>
- <template v-if="showBuyBtn">
- <button v-if="buyBtn === 'text'"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart'"></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add'"></icon>
- </template>
- </view>
- </view>
- </view>
- </app-form-id>
- </view>
- </view>
- </view>
- <!-- 左右滑动 -->
- <view class="app-swipe-left-right" v-if="listStyle === 0">
- <view class="app-page" v-for="(page, number) in catList" :key="number" v-if="activeCurrent === number">
- <scroll-view class="scroll-view" scroll-with-animation scroll-x>
- <view class="app-item" :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}" v-for="(item, index) in page.goodsList" :key="index">
- <app-form-id @click="jump(item)">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image" :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''" :src="item.cover_pic"></image>
- <view class="app-price-button-name dir-top-nowrap">
- <text v-if="showGoodsName" class="app-name" :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}">{{item.name}}</text>
- <view class="app-price-button dir-left-nowrap cross-bottom"
- :class="{
- 'app-price-goods-style': goodsStyle === 3 || goodsStyle === 4,
- 'main-right': showGoodsPrice === false
- }">
- <text v-if="showGoodsPrice" class="app-price" :class="{'app-price-goods-style': goodsStyle === 3 || goodsStyle === 4}">{{item.price_content}}</text>
- <template v-if="goodsStyle !== 3 && goodsStyle !== 4">
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-if="buyBtn === 'cart'"></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add'"></icon>
- </template>
- </view>
- </view>
- </app-form-id>
- </view>
- </scroll-view>
- </view>
- </view>
- <!-- 一行一个 -->
- <view class="app-one-per-line" v-if="listStyle === 1">
- <view class="app-page" v-for="(page, number) in catList" :key="number" v-if="activeCurrent === number">
- <view class="app-item" :class="{'app-border': goodsStyle === 2 || goodsStyle === 4, 'app-square': goodsCoverProportion === '1-1',
- 'app-rectangle': goodsCoverProportion === '3-2'
- }" v-for="(item, index) in page.goodsList" :key="index">
- <app-form-id @click="jump(item)">
- <image class="app-icon" :src="goodsTagPicUrl" v-if="showGoodsTag"></image>
- <image class="app-image"
- :mode="fill === 1 && goodsCoverProportion === '3-2'? 'center' :goodsCoverProportion === '3-2' && fill === 2 ? 'aspectFit': fill === 1 && goodsCoverProportion === '1-1' ? 'scaleToFill' : goodsCoverProportion === '1-1' && fill === 2 ? 'scaleToFill' : ''"
- :class="{
- 'app-square-image': goodsCoverProportion === '1-1',
- 'app-rectangle-image': goodsCoverProportion === '3-2',
- }"
- :src="item.cover_pic"
- ></image>
- <text class="app-text" :style="{textAlign: goodsStyle === 3 ? 'center' : ''}" v-if="showGoodsName">{{item.name}}</text>
- <view v-if="showBuyBtn && showGoodsPrice"
- class="app-button-price dir-left-nowrap cross-center"
- :class="{'main-between': goodsStyle !== 3 || goodsStyle !== 4, 'main-center' : goodsStyle === 3 || goodsStyle === 4}"
- :style="{position: showGoodsPrice === false ? 'relative' : ''}">
- <text v-if="showGoodsPrice" class="app-price">{{item.price_content}}</text>
- <view v-if="showBuyBtn" :class="{'app-button-no-price' : showGoodsPrice === false}">
- <button v-if="buyBtn === 'text' && goodsStyle !== 3 && goodsStyle !== 4"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"></icon>
- </view>
- </view>
- </app-form-id>
- </view>
- </view>
- </view>
- <!-- 一行两个 -->
- <template v-if="listStyle === 2">
- <view class="app-page app-one-line-two dir-left-wrap" v-for="(page, number) in catList" :key="number" v-if="activeCurrent === number">
- <view class="app-item"
- :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}"
- v-for="(item, index) in page.goodsList"
- :key="index"
- >
- <app-form-id @click="jump(item)">
- <image
- class="app-icon"
- :src="goodsTagPicUrl"
- v-if="showGoodsTag"
- ></image>
- <image class="app-image"
- :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''"
- :src="item.cover_pic"
- ></image>
- <text v-if="showGoodsName"
- class="app-name"
- :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}"
- >{{item.name}}</text>
- <view
- class="app-price-buttons dir-left-nowrap cross-center"
- :class="{'main-between': showGoodsPrice, 'main-right': !showGoodsPrice, 'main-center': goodsStyle === 3 || goodsStyle === 4}"
- >
- <text v-if="showGoodsPrice"
- class="app-price"
- >{{item.price_content}}</text>
- <template v-if="showBuyBtn">
- <button
- v-if="buyBtn === 'text' && goodsStyle !== 3 && goodsStyle !== 4"
- @click.stop="buyProduct(item)"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- </template>
- </view>
- </app-form-id>
- </view>
- </view>
- </template>
- <!-- 一行三个 -->
- <template v-if="listStyle === 3">
- <view class="app-page app-one-line-three dir-left-wrap" v-for="(page, number) in catList" :key="number" v-if="activeCurrent === number">
- <view class="app-item"
- :class="{'app-border': goodsStyle === 2 || goodsStyle === 4}"
- v-for="(item, index) in page.goodsList"
- :key="index"
- >
- <app-form-id @click="jump(item)">
- <image
- class="app-icon"
- :src="goodsTagPicUrl"
- v-if="showGoodsTag"
- ></image>
- <image class="app-image"
- :mode="fill === 1 ? 'scaleToFill' : fill === 2 ? 'aspectFit': ''"
- :src="item.cover_pic"
- ></image>
- <text v-if="showGoodsName"
- class="app-name"
- :class="{'app-name-goods-style': goodsStyle === 3 || goodsStyle === 4}"
- >{{item.name}}</text>
- <view
- class="app-price-buttons dir-left-nowrap cross-center"
- :class="{'main-between': showGoodsPrice, 'main-right': !showGoodsPrice, 'main-center': goodsStyle === 3 || goodsStyle === 4}"
- >
- <text v-if="showGoodsPrice"
- class="app-price"
- >{{item.price_content}}</text>
- <template v-if="showBuyBtn">
- <button
- @click.stop="buyProduct(item)"
- v-if="buyBtn === 'text' && goodsStyle !== 3 && goodsStyle !== 4"
- :class="{
- 'app-button-filling': buyBtnStyle === 1,
- 'app-button-line' : buyBtnStyle === 2 ,
- 'app-button-fillet' : buyBtnStyle === 3,
- 'app-button-rounded-lines': buyBtnStyle === 4,
- }"
- >{{buyBtnText}}</button>
- <icon class="app-icon-button app-shopping-cart"
- @click.stop=""
- v-else-if="buyBtn === 'cart' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- <icon class="app-icon-button app-add-to"
- @click.stop="buyProduct(item)"
- v-else-if="buyBtn === 'add' && goodsStyle !== 3 && goodsStyle !== 4"
- ></icon>
- </template>
- </view>
- </app-form-id>
- </view>
- </view>
- </template>
- </view><view>
- <app-attr
- :goods="goods"
- :attrGroupList="goods.attr_groups"
- :show="show"
- :selectAttr="selectAttr"
- @attr="attr"
- ></app-attr>
- </view>
- </view>
- </template>
- <script>
- import {mapGetters} from 'vuex';
- import appAttr from '../../../components/page-component/app-attr/app-attr.vue';
- export default {
- name: 'app-recommended-product',
- props: {
- showCat: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- showBuyBtn: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- showGoodsName: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- showGoodsPrice: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- showGoodsTag: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- goodsTagPicUrl: {
- type: String,
- default: function() {
- return 'https://www.bangdian.net/plugins/diy/assets/images/goods-tag-rx.png';
- }
- },
- goodsCoverProportion: {
- type: String,
- default: function() {
- return '1-1';
- }
- },
- goodsStyle: {
- type: Number,
- default: function() {
- return 1;
- }
- },
- listStyle: {
- type: Number,
- default: function() {
- return 2;
- }
- },
- list: {
- type: Array,
- default: function () {
- return [
- ];
- }
- },
- fill: {
- type: Number,
- default: function() {
- return 2;
- }
- },
- customizeGoodsTag: {
- type: Boolean,
- default: function() {
- return false;
- }
- },
- catStyle: {
- type: Number,
- default:function() {
- return 2;
- }
- },
- buyBtnText: {
- type: String,
- default: function() {
- return '购买放电';
- }
- },
- buyBtnStyle: {
- type: Number,
- default: function() {
- return 1;
- }
- },
- buyBtn: {
- type: String,
- default: function() {
- return 'cart';
- }
- },
- catList: {
- type: Array,
- default: function() {
- return [];
- }
- }
- },
- data() {
- return {
- activeCurrent: 0,
- goods: {},
- }
- },
- computed: {
- ...mapGetters('mallConfig',{
- getVideo: 'getVideo'
- }),
- },
- methods: {
- change(index) {
- this.activeCurrent = index;
- },
- buyProduct(data) {
- if (data.mch_id === 0) {
- this.$request({
- url: this.$api.goods.detail,
- data: {
- id: data.id,
- }
- }).then(response => {
- if (response.code === 0) {
- this.goods = response.data.goods;
- this.show = Math.random();
- }
- })
- } else {
- this.$request({
- url: this.$api.mch.goods_detail,
- data: {
- mch_id: data.mch_id,
- id: data.id,
- }
- }).then(response => {
- if (response.code === 0) {
- this.goods = response.data.goods;
- this.show = Math.random();
- }
- })
- }
- },
- jump(data) {
- // #ifndef MP-BAIDU
- if (data.video_url && this.getVideo == 1) {
- uni.navigateTo({
- url: `/pages/goods/video?goods_id=${data.id}`
- });
- } else {
- uni.navigateTo({
- url: data.page_url
- });
- }
- // #endif
- // #ifdef MP-BAIDU
- uni.navigateTo({
- url: data.page_url
- });
- // #endif
- }
- },
- components: {
- 'app-attr': appAttr,
- }
- }
- </script>
- <style scoped lang="scss">
- .app-icon {
- width: #{55rpx};
- height: #{55rpx};
- position: absolute;
- top: 0;
- left: 0;
- }
- /* #ifdef MP-ALIPAY*/
- button {
- padding: 0 #{20rpx};
- }
- /* #endif */
- /* #ifdef MP-BAIDU*/
- button:after {
- display: none;
- }
- /* #endif */
- .app-recommended-product {
- width: #{750rpx};
- .app-display-classification {
- width: #{750rpx};
- height: #{99rpx};
- border-bottom: #{1rpx} solid #e2e2e2;
- .app-scroll-view {
- white-space: nowrap;
- width: #{750-5-5rpx};
- margin: 0 #{5rpx};
- height: #{99-1rpx};
- /* #ifdef MP-ALIPAY */
- .app-nav-item {
- display: inline-block;
- height: #{97rpx};
- min-width: #{60rpx};
- line-height: #{97rpx};
- font-size: #{26rpx};
- color: #666666;
- margin: 0 #{44rpx};
- border-bottom: #{1rpx} solid transparent;
- }
- /* #endif */
- /* #ifndef MP-ALIPAY */
- .app-nav-item {
- display: inline-block;
- height: #{97rpx};
- line-height: #{97rpx};
- font-size: #{26rpx};
- color: #666666;
- margin: 0 #{44rpx};
- border-bottom: #{1rpx} solid transparent;
- }
- /* #endif */
- .app-active-current {
- border-bottom-color: #ff5c5c;
- color: #ff5c5c;
- }
- /* #ifdef MP-ALIPAY */
- .app-current-round {
- height: #{56rpx};
- padding-left: #{24rpx};
- min-width: #{100rpx};
- padding-right: #{24rpx};
- border-radius: #{30rpx};
- line-height: #{56rpx};
- margin: #{21.5rpx} #{24rpx};
- }
- /* #endif */
- /* #ifndef MP-ALIPAY */
- .app-current-round {
- height: #{56rpx};
- padding-left: #{24rpx};
- padding-right: #{24rpx};
- border-radius: #{30rpx};
- line-height: #{56rpx};
- margin: #{21.5rpx} #{24rpx};
- }
- /* #endif */
- .app-active-current-round {
- background-color: #ff5c5c;
- color: white;
- }
-
- }
- }
- .app-icon-button {
- background-repeat: no-repeat;
- background-size: 100% 100%;
- width: #{50rpx};
- height: #{50rpx};
- }
- .app-shopping-cart {
- background-image: url("../../../static/image/icon/shopping-cart.png");
- }
- .app-add-to {
- background-image: url("../../../static/image/icon/add-to.png");
- }
- .app-border {
- border-color: #e2e2e2 !important;
- }
- /*列表模式*/
- .app-list-mode {
- .app-item {
- margin: #{32rpx} #{24rpx};
- width: #{750-24-24rpx};
- height: #{200rpx};
- border: #{1rpx} solid transparent;
- position: relative;
- overflow: hidden;
- background: #FFFFFF;
- .app-image {
- width: #{200rpx};
- height: #{198rpx};
- }
-
- .app-item-content {
- height: #{200rpx};
- width: #{500rpx};
- padding: #{24rpx} #{24rpx} #{20rpx} #{32rpx};
- .app-name {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- height: #{66rpx};
- font-size: #{26rpx};
- }
- .app-price-button button {
- display: inline-block;
- margin: 0;
- height: #{48rpx};
- font-size: #{28rpx};
- line-height: #{48rpx};
- border-radius: 0;
- }
- .app-button-filling {
- color: #ffffff;
- background-color: #ff5c5c;
- }
- .app-button-fillet {
- color: #ffffff;
- background-color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- .app-button-line {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- }
- .app-button-rounded-lines {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- .app-text {
- color: #ff4544;
- font-size: #{28rpx};
- }
- .app-price-button {
- margin-top: #{28rpx};
- }
- .app-price-button button:after {
- display: none;
- }
- }
- }
-
- }
- /*左右滑动*/
- .app-swipe-left-right {
- width: #{750rpx};
- .scroll-view {
- white-space: nowrap;
- width: #{750rpx};
- margin: 0 #{8rpx};
- padding-top: #{24rpx};
- padding-bottom: #{32rpx};
- .app-item {
- display: inline-block;
- width: #{200rpx};
- overflow: hidden;
- margin: 0 #{16rpx};
- position: relative;
- border: #{1rpx} solid transparent;
- background: #FFFFFF;
- .app-image {
- width: #{200rpx};
- height: #{200rpx};
- }
- .app-name {
- width: #{200-12-12rpx};
- height: #{48rpx};
- font-size: #{24rpx};
- line-height: #{24rpx};
- color: #353535;
- display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;
- overflow: hidden;
- }
- .app-name-goods-style {
- text-align: center;
- }
- .app-price-button-name {
- width: #{200-12-12rpx};
- margin: 0 #{12rpx};
- .app-price-goods-style {
- width: #{200-12-12rpx} !important;
- }
- .app-icon-button {
- margin-top: #{16rpx};
- margin-left: #{16rpx};
- }
- .app-price {
- width: #{110rpx};
- height: #{28rpx};
- font-size: #{28rpx};
- line-height: #{28rpx};
- color: #ff4544;
- text-align: center;
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- margin-bottom: #{12rpx};
- }
- }
- }
- }
- }
- /*一行一个*/
- .app-one-per-line {
- width: #{750rpx};
- padding: #{26rpx} #{24rpx};
- .app-square {
- }
- .app-rectangle {
- }
- .app-item {
- width: #{750-24-24rpx};
- border: #{1rpx} solid transparent;
- border-bottom-left-radius: #{20rpx};
- border-bottom-right-radius: #{20rpx};
- margin-bottom: #{12rpx};
- position: relative;
- padding-bottom: #{24rpx};
- background: #FFFFFF;
- .app-image {
- width: #{702rpx};
- }
- .app-square-image {
- height: #{702rpx};
- }
- .app-rectangle-image {
- height: #{702-234rpx};
- }
- .app-icon {
- width: #{60rpx};
- height: #{60rpx};
- position: absolute;
- top: 0;
- left: 0;
- }
- .app-text {
- width: #{702rpx};
- padding: 0 #{24rpx};
- margin-top: #{28rpx};
- font-size: #{26rpx};
- color: #353535;
- display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;
- overflow: hidden;
- }
- .app-button-price {
- width: #{702-24-24rpx};
- margin: #{32rpx} #{24rpx};
- height: #{50rpx};
- .app-price {
- font-size: #{28rpx};
- color: #ff4544;
- }
- button {
- display: inline-block;
- margin: 0;
- height: #{48rpx};
- font-size: #{28rpx};
- line-height: #{48rpx};
- border-radius: 0;
- }
- .app-button-no-price {
- position: absolute;
- right: 0;
- }
-
- .app-button-filling {
- color: #ffffff;
- background-color: #ff5c5c;
- }
- .app-button-fillet {
- color: #ffffff;
- background-color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- .app-button-line {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- }
- .app-button-rounded-lines {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- }
- }
- }
- /* 一行两个 */
- .app-one-line-two {
- width: #{750rpx};
- padding: #{2rpx} #{19rpx} #{0} #{19rpx};
- .app-item {
- width: #{346rpx};
- margin: #{24rpx} #{5rpx} #{0rpx} #{5rpx};
- border: #{1rpx} solid transparent;
- position: relative;
- background: #FFFFFF;
- .app-icon {
- width: #{55rpx};
- height: #{55rpx};
- position: absolute;
- top: 0;
- left: 0;
- }
- .app-image {
- width: #{343rpx};
- height: #{343rpx};
- }
- .app-name {
- width: #{346-24-24rpx};
- margin: #{24rpx} #{24rpx} 0 #{24rpx};
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- color: #353535;
- font-size: #{26rpx};
- /* #ifndef MP-ALIPAY*/
- height: #{64rpx};
- /* #endif */
- /* #ifdef MP-ALIPAY */
- height: #{55rpx};
- /* #endif */
- }
- .app-name-goods-style {
- text-align: center;
- }
- .app-price-buttons {
- margin: #{32rpx} #{24rpx} #{48rpx} #{24rpx};
- button {
- display: inline-block;
- margin: 0;
- height: #{48rpx};
- font-size: #{25rpx};
- line-height: #{48rpx};
- border-radius: 0;
- padding: 0 #{11rpx};
- }
- .app-price {
- color: #ff4544;
- font-size: #{28rpx};
- }
- .app-button-filling {
- color: #ffffff;
- background-color: #ff5c5c;
- }
- .app-button-fillet {
- color: #ffffff;
- background-color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- .app-button-line {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- }
- .app-button-rounded-lines {
- border: #{1rpx} solid #ff5c5c;
- color: #ff5c5c;
- border-radius: #{20rpx} !important;
- }
- }
- }
- }
- /* 一行三个 */
- .app-one-line-three {
- width: #{750rpx};
- padding: #{8rpx} #{16.5rpx};
- .app-item {
- background: #FFFFFF;
- width: #{224rpx};
- margin: #{16rpx} #{7.5rpx} #{16rpx} #{7.5rpx};
- position: relative;
- border: #{1rpx} solid transparent;
- padding-bottom: #{8rpx};
- .app-image {
- width: #{221rpx};
- height: #{221rpx};
- }
- .app-name {
- font-size: #{28rpx};
- color: #353535;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- width: #{224-12-12rpx};
- margin: #{16rpx} #{12rpx} #{0} #{12rpx};
- /* #ifndef MP-ALIPAY */
- height: #{70rpx};
- /* #endif */
- /* #ifdef MP-ALIPAY */
- height: #{60rpx};
- /* #endif */
- }
- .app-name-goods-style {
- text-align: center;
- }
- .app-price-buttons {
- margin: #{16rpx} #{12rpx} #{0} #{12rpx};
- .app-price {
- width: #{135rpx};
- font-size: #{28rpx};
- height: #{28rpx};
- line-height: #{28rpx};
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- color: #ff4544;
- }
- }
- }
- }
- }
- .app-page {
- width: #{750rpx};
- }
- </style>
|