app-diy-goods-list.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  1. <template>
  2. <view class="app-goods-list">
  3. <view class="goods-list" :class="listClass" v-if="newData.length > 0">
  4. <!-- 列表模式 -->
  5. <template v-if="listStyle === -1">
  6. <block v-for="(goods, index) in newData" :key="index">
  7. <view :style="[{'background-color':`${goodsStyle != 3 ? '#fff' : ''}`, overflow: `${sign === 'composition' ? 'hidden': 'visible'}`}]" class="goods-item app-list-mode dir-left-nowrap" @click="jump(goods)"
  8. :class="goodsStyle === 3 ? 'no-border' : goodsStyle === 2 ? 'border' : ''">
  9. <!-- 售罄 -->
  10. <view :style="[{'border-radius': `${lisRadius}`}]" class="out-dialog" v-if="(goods.goods_stock == 0 || (goods.goods && goods.goods.goods_stock == 0)) && appSetting.is_show_stock == '1'">
  11. <image :style="[{'border-radius': `${lisRadius}`}]" :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  12. </view>
  13. <view class="box-grow-0">
  14. <app-image
  15. v-if="sign === 'advance'"
  16. :borderRadius="lisRadius"
  17. :img-src="goods.goods.goodsWarehouse.cover_pic"
  18. width="220rpx"
  19. height="220rpx"
  20. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  21. ></app-image>
  22. <div v-else-if="sign === 'composition'" style="width: 328rpx;height: 100%">
  23. <app-diy-composition-image
  24. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  25. :image-list="goods.cover_pic_list"></app-diy-composition-image>
  26. </div>
  27. <app-image
  28. v-else
  29. :borderRadius="lisRadius"
  30. :img-src="goods.cover_pic"
  31. width="220rpx"
  32. height="220rpx"
  33. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  34. ></app-image>
  35. </view>
  36. <!-- 角标 -->
  37. <view class="goods-tag" v-if="showGoodsTag">
  38. <app-image :img-src="goodsTagPicUrl" width="64rpx" height="64rpx"></app-image>
  39. </view>
  40. <view class="right box-grow-1 dir-top-nowrap main-between"
  41. :style="{
  42. padding: sign === 'advance' || sign=== 'composition' || (sign === 'flash-sale' && ((goods.vip_card_appoint && goods.vip_card_appoint.discount) && (goods.level_show == 1 && goods.is_negotiable != 1))) ? `10rpx 24rpx 6rpx 20rpx` : '28rpx 24rpx 24rpx 20rpx',
  43. height: sign === 'composition' ? '165rpx' : '220rpx',
  44. }">
  45. <view class="box-grow-0 name "
  46. :class="(sign === 'advance' || sign === 'miaosha' || sign === 'flash-sale') || (goods.vip_card_appoint && goods.vip_card_appoint.discount) || (goods.level_show == 1 && goods.is_negotiable != 1) ? 't-omit name-one' : 't-omit-two name-two'">
  47. <text class="dir-tag-def"
  48. v-if="tag && sign === 'advance' || sign === 'pick'|| sign === 'miaosha'"
  49. :style="{'background-color': theme.background_o,'color': theme.color}"
  50. >
  51. {{goods.people_num ? goods.people_num : ''}}{{tag}}
  52. </text>
  53. <text class="dir-tag-def"
  54. v-if="tag && sign !== 'advance' && sign !== 'pick' && sign !== 'miaosha' && ((sign == 'pintuan' && goods.people_num) || sign != 'pintuan')"
  55. :style="{'background-color': theme.background_o,'color': theme.color}"
  56. >
  57. {{goods.people_num ? goods.people_num : ''}}{{tag}}
  58. </text>
  59. <!-- 商品名字 -->
  60. <text v-if="sign === 'advance'">
  61. {{showGoodsName ? goods.goods.goodsWarehouse.name : ''}}
  62. </text>
  63. <text v-else>{{showGoodsName ? goods.name : ''}}</text>
  64. </view>
  65. <view class=" dir-top-nowrap main-right box-grow-1">
  66. <template v-if="sign === 'flash-sale'">
  67. <view class="dir-left-nowrap main-between" style="margin-bottom: 10rpx">
  68. <view
  69. class="flash-sale"
  70. :style="{'background-color': theme.background}"
  71. v-if="goods.discount_type == 1"
  72. >{{goods.min_discount}}折</view>
  73. <view
  74. class="flash-sale"
  75. :style="{'background-color': theme.background}"
  76. v-if="goods.discount_type == 2"
  77. >减{{goods.min_discount}}元</view>
  78. <view v-if="showProgressBar" style="font-size: 20rpx;color: #999999;">{{goods.sales}}</view>
  79. </view>
  80. <view class="app-percentage" v-if="showProgressBar" :style="{'width': '445rpx','margin-bottom': '10rpx','background-color': theme.background_l}">
  81. <view :style="{width: `${goods.percentage}%`,'background-color': theme.background}"></view>
  82. </view>
  83. </template>
  84. <view class="dir-left-nowrap cross-bottom">
  85. <view class="box-grow-1" :style="{'color': theme.color}">
  86. <!-- 时间 -->
  87. <template v-if="showTimer && sign !== 'flash-sale'">
  88. <app-goods-timer
  89. v-if="sign === 'advance'"
  90. :list-style="listStyle"
  91. :theme="theme"
  92. :start-date-time="goods.start_prepayment_at"
  93. :end-date-time="goods.end_prepayment_at"
  94. :sign="sign"
  95. :page-hide="pageHide"
  96. ></app-goods-timer>
  97. <app-goods-timer
  98. v-else
  99. :list-style="listStyle"
  100. :start-date-time="goods.start_time"
  101. :end-date-time="goods.end_time"
  102. :sign="sign"
  103. :page-hide="pageHide"
  104. :theme="theme"
  105. ></app-goods-timer>
  106. </template>
  107. <!-- #ifndef MP-ALIPAY -->
  108. <text v-if="sign === 'advance'" class="des-price"
  109. :style="{'color': theme.color,'border-color': theme.color,'margin-top': '5rpx'}">
  110. 定金¥{{goods.deposit}}抵¥{{goods.swell_deposit}}
  111. </text>
  112. <!-- #endif -->
  113. <!-- #ifdef MP-ALIPAY -->
  114. <text v-if="sign === 'advance'" class="des-price"
  115. :style="{'color': theme.color,'border-color': theme.color,'margin-top': '5rpx'}">
  116. 定金¥{{goods.deposit}}抵¥{{goods.swell_deposit}}
  117. </text>
  118. <!-- #endif -->
  119. <text class="tag" v-else-if="sign === 'pick'">
  120. {{goods.rule_price}}元选{{goods.rule_num}}{{goods.unit}}
  121. </text>
  122. <template v-if="goods.is_level == 1 && goods.is_negotiable != 1">
  123. <app-member-price :price="goods.level_price"></app-member-price>
  124. </template>
  125. <!-- #ifndef MP-ALIPAY -->
  126. <app-sup-vip
  127. :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  128. v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  129. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  130. ></app-sup-vip>
  131. <!-- #endif -->
  132. <!-- #ifdef MP-ALIPAY -->
  133. <app-sup-vip
  134. margin="4rpx 0"
  135. :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  136. v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  137. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  138. ></app-sup-vip>
  139. <!-- #endif -->
  140. <template v-if="sign === 'advance'">
  141. <view class="dir-left-nowrap main-left cross-center">
  142. <view class="goods-price ">¥{{showGoodsPrice ? goods.goods.price :''}}
  143. </view>
  144. <view class="original-price" style="margin-left: 10upx;"
  145. v-if="isUnderLinePrice && goods.goods.goodsWarehouse.original_price">
  146. ¥{{goods.goods.goodsWarehouse.original_price}}
  147. </view>
  148. </view>
  149. </template>
  150. <view v-else
  151. :class="sign === 'miaosha'|| (sign === 'flash-sale' && showProgressBar) || (goods.vip_card_appoint && goods.vip_card_appoint.discount) || (goods.is_level == 1 && goods.is_negotiable != 1) ? 'dir-left-nowrap main-left cross-center' : 'dir-top-nowrap'">
  152. <view class="goods-price ">{{showGoodsPrice ?
  153. goods.price_content :
  154. ''}}
  155. </view>
  156. <view class="dir-left-nowrap">
  157. <view class="original-price" style="margin-left: 10upx;"
  158. v-if="isShowOriginalPrice(goods)">
  159. ¥{{goods.original_price}}
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. <!--购物车-->
  165. <view v-if="showBuyBtn && goods.is_negotiable != 1" :style="goods.buy_goods_auth ? btnStyle : disableBtnStyle" :class="[buyBtnClass, 'box-grow-0', 'buy-btn', 'main-center', 'cross-center']">{{buyBtnText}}</view>
  166. </view>
  167. </view>
  168. </view>
  169. </view>
  170. </block>
  171. </template>
  172. <!-- 一行一个 -->
  173. <template v-else-if="listStyle === 1">
  174. <block v-for="(goods, index) in newData" :key="index">
  175. <view :style="[{'background-color':`${goodsStyle != 3 ? '#fff' : ''}`,overflow: `${sign === 'composition' ? 'hidden': 'visible'}`}]"
  176. class="goods-item app-column-1" :class="[goodsClass, index !== newData.length - 1 ? 'app-column-1-mar' : '']" @click="jump(goods)">
  177. <view style="position: relative;">
  178. <view class="out-dialog"
  179. :style="[{'height':`${coverPicHeight}`,'border-radius': `${imgRadius}`}]"
  180. v-if="(goods.goods_stock == 0 || (goods.goods && goods.goods.goods_stock == 0)) && appSetting.is_show_stock == '1'">
  181. <image v-if="coverPicHeight == '468rpx'"
  182. :style="[{'height':`${coverPicHeight}`,'border-radius': `${imgRadius}`}]"
  183. :src="appSetting.is_use_stock == '1' ? appImg.rate_out : appSetting.sell_out_other_pic"></image>
  184. <image v-else
  185. :style="[{'height':`${coverPicHeight}`,'border-radius': `${imgRadius}`}]"
  186. :src="appSetting.is_use_stock == '1' ? appImg.one_out : appSetting.sell_out_pic"></image>
  187. </view>
  188. <view>
  189. <app-image :borderRadius="imgRadius" v-if="sign === 'advance'"
  190. :img-src="goods.goods.goodsWarehouse.cover_pic"
  191. width="100%"
  192. :height="coverPicHeight"
  193. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  194. ></app-image>
  195. <div v-else-if="sign === 'composition'" style="width: 100%;height: 336rpx">
  196. <app-diy-composition-image
  197. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  198. :image-list="goods.cover_pic_list"></app-diy-composition-image>
  199. </div>
  200. <app-image :borderRadius="imgRadius" v-else
  201. :img-src="goods.cover_pic"
  202. width="100%"
  203. :height="coverPicHeight"
  204. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  205. ></app-image>
  206. </view>
  207. <view class="goods-tag" v-if="showGoodsTag">
  208. <app-image :img-src="goodsTagPicUrl"
  209. width="64rpx"
  210. height="64rpx"
  211. >
  212. </app-image>
  213. </view>
  214. <view class="box-grow-0 timer" v-if="showTimer">
  215. <template v-if="sign === 'advance'">
  216. <app-goods-timer
  217. :list-style="listStyle"
  218. :start-date-time="goods.start_prepayment_at"
  219. :end-date-time="goods.end_prepayment_at"
  220. :sign="sign" :page-hide="pageHide"
  221. :theme="theme"
  222. ></app-goods-timer>
  223. </template>
  224. <template v-else>
  225. <app-goods-timer
  226. :list-style="listStyle"
  227. :start-date-time="goods.start_time"
  228. :end-date-time="goods.end_time"
  229. :sign="sign" :page-hide="pageHide"
  230. :theme="theme"
  231. ></app-goods-timer>
  232. </template>
  233. </view>
  234. </view>
  235. <view class="goods-name t-omit-two" v-if="showGoodsName">
  236. <template v-if="sign === 'advance'">
  237. <text>{{showGoodsName ? goods.goods.goodsWarehouse.name : ''}}</text>
  238. </template>
  239. <template v-if="['pick', 'gift', 'exchange', 'wholesale', 'step'].indexOf(sign) !== -1">
  240. <text class="tag-pick"
  241. :style="{'background-color': theme.background_o,'color': theme.color}"
  242. {{tag}}
  243. </text>
  244. <text>{{showGoodsName ? goods.name : ''}}</text>
  245. </template>
  246. <template v-else-if="sign === 'composition'">
  247. <text class="tag-pick" :style="{'background-color': theme.background_o,'color': theme.color}">
  248. {{goods.tag}}
  249. </text>
  250. <text>{{showGoodsName ? goods.name : ''}}</text>
  251. </template>
  252. <template v-else>
  253. <text class="tag"
  254. :style="{'border-color': theme.border,'color': theme.color}"
  255. v-if="tag && sign == 'pintuan' && goods.people_num">
  256. {{goods.people_num ? goods.people_num : ''}}{{tag}}
  257. </text>
  258. <text>{{showGoodsName ? goods.name : ''}}</text>
  259. </template>
  260. </view>
  261. <template v-if="sign === 'advance'">
  262. <text class="des-price" :style="{'border-color': theme.border,'color': theme.color,'margin-left':'24rpx','margin-top':'15rpx'}">
  263. 定金¥{{goods.deposit}}抵¥{{goods.swell_deposit}}
  264. </text>
  265. </template>
  266. <template v-if="sign === 'flash-sale'">
  267. <view class="dir-top-nowrap" style="margin-bottom: 10rpx;padding:0 24rpx;">
  268. <view :class="showProgressBar ? 'flash-sale-dis' : ''">
  269. <view class="flash-sale" :style="{'background-color': theme.background}"
  270. v-if="goods.discount_type == 1">{{goods.min_discount}}折</view>
  271. <view class="flash-sale" :style="{'background-color': theme.background}"
  272. v-if="goods.discount_type == 2">减{{goods.min_discount}}元</view>
  273. </view>
  274. <view v-if="showProgressBar" class="app-percentage" :style="{'background-color': theme.background_l,'width':'660rpx'}">
  275. <view :style="{width: `${goods.percentage}%`,'background-color': theme.background}"></view>
  276. </view>
  277. <view v-if="sign === 'flash-sale' && showProgressBar" style="font-size: 20rpx;color: #999999;">{{goods.sales}}</view>
  278. </view>
  279. </template>
  280. <template v-if="sign === 'pick'">
  281. <text class="des-price"
  282. :style="{'border-color': theme.border,'color': theme.color,'margin-left':'24rpx','margin-top':'15rpx'}">
  283. {{goods.rule_price}}元选{{goods.rule_num}}{{goods.unit}}
  284. </text>
  285. </template>
  286. <view class="price dir-left-nowrap cross-center"
  287. :style="{marginTop: sign === 'advance' ? '0rpx' : '16rpx'}">
  288. <view class="box-grow-1 t-omit" :style="{'color': theme.color}">
  289. <view v-if="sign === 'advance'" class="dir-left-nowrap cross-center"
  290. :class="textStyle === 2 ? 'main-center' : ''">
  291. <view v-if="goods.goods.is_level == 1">
  292. <app-member-price :price="goods.level_price"></app-member-price>
  293. </view>
  294. <app-sup-vip :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  295. margin='0 0 0 12rpx' v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  296. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"></app-sup-vip>
  297. </view>
  298. <template v-if="sign === 'advance'">
  299. <view :class="{'dir-left-nowrap': goods.goods.is_level == 1}"
  300. v-if="showGoodsPrice">
  301. <view class="dir-left-nowrap cross-center"
  302. :class="{'main-center' :textStyle == 2}">
  303. <view style="font-size: 22rpx;height: 22rpx;line-height: 22rpx">
  304. {{showGoodsPrice ? `¥${goods.goods.price}` : ''}}
  305. </view>
  306. </view>
  307. <view class="original-price"
  308. style="font-size: 17rpx;height:17rpx;line-height: 17rpx;"
  309. v-if="isUnderLinePrice && goods.goods.goodsWarehouse.original_price">
  310. ¥{{goods.goods.goodsWarehouse.original_price}}
  311. </view>
  312. </view>
  313. </template>
  314. <template v-else>
  315. <view class="dir-left-nowrap cross-center"
  316. :class="textStyle === 2 ? 'main-center' : ''">
  317. <view>{{showGoodsPrice ? goods.price_content :
  318. ''}}
  319. </view>
  320. <view class="member-price"
  321. v-if="goods.is_level == 1 && goods.is_negotiable != 1 && sign !== 'pick'">
  322. <app-member-price margin=""
  323. :price="goods.level_price"></app-member-price>
  324. </view>
  325. <app-sup-vip :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  326. margin='0 0 0 12rpx'
  327. v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  328. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"></app-sup-vip>
  329. </view>
  330. <view class="original-price"
  331. v-if="isShowOriginalPrice(goods)">
  332. ¥{{goods.original_price}}
  333. </view>
  334. </template>
  335. </view>
  336. <template v-if="showBuyBtn && goods.is_negotiable != 1 && textStyle !== 2">
  337. <view class="box-grow-0 buy-btn main-center cross-center" :style="goods.buy_goods_auth ? btnStyle : disableBtnStyle" :class="buyBtnClass">
  338. {{buyBtnText}}
  339. </view>
  340. </template>
  341. </view>
  342. </view>
  343. </block>
  344. </template>
  345. <!-- 一行两个 -->
  346. <template v-else-if="listStyle === 2">
  347. <block v-for="(goods, index) in newData" :key="index">
  348. <view :style="[{'background-color':`${goodsStyle != 3 ? '#fff' : ''}`, overflow: `${sign === 'composition' ? 'hidden': 'visible'}`}]"
  349. class="box-grow-0 dir-top-nowrap goods-item app-column-2" :class="goodsClass"
  350. @click="jump(goods)">
  351. <view style="position: relative;">
  352. <view :style="[{'border-radius': `${imgRadius}`}]" class="out-dialog"
  353. v-if="(goods.goods_stock == 0 || (goods.goods && goods.goods.goods_stock == 0)) && appSetting.is_show_stock == '1'">
  354. <image :style="[{'border-radius': `${imgRadius}`}]"
  355. :src="appSetting.is_use_stock == '1' ? appImg.book_out : appSetting.sell_out_pic"></image>
  356. </view>
  357. <view class="box-grow-0">
  358. <template v-if="sign === 'advance'">
  359. <app-image :borderRadius="imgRadius"
  360. :img-src="goods.goods.goodsWarehouse.cover_pic"
  361. width="100%"
  362. height="342rpx"
  363. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  364. ></app-image>
  365. </template>
  366. <div v-else-if="sign === 'composition'" style="width: 100%;height: 164rpx">
  367. <app-diy-composition-image
  368. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"
  369. :image-list="goods.cover_pic_list"></app-diy-composition-image>
  370. </div>
  371. <template v-else>
  372. <app-image :borderRadius="imgRadius" :img-src="goods.cover_pic" width="100%"
  373. height="342rpx"
  374. :mode="fill === 1 ? 'aspectFill' : 'aspectFit'"></app-image>
  375. </template>
  376. </view>
  377. <view class="goods-tag" v-if="showGoodsTag">
  378. <app-image :img-src="goodsTagPicUrl" width="64rpx"
  379. height="64rpx"></app-image>
  380. </view>
  381. <view class="box-grow-0 timer" v-if="showTimer">
  382. <template v-if="sign === 'advance'">
  383. <app-goods-timer :list-style="listStyle"
  384. :start-date-time="goods.start_prepayment_at"
  385. :end-date-time="goods.end_prepayment_at"
  386. :sign="sign" :page-hide="pageHide"
  387. :theme="theme"
  388. ></app-goods-timer>
  389. </template>
  390. <template v-else>
  391. <app-goods-timer :list-style="listStyle" :start-date-time="goods.start_time"
  392. :end-date-time="goods.end_time"
  393. :sign="sign" :page-hide="pageHide"
  394. :theme="theme"
  395. ></app-goods-timer>
  396. </template>
  397. </view>
  398. </view>
  399. <view class="box-grow-1 dir-top-nowrap main-between">
  400. <view class="box-grow-0 goods-name t-omit-two" v-if="showGoodsName">
  401. <template v-if="['advance', 'pick', 'gift', 'exchange', 'composition', 'wholesale', 'step'].indexOf(sign) === -1">
  402. <text class="tag"
  403. :style="{'border-color': theme.border,'color': theme.color}"
  404. v-if="tag && ((sign === 'pintuan' && goods.people_num) || sign !== 'pintuan')">
  405. {{goods.people_num ? goods.people_num : ''}}{{tag}}
  406. </text>
  407. </template>
  408. <template v-if="['pick', 'gift', 'exchange', 'wholesale', 'step'].indexOf(sign) !== -1">
  409. <text class="dir-tag-def"
  410. :style="{'background-color': theme.background_o,'color': theme.color}">
  411. {{tag}}
  412. </text>
  413. </template>
  414. <template v-if="sign === 'composition'">
  415. <text class="dir-tag-def"
  416. :style="{'background-color': theme.background_o,'color': theme.color}">
  417. {{goods.tag}}
  418. </text>
  419. </template>
  420. <text v-if="sign === 'advance'">{{showGoodsName ?
  421. goods.goods.goodsWarehouse.name : ''}}
  422. </text>
  423. <text v-else>{{showGoodsName ? goods.name : ''}}</text>
  424. </view>
  425. <view v-if="sign === 'advance'">
  426. <text class="des-price"
  427. :style="{'background-color': theme.background,'border-color': theme.color,'margin-left':'24rpx'}">
  428. 定金¥{{goods.deposit}}抵¥{{goods.swell_deposit}}
  429. </text>
  430. </view>
  431. <view v-if="sign === 'pick'">
  432. <text class="des-price"
  433. :style="{'background-color': theme.background,'border-color': theme.color,'margin-left':'24rpx'}">
  434. {{goods.rule_price}}元选{{goods.rule_num}}{{goods.unit}}
  435. </text>
  436. </view>
  437. <template v-if="sign === 'flash-sale'">
  438. <view :class="showProgressBar ? 'flash-sale-dis' : ''" style="margin-left: 24rpx;">
  439. <view class="flash-sale" v-if="goods.discount_type === 1" :style="{'background-color': theme.background}">{{goods.min_discount}}折</view>
  440. <view class="flash-sale" v-if="goods.discount_type === 2" :style="{'background-color': theme.background}">减{{goods.min_discount}}元</view>
  441. </view>
  442. <view v-if="showProgressBar" class="app-percentage" :style="{'background-color': theme.background_l,'width':'296rpx','margin-left':'24rpx'}">
  443. <view :style="{width: `${goods.percentage}%`,'background-color':theme.background}"></view>
  444. </view>
  445. <text v-if="showProgressBar" style="font-size: 20rpx; color: #999;margin-top: 10rpx;padding-left: 24rpx">{{goods.sales}}</text>
  446. </template>
  447. <view :class="textStyle === 2 ? 'main-center' : 'dir-left-nowrap'"
  448. style="height: 15px;padding-left: 24rpx;"
  449. v-if="sign === 'advance' && goods.goods.is_level == 1 && goods.is_negotiable != 1">
  450. <view class="member-price">
  451. <app-member-price :price="goods.level_price"></app-member-price>
  452. </view>
  453. </view>
  454. <app-sup-vip :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  455. style="padding-left: 24rpx;"
  456. :class="textStyle === 2 ? 'main-center' : ''" margin="4rpx 0"
  457. v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount && sign === 'advance'"
  458. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"></app-sup-vip>
  459. <view class="box-grow-0 price dir-left-nowrap cross-bottom main-between"
  460. :style="{marginTop: sign === 'advance' ? '0rpx' : '16rpx'}">
  461. <template v-if="sign === 'advance'">
  462. <view :class="textStyle === 2 ? 'main-center advance-center' : ''"
  463. style="width: 100%" v-if="showGoodsPrice">
  464. <view class="dir-top-nowrap main-right cross-top"
  465. :style="{'color': theme.color}">
  466. <text class="t-omit"
  467. style="font-size: 22rpx;height: 22rpx; line-height: 22rpx">
  468. {{showGoodsPrice ? `¥${goods.goods.price}` : ''}}
  469. </text>
  470. <text class="original-price"
  471. style="font-size: 17rpx;height: 22rpx; line-height: 22rpx"
  472. v-if="isUnderLinePrice && goods.goods.goodsWarehouse.original_price">
  473. ¥{{goods.goods.goodsWarehouse.original_price}}
  474. </text>
  475. </view>
  476. </view>
  477. </template>
  478. <template v-else>
  479. <view class="box-grow-1" :style="{'color': theme.color}">
  480. <view class="member-price" :class="textStyle === 2 ? 'main-center' : ''"
  481. v-if="goods.is_level == 1 && goods.is_negotiable != 1 && sign !== 'pick'">
  482. <app-member-price :price="goods.level_price"></app-member-price>
  483. </view>
  484. <view v-if="goods.vip_card_appoint && goods.vip_card_appoint.discount" :class="textStyle === 2 ? 'main-center' : ''">
  485. <app-sup-vip
  486. :is_vip_card_user="goods.vip_card_appoint.is_vip_card_user"
  487. :margin="textStyle === 2 ? '0':'8rpx 0 0'"
  488. :discount="goods.vip_card_appoint && goods.vip_card_appoint.discount"
  489. ></app-sup-vip>
  490. </view>
  491. <view class="t-omit">
  492. {{showGoodsPrice ? goods.price_content : ''}}
  493. </view>
  494. <view class="original-price"
  495. v-if="isShowOriginalPrice(goods)">
  496. ¥{{goods.original_price}}
  497. </view>
  498. </view>
  499. </template>
  500. <view v-if="showBuyBtn && goods.is_negotiable != 1 && textStyle !== 2" class="box-grow-0 buy-btn main-center cross-center" :style="goods.buy_goods_auth ? btnStyle : disableBtnStyle" :class="buyBtnClass">
  501. {{buyBtnText}}
  502. </view>
  503. </view>
  504. </view>
  505. </view>
  506. </block>
  507. </template>
  508. </view>
  509. </view>
  510. </template>
  511. <script>
  512. import { mapGetters, mapState } from "vuex";
  513. import appPrice from "../../page-component/goods/app-price.vue";
  514. import appGoodsTimer from "./app-goods-timer.vue";
  515. import appDiyCompositionImage from '../app-diy-goods-list/app-diy-composition-image';
  516. export default {
  517. name: "app-diy-goods-list",
  518. components: {
  519. 'app-price': appPrice,
  520. 'app-goods-timer': appGoodsTimer,
  521. appDiyCompositionImage
  522. },
  523. props: {
  524. list: {
  525. type: Array,
  526. default() {
  527. return [];
  528. }
  529. },
  530. goodsStyle: {
  531. type: Number,
  532. default() {
  533. return 1;
  534. }
  535. },
  536. textStyle: {
  537. type: Number,
  538. default() {
  539. return 1;
  540. }
  541. },
  542. listStyle: {
  543. type: Number,
  544. default() {
  545. return -1;
  546. }
  547. },
  548. showBuyBtn: {
  549. type: Boolean,
  550. default() {
  551. return false;
  552. }
  553. },
  554. buyBtnText: {
  555. type: String,
  556. default() {
  557. return '';
  558. }
  559. },
  560. buyBtnStyle: {
  561. type: Number,
  562. default() {
  563. return 1;
  564. }
  565. },
  566. fill: {
  567. type: Number,
  568. default() {
  569. return 1;
  570. }
  571. },
  572. showGoodsName: {
  573. type: Boolean,
  574. default() {
  575. return true;
  576. }
  577. },
  578. showGoodsPrice: {
  579. type: Boolean,
  580. default() {
  581. return true;
  582. }
  583. },
  584. showGoodsTag: {
  585. type: Boolean,
  586. default() {
  587. return true;
  588. }
  589. },
  590. goodsCoverProportion: {
  591. type: String,
  592. default() {
  593. return '1-1';
  594. }
  595. },
  596. customizeGoodsTag: {
  597. type: Boolean,
  598. default() {
  599. return false;
  600. }
  601. },
  602. goodsTagPicUrl: String,
  603. sign: String,
  604. buttonColor: {
  605. type: String,
  606. default() {
  607. return '';
  608. }
  609. },
  610. //是否显示划线价
  611. isUnderLinePrice: {
  612. type: Boolean,
  613. default() {
  614. return true;
  615. }
  616. },
  617. pageHide: Boolean,
  618. theme: Object,
  619. showProgressBar: {
  620. type: Boolean,
  621. default() {
  622. return false;
  623. }
  624. }
  625. },
  626. data() {
  627. return {
  628. imgRadius: '16rpx 16rpx 0 0',
  629. lisRadius: '16rpx',
  630. disableColor: '#999999'
  631. };
  632. },
  633. computed: {
  634. ...mapState({
  635. appImg: state => state.mallConfig.__wxapp_img.mall,
  636. appSetting: state => state.mallConfig.mall.setting,
  637. platform: function(state) {
  638. return state.gConfig.systemInfo.platform;
  639. }
  640. }),
  641. ...mapGetters('mallConfig',{
  642. vip: 'getVip',
  643. getVideo: 'getVideo'
  644. }),
  645. newData() {
  646. return this.list;
  647. },
  648. listClass() {
  649. switch (this.listStyle) {
  650. case 2:
  651. return `dir-left-wrap column-2 main-between `;
  652. default:
  653. return ``;
  654. }
  655. },
  656. buyBtnClass() {
  657. let buyBtnClass = ``;
  658. if (this.buyBtnStyle === 2 || this.buyBtnStyle === 4) {
  659. buyBtnClass += `buy-btn-border `;
  660. }
  661. if (this.buyBtnStyle === 4 || this.buyBtnStyle === 3) {
  662. buyBtnClass += `buy-btn-radius`;
  663. }
  664. return buyBtnClass;
  665. },
  666. btnStyle() {
  667. let btnStyle = ``;
  668. if (this.buyBtnStyle === 1 || this.buyBtnStyle === 3) {
  669. btnStyle += `background-color: ${this.buttonColor};color: #ffffff;`;
  670. } else {
  671. btnStyle += `border-color: ${this.buttonColor};color: ${this.buttonColor};`;
  672. }
  673. return btnStyle;
  674. },
  675. disableBtnStyle() {
  676. let btnStyle = ``;
  677. if (this.buyBtnStyle === 1 || this.buyBtnStyle === 3) {
  678. btnStyle += `background-color: ${this.disableColor};color: #ffffff;`;
  679. } else {
  680. btnStyle += `border-color: ${this.disableColor};color: ${this.disableColor};`;
  681. }
  682. return btnStyle;
  683. },
  684. coverPicHeight() {
  685. if (this.goodsCoverProportion === '1-1') {
  686. return `702rpx`;
  687. } else {
  688. return `468rpx`;
  689. }
  690. },
  691. goodsClass() {
  692. let goodsClass = ``;
  693. if (this.goodsStyle === 2) {
  694. goodsClass += `border`;
  695. }
  696. if (this.textStyle === 2) {
  697. goodsClass += `text-center`;
  698. }
  699. return goodsClass;
  700. },
  701. tag() {
  702. let tag = '';
  703. switch (this.sign) {
  704. case 'miaosha':
  705. tag = '秒杀';
  706. break;
  707. case 'bargain':
  708. tag = '砍价';
  709. break;
  710. case 'pintuan':
  711. tag = '人团';
  712. break;
  713. case 'advance':
  714. tag = '预售';
  715. break;
  716. case 'pick':
  717. tag = 'N元任选';
  718. break;
  719. case 'composition':
  720. tag = '套餐组合';
  721. break;
  722. case 'gift':
  723. tag = '社交送礼';
  724. break;
  725. case 'flash-sale':
  726. tag = '限时抢购';
  727. break;
  728. case 'wholesale':
  729. tag = '商品批发';
  730. break;
  731. case 'exchange':
  732. tag = '礼品卡';
  733. break;
  734. case 'step':
  735. tag = '步数宝';
  736. break;
  737. default:
  738. tag = null;
  739. break;
  740. }
  741. return tag;
  742. },
  743. showTimer() {
  744. if (!(this.sign === 'miaosha' || this.sign === 'bargain' || this.sign === 'lottery' || this.sign === 'advance' || this.sign === 'flash-sale')) return false;
  745. return true;
  746. },
  747. },
  748. methods: {
  749. jump(data) {
  750. // #ifndef MP-BAIDU
  751. if (data.video_url && this.getVideo == 1 && data.sign !== 'lottery' && data.sign !== 'bargain' && data.sign !== 'wholesale') {
  752. let id = data.id;
  753. if (data.sign === 'advance') {
  754. id = data.goods_id;
  755. }
  756. if (data.sign === 'gift') {
  757. id = id + '&is_share=1';
  758. }
  759. // #ifdef MP
  760. uni.navigateTo({
  761. url: `/pages/goods/video?goods_id=${id}&sign=${data.sign}`
  762. });
  763. // #endif
  764. // #ifdef H5
  765. uni.navigateTo({
  766. url: data.page_url
  767. });
  768. // #endif
  769. } else {
  770. uni.navigateTo({
  771. url: data.page_url
  772. });
  773. }
  774. // #endif
  775. // #ifdef MP-BAIDU
  776. uni.navigateTo({
  777. url: data.page_url
  778. });
  779. // #endif
  780. },
  781. isShowOriginalPrice(goods) {
  782. return this.isUnderLinePrice && goods.original_price && this.showGoodsPrice && goods.is_negotiable !== 1;
  783. },
  784. }
  785. }
  786. </script>
  787. <style scoped lang="scss">
  788. .advance-member {
  789. margin-right: #{12rpx};
  790. }
  791. .advance-center .original-price {
  792. width: 100%;
  793. text-align: center;
  794. }
  795. .app-goods-list {
  796. %background-image {
  797. background-repeat: no-repeat;
  798. background-size: cover;
  799. background-position: center;
  800. }
  801. .goods-list {
  802. padding: #{24rpx 24rpx 24rpx 24rpx};
  803. font-size: $uni-font-size-general-one;
  804. .border {
  805. border: #{1rpx} solid #e2e2e2;
  806. }
  807. .goods-item {
  808. position: relative;
  809. .app-button-icon {
  810. width: #{45rpx};
  811. height: #{45rpx};
  812. display: block;
  813. @extend %background-image;
  814. }
  815. .app-button-icon-cart {
  816. background-image: url('../../../static/image/icon/cats.png');
  817. }
  818. .app-button-icon-add {
  819. background-image: url('../../../static/image/icon/add-to.png');
  820. }
  821. .buy-btn {
  822. height: #{48rpx};
  823. padding: 0 #{20rpx};
  824. }
  825. .buy-btn-radius {
  826. border-radius: #{24rpx};
  827. }
  828. .buy-btn-border {
  829. border: #{1rpx} solid;
  830. }
  831. .goods-tag {
  832. position: absolute;
  833. left: 0;
  834. top: 0;
  835. z-index: 10;
  836. width: #{64rpx};
  837. height: #{64rpx};
  838. }
  839. .original-price {
  840. font-size: $uni-font-size-weak-two;
  841. color: $uni-general-color-two;
  842. text-decoration: line-through;
  843. }
  844. .tag {
  845. padding: 0 #{10rpx};
  846. margin-right: #{8rpx};
  847. font-size: #{20rpx};
  848. line-height: 1;
  849. border-radius: #{28rpx};
  850. border: #{1rpx} solid;
  851. transform: rotateZ(360deg);
  852. }
  853. .timer {
  854. width: 100%;
  855. }
  856. .pintuan-tag {
  857. font-size: $uni-font-size-weak-two;
  858. margin: #{16rpx} #{12rpx} 0 0;
  859. padding: 0 #{24rpx};
  860. .people {
  861. width: #{70rpx};
  862. text-align: center;
  863. border: #{1rpx} solid;
  864. border-radius: #{2rpx};
  865. padding: #{2rpx} 0;
  866. }
  867. }
  868. }
  869. .app-list-mode {
  870. margin-bottom: #{32rpx};
  871. position: relative;
  872. border-radius: #{16rpx};
  873. .name {
  874. font-size: #{28rpx};
  875. color: #353535;
  876. line-height: 38upx;
  877. }
  878. .right {
  879. height: #{220rpx};
  880. }
  881. &:last-child {
  882. margin-bottom: 0;
  883. }
  884. .pintuan-tag {
  885. padding: 0;
  886. }
  887. .out-dialog {
  888. width: #{220rpx};
  889. height: 100%;
  890. position: absolute;
  891. z-index: 11;
  892. top: 0;
  893. left: 0;
  894. background-color: rgba(0,0,0,.5);
  895. image {
  896. width: #{220rpx};
  897. height: #{220rpx};
  898. }
  899. }
  900. }
  901. .app-column-1 {
  902. padding-bottom: #{24rpx};
  903. border-radius: #{16rpx};
  904. .out-dialog {
  905. width: 100%;
  906. height: #{702rpx};
  907. z-index: 11;
  908. position: absolute;
  909. top: 0;
  910. left: 0;
  911. background-color: rgba(0,0,0,.5);
  912. image {
  913. width: #{702rpx};
  914. height: #{702rpx};
  915. }
  916. }
  917. .goods-name {
  918. margin-top: #{28rpx};
  919. padding: 0 #{24rpx};
  920. font-size: #{28rpx};
  921. color: #353535;
  922. line-height: 38upx;
  923. }
  924. .price {
  925. margin-top: #{16rpx};
  926. padding: 0 #{24rpx};
  927. max-width: #{702rpx};
  928. .member-price {
  929. margin-left: #{10rpx};
  930. }
  931. }
  932. .timer {
  933. position: absolute;
  934. left: 0;
  935. bottom: 0;
  936. z-index: 10;
  937. }
  938. .pintuan-tag {
  939. margin: 0;
  940. padding-left: 0;
  941. }
  942. }
  943. .app-column-1-mar {
  944. margin-bottom: #{24rpx};
  945. }
  946. &.column-2 {
  947. padding: #{24rpx} #{23rpx} 0 #{23rpx};
  948. .app-column-2 {
  949. margin-bottom: #{24rpx};
  950. padding-bottom: #{24rpx};
  951. border-radius: #{16rpx};
  952. width: #{346rpx};
  953. .out-dialog {
  954. width: 100%;
  955. height: #{342rpx};
  956. position: absolute;
  957. z-index: 11;
  958. top: 0;
  959. left: 0;
  960. background-color: rgba(0,0,0,.5);
  961. image {
  962. width: #{342rpx};
  963. height: #{342rpx};
  964. }
  965. }
  966. .goods-name {
  967. font-size: #{28rpx};
  968. color: #353535;
  969. margin-top: #{24rpx};
  970. padding: 0 #{24rpx};
  971. width: #{344rpx};
  972. line-height: 38upx;
  973. }
  974. .price {
  975. margin-top: #{16rpx};
  976. padding: 0 #{24rpx};
  977. max-width: #{344rpx};
  978. }
  979. .pintuan-tag ~ .price {
  980. margin-top: #{16rpx};
  981. }
  982. .timer {
  983. position: absolute;
  984. left: 0;
  985. bottom: 0;
  986. z-index: 10;
  987. }
  988. }
  989. }
  990. }
  991. }
  992. .des-price {
  993. display: inline-block;
  994. padding: #{0rpx 4rpx};
  995. border: #{1rpx} solid;
  996. border-radius: #{8rpx};
  997. font-size: #{20rpx};
  998. line-height: 1.2;
  999. transform: rotateZ(360deg);
  1000. }
  1001. .dir-tag-def {
  1002. padding: 0 #{10rpx};
  1003. margin-right: #{8rpx};
  1004. font-size: $uni-font-size-weak-two;
  1005. border-radius: #{28rpx};
  1006. }
  1007. .seheight {
  1008. height: #{110rpx};
  1009. width: #{430rpx};
  1010. }
  1011. .default-text {
  1012. color: #666666;
  1013. }
  1014. .tag-pick {
  1015. padding: 0 #{10rpx};
  1016. margin-right: #{8rpx};
  1017. font-size: $uni-font-size-weak-two;
  1018. border-radius: #{28rpx};
  1019. }
  1020. .goods-price {
  1021. font-size: #{30upx};
  1022. line-height: 1.1;
  1023. }
  1024. .app-percentage {
  1025. height: #{20rpx};
  1026. border-radius: #{12rpx};
  1027. overflow: hidden;
  1028. >view {
  1029. height: #{20rpx};
  1030. border-radius: #{12rpx};
  1031. }
  1032. }
  1033. .flash-sale {
  1034. padding: 5upx 10upx;
  1035. font-size: 20upx;
  1036. color: #fff;
  1037. line-height: 1;
  1038. border-radius: 14upx;
  1039. margin-right: 10upx;
  1040. display: inline-block;
  1041. }
  1042. .flash-sale-dis {
  1043. margin-bottom: 10upx;
  1044. }
  1045. </style>