presale.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view :style="[boxStyle]" v-if="productList.length">
  3. <view>
  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" :style="[titleStyle]" 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" :style="[headerBntColor]"></text>
  16. </view>
  17. </view>
  18. <!-- 预售列表 -->
  19. <!-- 单列 -->
  20. <view class="pt-32 pr-20 pb-32 pl-20 bg--w111-fff" :style="[boxContentStyle]" 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/images/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. :style="[boxContentStyle]" 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 line2 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]">{{ $t(`¥`) }}{{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. :style="[boxContentStyle]" 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)">{{ $t(`¥`) }}{{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. :style="[boxContentStyle]" 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)">{{ $t(`¥`) }}{{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. titleStyle(){
  175. let titleText = this.dataConfig.titleText
  176. return {
  177. fontStyle: !titleText.tabVal?'normal':titleText.tabList[titleText.tabVal].style,
  178. fontWeight: !titleText.tabVal?'bold':'normal',
  179. color: this.dataConfig.titleColor.color[0].item,
  180. fontSize: this.dataConfig.titleNumber.val*2+'rpx'
  181. }
  182. },
  183. boxStyle(){
  184. return {
  185. padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  186. marginTop: `${this.dataConfig.mbConfig.val * 2}rpx`,
  187. background: this.dataConfig.bottomBgColor.color[0].item,
  188. }
  189. },
  190. boxContentStyle() {
  191. let br = `${this.dataConfig.fillet.val * 2}rpx`;
  192. let borderRadius = `0 0 ${br} ${br}`;
  193. if (this.dataConfig.fillet.type) {
  194. borderRadius =
  195. `0 0 ${this.dataConfig.fillet.valList[3].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx`;
  196. }
  197. return {
  198. borderRadius,
  199. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  200. };
  201. },
  202. /*商品模板*/
  203. goodStyleConfig(){
  204. return this.dataConfig.goodStyleConfig.tabVal
  205. },
  206. styleConfig(){
  207. return this.dataConfig.styleConfig.tabVal
  208. },
  209. headerStyle(){
  210. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  211. borderRadius= '',
  212. imgBgUrl = this.dataConfig.imgBgConfig.url;
  213. if (this.dataConfig.fillet.type){
  214. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx 0 0`
  215. }else{
  216. borderRadius = `${br} ${br} 0 0`
  217. }
  218. return {
  219. backgroundImage: this.styleConfig ? 'url(' + imgBgUrl + ')' : `linear-gradient(90deg,${this.dataConfig.headerBgColor.color[0].item} 0%,${this.dataConfig.headerBgColor.color[1].item} 100%)`,
  220. borderRadius,
  221. }
  222. },
  223. /*标题是文本还是图片*/
  224. titleConfig(){
  225. return this.dataConfig.titleConfig.tabVal
  226. },
  227. /*标题文本*/
  228. titleTxtConfig(){
  229. return this.dataConfig.titleTxtConfig.value
  230. },
  231. /*标题图片*/
  232. titleImg(){
  233. return this.styleConfig ? this.titleUrl : this.titleColorUrl
  234. },
  235. titleColorUrl(){
  236. return this.dataConfig.imgColorConfig.url
  237. },
  238. titleUrl(){
  239. return this.dataConfig.imgConfig.url
  240. },
  241. /*标题提示文字*/
  242. tipsColor(){
  243. return {
  244. color: this.styleConfig ? this.dataConfig.tipsColor.color[0].item : this.dataConfig.tipsColor2.color[0].item
  245. }
  246. },
  247. /*分割线颜色*/
  248. dividerColor(){
  249. return {
  250. color: this.dataConfig.dividerColor.color[0].item
  251. }
  252. },
  253. /*头部提示语文本*/
  254. tipTxt(){
  255. return this.dataConfig.tipTxtConfig.value
  256. },
  257. /*头部按钮文本*/
  258. rightBntTxt(){
  259. return this.dataConfig.rightBntConfig.value
  260. },
  261. /*头部按钮样式*/
  262. headerBntColor(){
  263. return {
  264. color: this.styleConfig ? this.dataConfig.headerBntColor.color[0].item : this.dataConfig.headerBntColor2.color[0].item,
  265. fontSize: `${this.dataConfig.bntNumber.val * 2}rpx`
  266. }
  267. },
  268. /*商品图片圆角样式*/
  269. imgStyle(){
  270. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  271. if (this.dataConfig.filletImg.type) {
  272. borderRadius =
  273. `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${this.dataConfig.filletImg.valList[1].val * 2}rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx ${this.dataConfig.filletImg.valList[2].val * 2}rpx`;
  274. }
  275. return borderRadius
  276. },
  277. /*商品名称样式*/
  278. productStyle(){
  279. return {
  280. color: this.dataConfig.goodsNameColor.color[0].item,
  281. fontWeight: this.dataConfig.goodsName.tabVal ? 'normal' : 'bold'
  282. }
  283. },
  284. /* 展示信息 */
  285. checkboxInfo(){
  286. return this.dataConfig.checkboxInfo.type
  287. },
  288. /* 价格颜色 */
  289. priceColor(){
  290. return this.dataConfig.toneConfig.tabVal ? this.dataConfig.presalePriceColor.color[0].item : 'var(--view-theme)'
  291. },
  292. /* 划线价颜色 */
  293. otPriceColor(){
  294. return this.dataConfig.goodsPriceColor.color[0].item
  295. },
  296. showBtn(){
  297. return this.dataConfig.presaleConfig.tabVal
  298. },
  299. /* 按钮颜色 */
  300. btnBgColor(){
  301. return {
  302. 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%)'
  303. }
  304. },
  305. /*商品数量*/
  306. numberConfig(){
  307. return this.dataConfig.numberConfig.val
  308. }
  309. },
  310. mounted() {
  311. this.getList();
  312. },
  313. methods: {
  314. goPage(url){
  315. uni.navigateTo({
  316. url
  317. })
  318. },
  319. getList() {
  320. let limit = this.$config.LIMIT;
  321. getAdvancellList({
  322. page: 1,
  323. limit: this.numberConfig>=limit?limit:this.numberConfig,
  324. time_type:0
  325. }).then(res => {
  326. this.productList = res.data.list;
  327. })
  328. },
  329. goDetails(item){
  330. uni.navigateTo({
  331. url: `/pages/activity/goods_details/index?id=${item.id}&type=6`
  332. })
  333. }
  334. }
  335. }
  336. </script>
  337. <style lang="scss">
  338. .Regular{
  339. font-family: 'Regular';
  340. }
  341. .bg-cover{
  342. background-size: cover;
  343. }
  344. .item ~ .item{
  345. margin-top: 32rpx;
  346. }
  347. .badge{
  348. width: 152rpx;
  349. height: 26rpx;
  350. background: linear-gradient(90deg, #FF7931 0%, #E93323 100%);
  351. border-radius: 20rpx;
  352. display: inline-flex;
  353. justify-content: center;
  354. align-items: center;
  355. margin: 16rpx 0;
  356. }
  357. .btn-left{
  358. width: 60%;
  359. border-radius: 8rpx 0 0 8rpx;
  360. background:rgba(255,255,255,0.9);
  361. }
  362. .btn-right{
  363. width: 40%;
  364. border-radius: 0 8rpx 8rpx 0;
  365. }
  366. .shandian{
  367. width: 48rpx;
  368. height: 74rpx;
  369. position: absolute;
  370. // transform: scale(1.1);
  371. left: 60%;
  372. top: 0;
  373. margin-top: -2rpx;
  374. margin-left: -22rpx;
  375. }
  376. </style>