presale.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view :style="[boxStyle]" v-if="productList.length">
  3. <view :style="[boxContentStyle]">
  4. <!-- 预售头部 -->
  5. <view class="w-full h-96 px-24 flex-between-center bg-cover" :style="[headerStyle]">
  6. <view class="flex-y-center">
  7. <text class="fs-32 lh-44rpx fw-500" v-if="titleConfig">{{titleTxtConfig}}</text>
  8. <image :src="titleImg" class="w-140 h-32" v-else></image>
  9. <text class="fs-28 text--w111-ccc px-16" :style="[dividerColor]">|</text>
  10. <text class="fs-26 text--w111-999 lh-36rpx" :style="[tipsColor]">{{tipTxt}}</text>
  11. </view>
  12. <view class="flex-y-center fs-24 text--w111-999" :style="[headerBntColor]"
  13. @tap="goPage('/pages/activity/presell/index')">
  14. <text>{{rightBntTxt}}</text>
  15. <text class="iconfont icon-ic_rightarrow fs-24"></text>
  16. </view>
  17. </view>
  18. <!-- 预售列表 -->
  19. <!-- 单列 -->
  20. <view class="pt-32 pr-20 pb-32 pl-20 bg--w111-fff" :style="[contentBox]" v-if="goodStyleConfig == 0">
  21. <view class="w-full flex justify-between item"
  22. v-for="(item,index) in productList" :key="index"
  23. @tap="goDetails(item)">
  24. <easy-loadimage
  25. :image-src="item.image"
  26. width="240rpx"
  27. height="240rpx"
  28. :borderRadius="imgStyle"></easy-loadimage>
  29. <view class="flex-1 flex-col justify-between pl-20 h-240">
  30. <view class="w-full fs-28 h-80 lh-40rpx line2" :style="[productStyle]"
  31. v-if="checkboxInfo.includes(0)">{{item.store_name}}</view>
  32. <view class="flex w-full h-68 rd-8rpx relative"
  33. :style="{background: dataConfig.goodsBntColor.color[0].item}"
  34. v-if="!showBtn">
  35. <view class="flex-y-center pl-20 fs-22 btn-left " :style="{color: dataConfig.goodsBntColor.color[0].item}">
  36. <!-- v-if="checkboxInfo.includes(2)" -->
  37. <baseMoney
  38. :money="item.price"
  39. symbolSize="26"
  40. integerSize="40"
  41. decimalSize="26"
  42. weight
  43. preFix="预售:"
  44. preFixSize="22"
  45. :textColor="priceColor"
  46. :color="priceColor"></baseMoney>
  47. </view>
  48. <view class="flex-center fs-26 fw-bold text--w111-fff btn-right" :style="[btnBgColor]">{{item.presale_pay_status | filterType}}</view>
  49. <image class="shandian" src="@/static/img/presale.png"></image>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 两列 -->
  55. <view class="grid-column-2 grid-gap-22rpx pt-32 pr-20 pb-32 pl-20"
  56. v-if="goodStyleConfig == 1">
  57. <view v-for="(item,index) in productList" :key="index"
  58. @tap="goDetails(item)">
  59. <easy-loadimage
  60. :image-src="item.image"
  61. width="100%"
  62. height="324rpx"
  63. :borderRadius="imgStyle"></easy-loadimage>
  64. <view class="w-full line1 mt-16 fs-28 lh-40rpx"
  65. :style="[productStyle]" v-if="checkboxInfo.includes(0)">{{item.store_name}}</view>
  66. <view class="flex justify-between items-end mt-10">
  67. <view class="flex-col">
  68. <baseMoney
  69. :money="item.price"
  70. symbolSize="24"
  71. integerSize="36"
  72. decimalSize="36"
  73. weight
  74. :color="priceColor"
  75. v-if="checkboxInfo.includes(2)"></baseMoney>
  76. <text class="text-line fs-26 text--w111-999 pt-14 Regular"
  77. :style="[otPriceColor]">¥{{item.ot_price}}</text>
  78. </view>
  79. <view class='w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg--w111-E93323'
  80. v-if="!showBtn" :style="[btnBgColor]">去预定</view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 三列 -->
  85. <view class="grid-column-3 grid-gap-18rpx pt-32 pr-20 pb-32 pl-20"
  86. v-if="goodStyleConfig == 2">
  87. <view v-for="(item,index) in productList" :key="index"
  88. @tap="goDetails(item)">
  89. <easy-loadimage
  90. :image-src="item.image"
  91. width="100%"
  92. height="212rpx"
  93. :borderRadius="imgStyle"></easy-loadimage>
  94. <view class="w-full line1 mt-16 fs-26" :style="[productStyle]"
  95. v-if="checkboxInfo.includes(0)">{{item.store_name}}</view>
  96. <view class="flex items-baseline mt-12">
  97. <baseMoney :money="item.price"
  98. symbolSize="24"
  99. integerSize="36"
  100. decimalSize="36"
  101. weight
  102. :color="priceColor"
  103. preFix="预售价"
  104. preFixSize="22"
  105. :textColor="priceColor"
  106. v-if="checkboxInfo.includes(2)"></baseMoney>
  107. </view>
  108. <view class="text-line fs-24 text--w111-999 Regular lh-32rpx"
  109. :style="[otPriceColor]" v-if="checkboxInfo.includes(3)">¥{{item.ot_price}}</view>
  110. </view>
  111. </view>
  112. <!-- 滑动 -->
  113. <scroll-view scroll-x="true" show-scrollbar="false"
  114. class="white-nowrap vertical-middle w-full pt-32 pb-32"
  115. v-if="goodStyleConfig == 3">
  116. <view class="inline-block ml-20" v-for="(item,index) in productList" :key="index"
  117. @tap="goDetails(item)">
  118. <easy-loadimage
  119. :image-src="item.image"
  120. width="224rpx"
  121. height="224rpx"
  122. :borderRadius="imgStyle"></easy-loadimage>
  123. <view class="w-222 line1 mt-16 fs-26" :style="[productStyle]"
  124. v-if="checkboxInfo.includes(0)">{{item.store_name}}</view>
  125. <view class="flex items-baseline mt-12">
  126. <baseMoney :money="item.price"
  127. symbolSize="24"
  128. integerSize="36"
  129. decimalSize="36"
  130. weight
  131. :color="priceColor"
  132. preFix="预售价"
  133. preFixSize="22"
  134. :textColor="priceColor"
  135. v-if="checkboxInfo.includes(2)"></baseMoney>
  136. </view>
  137. <view class="text-line fs-24 text--w111-999 Regular lh-32rpx"
  138. :style="[otPriceColor]" v-if="checkboxInfo.includes(3)">¥{{item.ot_price}}</view>
  139. </view>
  140. </scroll-view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import { getAdvancellList } from '@/api/activity.js';
  146. export default {
  147. name: 'presale',
  148. props: {
  149. dataConfig: {
  150. type: Object,
  151. default: () => {}
  152. },
  153. isSortType:{
  154. type: String | Number,
  155. default:0
  156. }
  157. },
  158. filters:{
  159. filterType(val){
  160. let obj = {
  161. 1: '未开始',
  162. 2: '进行中',
  163. 3: '已结束'
  164. };
  165. return obj[val]
  166. }
  167. },
  168. data() {
  169. return {
  170. productList: [],
  171. };
  172. },
  173. computed:{
  174. boxStyle(){
  175. return {
  176. padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  177. marginTop: `${this.dataConfig.mbConfig.val * 2}rpx`,
  178. background: this.dataConfig.bottomBgColor.color[0].item,
  179. }
  180. },
  181. boxContentStyle() {
  182. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  183. if (this.dataConfig.fillet.type) {
  184. borderRadius =
  185. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  186. }
  187. return {
  188. borderRadius,
  189. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  190. };
  191. },
  192. /*商品模板*/
  193. goodStyleConfig(){
  194. return this.dataConfig.goodStyleConfig.tabVal
  195. },
  196. styleConfig(){
  197. return this.dataConfig.styleConfig.tabVal
  198. },
  199. headerStyle(){
  200. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  201. borderRadius= '',
  202. imgBgUrl = this.dataConfig.imgBgConfig.url;
  203. if (this.dataConfig.fillet.type){
  204. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx 0 0`
  205. }else{
  206. borderRadius = `${br} ${br} 0 0`
  207. }
  208. return {
  209. backgroundImage: this.styleConfig ? 'url(' + imgBgUrl + ')' : `linear-gradient(90deg,${this.dataConfig.headerBgColor.color[0].item} 0%,${this.dataConfig.headerBgColor.color[0].item} 100%)`,
  210. borderRadius,
  211. }
  212. },
  213. contentBox(){
  214. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  215. borderRadius= '',
  216. imgBgUrl = this.dataConfig.imgBgConfig.url;
  217. if (this.dataConfig.fillet.type){
  218. borderRadius = `0 0 ${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx`
  219. }else{
  220. borderRadius = `0 0 ${br} ${br}`
  221. }
  222. return {
  223. borderRadius,
  224. }
  225. },
  226. /*标题是文本还是图片*/
  227. titleConfig(){
  228. return this.dataConfig.titleConfig.tabVal
  229. },
  230. /*标题文本*/
  231. titleTxtConfig(){
  232. return this.dataConfig.titleTxtConfig.value
  233. },
  234. /*标题图片*/
  235. titleImg(){
  236. return this.styleConfig ? this.titleUrl : this.titleColorUrl
  237. },
  238. titleColorUrl(){
  239. return this.dataConfig.imgColorConfig.url
  240. },
  241. titleUrl(){
  242. return this.dataConfig.imgConfig.url
  243. },
  244. /*标题提示文字*/
  245. tipsColor(){
  246. return {
  247. color: this.styleConfig ? this.dataConfig.tipsColor.color[0].item : this.dataConfig.tipsColor2.color[0].item
  248. }
  249. },
  250. /*分割线颜色*/
  251. dividerColor(){
  252. return {
  253. color: this.dataConfig.dividerColor.color[0].item
  254. }
  255. },
  256. /*头部提示语文本*/
  257. tipTxt(){
  258. return this.dataConfig.tipTxtConfig.value
  259. },
  260. /*头部按钮文本*/
  261. rightBntTxt(){
  262. return this.dataConfig.rightBntConfig.value
  263. },
  264. /*头部按钮样式*/
  265. headerBntColor(){
  266. return {
  267. color: this.styleConfig ? this.dataConfig.headerBntColor.color[0].item : this.dataConfig.headerBntColor2.color[0].item,
  268. fontSize: `${this.dataConfig.bntNumber.val * 2}rpx`
  269. }
  270. },
  271. /*商品图片圆角样式*/
  272. imgStyle(){
  273. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  274. if (this.dataConfig.filletImg.type) {
  275. borderRadius =
  276. `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${this.dataConfig.filletImg.valList[1].val * 2}rpx ${this.dataConfig.filletImg.valList[2].val * 2}rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx`;
  277. }
  278. return borderRadius
  279. },
  280. /*商品名称样式*/
  281. productStyle(){
  282. return {
  283. color: this.dataConfig.goodsNameColor.color[0].item,
  284. fontWeight: this.dataConfig.goodsName.tabVal ? 'normal' : '500'
  285. }
  286. },
  287. /* 展示信息 */
  288. checkboxInfo(){
  289. return this.dataConfig.checkboxInfo.type
  290. },
  291. /* 价格颜色 */
  292. priceColor(){
  293. return this.dataConfig.toneConfig.tabVal ? this.dataConfig.presalePriceColor.color[0].item : 'var(--view-theme)'
  294. },
  295. /* 原价颜色 */
  296. otPriceColor(){
  297. return this.dataConfig.goodsPriceColor.color[0].item
  298. },
  299. showBtn(){
  300. return this.dataConfig.presaleConfig.tabVal
  301. },
  302. /* 按钮颜色 */
  303. btnBgColor(){
  304. return {
  305. background: this.dataConfig.toneConfig.tabVal ? `linear-gradient(90deg,${this.dataConfig.goodsBntColor.color[0].item} 0%,${this.dataConfig.goodsBntColor.color[1].item} 100%)`: 'linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%)'
  306. }
  307. },
  308. /*商品数量*/
  309. numberConfig(){
  310. return this.dataConfig.numberConfig.val
  311. }
  312. },
  313. mounted() {
  314. this.getList();
  315. },
  316. methods: {
  317. goPage(url){
  318. uni.navigateTo({
  319. url
  320. })
  321. },
  322. getList() {
  323. let limit = this.$config.LIMIT;
  324. getAdvancellList({
  325. page: 1,
  326. limit: this.numberConfig>=limit?limit:this.numberConfig,
  327. time_type:0
  328. }).then(res => {
  329. this.productList = res.data.list;
  330. })
  331. },
  332. goDetails(item){
  333. uni.navigateTo({
  334. url: `/pages/activity/goods_details/index?id=${item.id}&type=6`
  335. })
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss">
  341. .Regular{
  342. font-family: 'Regular';
  343. }
  344. .bg-cover{
  345. background-size: cover;
  346. }
  347. .item ~ .item{
  348. margin-top: 32rpx;
  349. }
  350. .badge{
  351. width: 152rpx;
  352. height: 26rpx;
  353. background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
  354. border-radius: 20rpx;
  355. display: inline-flex;
  356. justify-content: center;
  357. align-items: center;
  358. margin: 16rpx 0;
  359. }
  360. .btn-left{
  361. width: 60%;
  362. border-radius: 8rpx 0 0 8rpx;
  363. background:rgba(255,255,255,0.9);
  364. }
  365. .btn-right{
  366. width: 40%;
  367. border-radius: 0 8rpx 8rpx 0;
  368. }
  369. .shandian{
  370. width: 48rpx;
  371. height: 74rpx;
  372. position: absolute;
  373. // transform: scale(1.1);
  374. left: 60%;
  375. top: 0;
  376. margin-top: -2rpx;
  377. margin-left: -22rpx;
  378. }
  379. </style>