index.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. // pages/demo11/index.js
  2. var Nova = getApp().Nova;
  3. Component({
  4. options: {
  5. multipleSlots: true, //在组件定义时的选项中启用多slot支持
  6. },
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {
  11. options: null,
  12. },
  13. /**
  14. * 组件的初始数据
  15. */
  16. data: {
  17. column: "",
  18. button: true, //购买按钮
  19. reductionPrice: true, //满减
  20. inventoryNumber: true, //库存
  21. timeData: {},
  22. List: [
  23. {
  24. reductionPrice: 90, //满减
  25. goodsName: "此处显示商品名称",
  26. describeName: "此处显示商品描述",
  27. price: 79.99, //折扣价
  28. original: 159.99, //原价
  29. inventoryNumber: 20,//库存
  30. time: 30 * 60 * 60 * 1000,
  31. buy: "购买",
  32. },
  33. ],
  34. twoList: [
  35. {
  36. reductionPrice: 90, //满减
  37. goodsName: "此处显示商品名称",
  38. describeName: "此处显示商品描述",
  39. price: 79.99, //折扣价
  40. original: 159.99, //原价
  41. inventoryNumber: 20,//库存
  42. time: 0.1 * 60 * 1000,
  43. buy: "购买",
  44. },
  45. {
  46. reductionPrice: 90, //满减
  47. goodsName: "此处显示商品名称",
  48. describeName: "此处显示商品描述",
  49. price: 79.99, //折扣价
  50. original: 159.99, //原价
  51. inventoryNumber: 20,//库存
  52. time: 0.1 * 60 * 1000,
  53. buy: "购买",
  54. }
  55. ],
  56. threeList: [
  57. {
  58. goodsName: "此处显示商品名称",
  59. describeName: "此处显示商品描述",
  60. price: 79.99, //折扣价
  61. original: 159.99, //原价
  62. inventoryNumber: 20,//库存
  63. buy: "购买",
  64. },
  65. {
  66. goodsName: "此处显示商品名称",
  67. describeName: "此处显示商品描述",
  68. price: 79.99, //折扣价
  69. original: 159.99, //原价
  70. inventoryNumber: 20,//库存
  71. buy: "购买",
  72. },
  73. {
  74. goodsName: "此处显示商品名称",
  75. describeName: "此处显示商品描述",
  76. price: 79.99, //折扣价
  77. original: 159.99, //原价
  78. inventoryNumber: 20,//库存
  79. buy: "购买",
  80. }
  81. ],
  82. fourList: [
  83. {
  84. reductionPrice: 90, //满减
  85. goodsName: "此处显示商品名称",
  86. describeName: "此处显示商品描述",
  87. price: 79.99, //折扣价
  88. original: 159.99, //原价
  89. inventoryNumber: 20,//库存
  90. time: 0.1 * 60 * 1000,
  91. buy: "购买",
  92. },
  93. ],
  94. fiveList: [
  95. {
  96. goodsName: "此处显示商品名称",
  97. describeName: "此处显示商品描述",
  98. price: 79.99, //折扣价
  99. original: 159.99, //原价
  100. inventoryNumber: 20,//库存
  101. buy: "购买",
  102. },
  103. {
  104. goodsName: "此处显示商品名称",
  105. describeName: "此处显示商品描述",
  106. price: 79.99, //折扣价
  107. original: 159.99, //原价
  108. inventoryNumber: 20,//库存
  109. buy: "购买",
  110. },
  111. {
  112. goodsName: "此处显示商品名称",
  113. describeName: "此处显示商品描述",
  114. price: 79.99, //折扣价
  115. original: 159.99, //原价
  116. inventoryNumber: 20,//库存
  117. buy: "购买",
  118. },
  119. {
  120. goodsName: "此处显示商品名称",
  121. describeName: "此处显示商品描述",
  122. price: 79.99, //折扣价
  123. original: 159.99, //原价
  124. inventoryNumber: 20,//库存
  125. buy: "购买",
  126. },
  127. {
  128. goodsName: "此处显示商品名称",
  129. describeName: "此处显示商品描述",
  130. price: 79.99, //折扣价
  131. original: 159.99, //原价
  132. inventoryNumber: 20,//库存
  133. buy: "购买",
  134. },
  135. ],
  136. style: {
  137. countDown: "white",
  138. countDownFontSize: 10,
  139. countDownPadding:"0 5rpx",
  140. background: "#f6f6f6",
  141. secondsKillFontSize: 17,
  142. secondsKillWeight: 700,
  143. secondsKillColor: "white",
  144. tiemBackground: "#FF3422",
  145. describeFontSize: 13,
  146. describeColor: "#a39799",
  147. reductionFontSize: 12,
  148. reductionColor: "red",
  149. reductionBackground: "#ffecec",
  150. goodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
  151. goodsTitleSize: 14,
  152. goodsTitleWieght: 350,
  153. oneInventorySizeFont: 13,
  154. oneInventoryColor: "#a39799",
  155. discountFontSize: 18,
  156. discountWeight: 250,
  157. discountColor: "red",
  158. originalFontSize: 13,
  159. originalWeight: 249,
  160. originalColor: "#c8c9cc",
  161. //购买按钮
  162. buyFontSize: 14,
  163. buyWeight: 500,
  164. buyColor: "red",
  165. twoBackground: "#f6f6f6",
  166. twoSecondsKillFontSize: 12,
  167. twoSecondsKillWeight: 700,
  168. twoSecondsKillColor: "white",
  169. twoTiemBackground: "#FF3422",
  170. twoDescribeFontSize: 13,
  171. twoDescribeColor: "#a39799",
  172. twoReductionPrice: 90,
  173. twoReductionFontSize: 12,
  174. twoReductionColor: "red",
  175. twoReductionBackground: "#ffecec",
  176. twoDiscountPrice: 159.99, //折扣价格
  177. twoOriginalPrice: 79.99, //原价价格
  178. twoGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
  179. twoGoodsTitleSize: 15,
  180. twoGoodsTitleWieght: 300,
  181. twoInventorySizeFont: 13,
  182. twoInventoryColor: "#a39799",
  183. twoDiscountFontSize: 16,
  184. twoDiscountWeight: 249,
  185. twoDiscountColor: "red",
  186. twoOriginalFontSize: 12,
  187. twoOriginalWeight: 249,
  188. twoOriginalColor: "#c8c9cc",
  189. //购买按钮
  190. twoBuyWidth: 35,
  191. twoBuyPadding: 3,
  192. twoBuyFontSize: 12,
  193. twoBuyWeight: 249,
  194. twoBuyColor: "red",
  195. twoBuyBorder: "1rpx solid red",
  196. threeBackground: "#f6f6f6",
  197. threeDescribeFontSize: 12,
  198. threeDescribeColor: "#a39799",
  199. threeDescribeMarginBottom: 5,
  200. threeReductionHeight: 17, //满减高度
  201. threeReductionPrice: 90.00,
  202. threeReductionFontSize: 12,
  203. threeReductionColor: "red",
  204. threeReductionBackground: "#ffecec",
  205. threeReductionBorderRadius: 17,
  206. threeReductionMarginRight: 5,
  207. threeDiscountPrice: 59.99, //折扣价格
  208. threeOriginalPrice: 79.99, //原价价格
  209. threeGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
  210. threeGoodsTitleSize: 12,
  211. threeGoodsTitleWieght: 350,
  212. threeInventoryNumber: 10, //库存总数量
  213. threeInventorySizeFont: 12,
  214. threeInventoryColor: "#a39799",
  215. threeDiscountFontSize: 14,
  216. threeDiscountWeight: 249,
  217. threeDiscountColor: "red",
  218. threeOriginalFontSize: 10,
  219. threeOriginalWeight: 249,
  220. threeOriginalColor: "#c8c9cc",
  221. //购买按钮
  222. threeBuyFontSize: 12,
  223. threeBuyWeight: 249,
  224. threeBuyColor: "white",
  225. threeBuyBackground: "#ffa400",
  226. detailsBackground: "#f6f6f6",
  227. detailSecondsKillFontSize: 12,
  228. detailSecondsKillWeight: 700,
  229. detailSecondsKillColor: "white",
  230. detailsTiemBackground: "#FF3422",
  231. detailsDescribeFontSize: 12,
  232. detailsDescribeColor: "#a39799",
  233. detailsReductionFontSize: 12,
  234. detailsReductionColor: "red",
  235. detailsReductionBackground: "#ffecec",
  236. detailsGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
  237. detailsGoodsTitleSize: 13,
  238. detailsGoodsTitleWieght: 300,
  239. detailsInventorySizeFont: 12,
  240. detailsInventoryColor: "#a39799",
  241. detailsDiscountFontSize: 16,
  242. detailsDiscountWeight: 249,
  243. detailsDiscountColor: "red",
  244. detailsOriginalFontSize: 12,
  245. detailsOriginalWeight: 249,
  246. detailOriginalColor: "#c8c9cc",
  247. //购买按钮
  248. detailsBuyFontSize: 12,
  249. detailsBuyWeight: 249,
  250. detailsBuyColor: "red",
  251. fiveBackground: "#f6f6f6",
  252. fiveInventorySizeFont: 12,
  253. fiveInventoryColor: "#a39799",
  254. fiveGoodsImg: "https://file-cloud.fmode.cn/nCCirOU5zn/20211225/9r16pe035115.jpg",
  255. fiveGoodsTitleSize: 14,
  256. fiveDescribeFontSize: 12,
  257. fiveDescribeColor: "#a39799",
  258. fiveDiscountFontSize: 14,
  259. fiveDiscountWeight: 249,
  260. fiveDiscountColor: "red",
  261. fiveGoodsTitleWieght: 350,
  262. fiveOriginalFontSize: 10,
  263. fiveOriginalWeight: 249,
  264. fiveOriginalColor: "#c8c9cc",
  265. //购买按钮
  266. fiveBuyBackground: "#ffa400",
  267. fiveBuyFontSize: 12,
  268. fiveBuyWeight: 249,
  269. fiveBuyColor: "white",
  270. },
  271. },
  272. ready: function () {
  273. // 在组件布局完成后执行,确保options参数中有data信息
  274. this.loadData()
  275. },
  276. lifetimes: {
  277. attached: function () { }
  278. },
  279. /**
  280. * 组件的方法列表
  281. */
  282. methods: {
  283. onChange(e) {
  284. this.setData({
  285. timeData: e.detail,
  286. });
  287. },
  288. async loadData(){
  289. await Nova.checkComponentsDataProperties(this);
  290. console.log(this.data.options)
  291. let list = await Nova.getBlockData(this.data.options.data);
  292. let { options } = this.data;
  293. console.log('秒杀', options);
  294. console.log(list);
  295. let {
  296. data,
  297. column,
  298. src,
  299. style,
  300. } = options
  301. let { className, filter } = data;
  302. this.setData({
  303. list,
  304. column,
  305. style,
  306. className,
  307. filter
  308. })
  309. console.log(this.data.column)
  310. }
  311. }
  312. })