Sku.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import Vue from 'vue';
  3. import Popup from '../popup';
  4. import Toast from '../toast';
  5. import ImagePreview from '../image-preview';
  6. import SkuHeader from './components/SkuHeader';
  7. import SkuHeaderItem from './components/SkuHeaderItem';
  8. import SkuRow from './components/SkuRow';
  9. import SkuRowItem from './components/SkuRowItem';
  10. import SkuRowPropItem from './components/SkuRowPropItem';
  11. import SkuStepper from './components/SkuStepper';
  12. import SkuMessages from './components/SkuMessages';
  13. import SkuActions from './components/SkuActions';
  14. import { createNamespace, isEmpty } from '../utils';
  15. import { isAllSelected, isSkuChoosable, getSkuComb, getSelectedSkuValues, getSelectedPropValues, getSelectedProperties } from './utils/sku-helper';
  16. import { LIMIT_TYPE, UNSELECTED_SKU_VALUE_ID } from './constants';
  17. var namespace = createNamespace('sku');
  18. var createComponent = namespace[0],
  19. bem = namespace[1],
  20. t = namespace[2];
  21. var QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
  22. export default createComponent({
  23. props: {
  24. sku: Object,
  25. goods: Object,
  26. value: Boolean,
  27. buyText: String,
  28. goodsId: [Number, String],
  29. priceTag: String,
  30. lazyLoad: Boolean,
  31. hideStock: Boolean,
  32. properties: Array,
  33. addCartText: String,
  34. stepperTitle: String,
  35. getContainer: [String, Function],
  36. hideQuotaText: Boolean,
  37. hideSelectedText: Boolean,
  38. resetStepperOnHide: Boolean,
  39. customSkuValidator: Function,
  40. disableStepperInput: Boolean,
  41. resetSelectedSkuOnHide: Boolean,
  42. quota: {
  43. type: Number,
  44. default: 0
  45. },
  46. quotaUsed: {
  47. type: Number,
  48. default: 0
  49. },
  50. startSaleNum: {
  51. type: Number,
  52. default: 1
  53. },
  54. initialSku: {
  55. type: Object,
  56. default: function _default() {
  57. return {};
  58. }
  59. },
  60. stockThreshold: {
  61. type: Number,
  62. default: 50
  63. },
  64. showSoldoutSku: {
  65. type: Boolean,
  66. default: true
  67. },
  68. showAddCartBtn: {
  69. type: Boolean,
  70. default: true
  71. },
  72. disableSoldoutSku: {
  73. type: Boolean,
  74. default: true
  75. },
  76. customStepperConfig: {
  77. type: Object,
  78. default: function _default() {
  79. return {};
  80. }
  81. },
  82. showHeaderImage: {
  83. type: Boolean,
  84. default: true
  85. },
  86. previewOnClickImage: {
  87. type: Boolean,
  88. default: true
  89. },
  90. safeAreaInsetBottom: {
  91. type: Boolean,
  92. default: true
  93. },
  94. closeOnClickOverlay: {
  95. type: Boolean,
  96. default: true
  97. },
  98. bodyOffsetTop: {
  99. type: Number,
  100. default: 200
  101. },
  102. messageConfig: {
  103. type: Object,
  104. default: function _default() {
  105. return {
  106. initialMessages: {},
  107. placeholderMap: {},
  108. uploadImg: function uploadImg() {
  109. return Promise.resolve();
  110. },
  111. uploadMaxSize: 5
  112. };
  113. }
  114. }
  115. },
  116. data: function data() {
  117. return {
  118. selectedSku: {},
  119. selectedProp: {},
  120. selectedNum: 1,
  121. show: this.value
  122. };
  123. },
  124. watch: {
  125. show: function show(val) {
  126. this.$emit('input', val);
  127. if (!val) {
  128. this.$emit('sku-close', {
  129. selectedSkuValues: this.selectedSkuValues,
  130. selectedNum: this.selectedNum,
  131. selectedSkuComb: this.selectedSkuComb
  132. });
  133. if (this.resetStepperOnHide) {
  134. this.resetStepper();
  135. }
  136. if (this.resetSelectedSkuOnHide) {
  137. this.resetSelectedSku();
  138. }
  139. }
  140. },
  141. value: function value(val) {
  142. this.show = val;
  143. },
  144. skuTree: 'resetSelectedSku',
  145. initialSku: function initialSku() {
  146. this.resetStepper();
  147. this.resetSelectedSku();
  148. }
  149. },
  150. computed: {
  151. skuGroupClass: function skuGroupClass() {
  152. return ['van-sku-group-container', {
  153. 'van-sku-group-container--hide-soldout': !this.showSoldoutSku
  154. }];
  155. },
  156. bodyStyle: function bodyStyle() {
  157. if (this.$isServer) {
  158. return;
  159. }
  160. var maxHeight = window.innerHeight - this.bodyOffsetTop;
  161. return {
  162. maxHeight: maxHeight + 'px'
  163. };
  164. },
  165. isSkuCombSelected: function isSkuCombSelected() {
  166. var _this = this;
  167. // SKU 未选完
  168. if (this.hasSku && !isAllSelected(this.skuTree, this.selectedSku)) {
  169. return false;
  170. } // 属性未全选
  171. return !this.propList.filter(function (i) {
  172. return i.is_necessary !== false;
  173. }).some(function (i) {
  174. return (_this.selectedProp[i.k_id] || []).length === 0;
  175. });
  176. },
  177. isSkuEmpty: function isSkuEmpty() {
  178. return Object.keys(this.sku).length === 0;
  179. },
  180. hasSku: function hasSku() {
  181. return !this.sku.none_sku;
  182. },
  183. hasSkuOrAttr: function hasSkuOrAttr() {
  184. return this.hasSku || this.propList.length > 0;
  185. },
  186. selectedSkuComb: function selectedSkuComb() {
  187. var skuComb = null;
  188. if (this.isSkuCombSelected) {
  189. if (this.hasSku) {
  190. skuComb = getSkuComb(this.skuList, this.selectedSku);
  191. } else {
  192. skuComb = {
  193. id: this.sku.collection_id,
  194. price: Math.round(this.sku.price * 100),
  195. stock_num: this.sku.stock_num
  196. };
  197. }
  198. if (skuComb) {
  199. skuComb.properties = getSelectedProperties(this.propList, this.selectedProp);
  200. skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
  201. return acc + (cur.price || 0);
  202. }, 0);
  203. }
  204. }
  205. return skuComb;
  206. },
  207. selectedSkuValues: function selectedSkuValues() {
  208. return getSelectedSkuValues(this.skuTree, this.selectedSku);
  209. },
  210. selectedPropValues: function selectedPropValues() {
  211. return getSelectedPropValues(this.propList, this.selectedProp);
  212. },
  213. price: function price() {
  214. if (this.selectedSkuComb) {
  215. return ((this.selectedSkuComb.price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  216. } // sku.price是一个格式化好的价格区间
  217. return this.sku.price;
  218. },
  219. originPrice: function originPrice() {
  220. if (this.selectedSkuComb && this.selectedSkuComb.origin_price) {
  221. return ((this.selectedSkuComb.origin_price + this.selectedSkuComb.property_price) / 100).toFixed(2);
  222. }
  223. return this.sku.origin_price;
  224. },
  225. skuTree: function skuTree() {
  226. return this.sku.tree || [];
  227. },
  228. skuList: function skuList() {
  229. return this.sku.list || [];
  230. },
  231. propList: function propList() {
  232. return this.properties || [];
  233. },
  234. imageList: function imageList() {
  235. var imageList = [this.goods.picture];
  236. if (this.skuTree.length > 0) {
  237. this.skuTree.forEach(function (treeItem) {
  238. if (!treeItem.v) {
  239. return;
  240. }
  241. treeItem.v.forEach(function (vItem) {
  242. var imgUrl = vItem.previewImgUrl || vItem.imgUrl || vItem.img_url;
  243. if (imgUrl && imageList.indexOf(imgUrl) === -1) {
  244. imageList.push(imgUrl);
  245. }
  246. });
  247. });
  248. }
  249. return imageList;
  250. },
  251. stock: function stock() {
  252. var stockNum = this.customStepperConfig.stockNum;
  253. if (stockNum !== undefined) {
  254. return stockNum;
  255. }
  256. if (this.selectedSkuComb) {
  257. return this.selectedSkuComb.stock_num;
  258. }
  259. return this.sku.stock_num;
  260. },
  261. stockText: function stockText() {
  262. var h = this.$createElement;
  263. var stockFormatter = this.customStepperConfig.stockFormatter;
  264. if (stockFormatter) {
  265. return stockFormatter(this.stock);
  266. }
  267. return [t('stock') + " ", h("span", {
  268. "class": bem('stock-num', {
  269. highlight: this.stock < this.stockThreshold
  270. })
  271. }, [this.stock]), " " + t('stockUnit')];
  272. },
  273. selectedText: function selectedText() {
  274. var _this2 = this;
  275. if (this.selectedSkuComb) {
  276. var values = this.selectedSkuValues.concat(this.selectedPropValues);
  277. return t('selected') + " " + values.map(function (item) {
  278. return item.name;
  279. }).join(' ');
  280. }
  281. var unselectedSku = this.skuTree.filter(function (item) {
  282. return _this2.selectedSku[item.k_s] === UNSELECTED_SKU_VALUE_ID;
  283. }).map(function (item) {
  284. return item.k;
  285. });
  286. var unselectedProp = this.propList.filter(function (item) {
  287. return (_this2.selectedProp[item.k_id] || []).length < 1;
  288. }).map(function (item) {
  289. return item.k;
  290. });
  291. return t('select') + " " + unselectedSku.concat(unselectedProp).join(' ');
  292. }
  293. },
  294. created: function created() {
  295. var skuEventBus = new Vue();
  296. this.skuEventBus = skuEventBus;
  297. skuEventBus.$on('sku:select', this.onSelect);
  298. skuEventBus.$on('sku:propSelect', this.onPropSelect);
  299. skuEventBus.$on('sku:numChange', this.onNumChange);
  300. skuEventBus.$on('sku:previewImage', this.onPreviewImage);
  301. skuEventBus.$on('sku:overLimit', this.onOverLimit);
  302. skuEventBus.$on('sku:stepperState', this.onStepperState);
  303. skuEventBus.$on('sku:addCart', this.onAddCart);
  304. skuEventBus.$on('sku:buy', this.onBuy);
  305. this.resetStepper();
  306. this.resetSelectedSku(); // 组件初始化后的钩子,抛出skuEventBus
  307. this.$emit('after-sku-create', skuEventBus);
  308. },
  309. methods: {
  310. resetStepper: function resetStepper() {
  311. var skuStepper = this.$refs.skuStepper;
  312. var selectedNum = this.initialSku.selectedNum;
  313. var num = selectedNum != null ? selectedNum : this.startSaleNum; // 用来缓存不合法的情况
  314. this.stepperError = null;
  315. if (skuStepper) {
  316. skuStepper.setCurrentNum(num);
  317. } else {
  318. // 当首次加载(skuStepper 为空)时,传入数量如果不合法,可能会存在问题
  319. this.selectedNum = num;
  320. }
  321. },
  322. // @exposed-api
  323. resetSelectedSku: function resetSelectedSku() {
  324. var _this3 = this;
  325. this.selectedSku = {}; // 重置 selectedSku
  326. this.skuTree.forEach(function (item) {
  327. _this3.selectedSku[item.k_s] = UNSELECTED_SKU_VALUE_ID;
  328. });
  329. this.skuTree.forEach(function (item) {
  330. var key = item.k_s; // 规格值只有1个时,优先判断
  331. var valueId = item.v.length === 1 ? item.v[0].id : _this3.initialSku[key];
  332. if (valueId && isSkuChoosable(_this3.skuList, _this3.selectedSku, {
  333. key: key,
  334. valueId: valueId
  335. })) {
  336. _this3.selectedSku[key] = valueId;
  337. }
  338. });
  339. var skuValues = this.selectedSkuValues;
  340. if (skuValues.length > 0) {
  341. this.$nextTick(function () {
  342. _this3.$emit('sku-selected', {
  343. skuValue: skuValues[skuValues.length - 1],
  344. selectedSku: _this3.selectedSku,
  345. selectedSkuComb: _this3.selectedSkuComb
  346. });
  347. });
  348. } // 重置商品属性
  349. this.selectedProp = {};
  350. var _this$initialSku$sele = this.initialSku.selectedProp,
  351. selectedProp = _this$initialSku$sele === void 0 ? {} : _this$initialSku$sele; // 选中外部传入信息
  352. this.propList.forEach(function (item) {
  353. if (selectedProp[item.k_id]) {
  354. _this3.selectedProp[item.k_id] = selectedProp[item.k_id];
  355. }
  356. });
  357. if (isEmpty(this.selectedProp)) {
  358. this.propList.forEach(function (item) {
  359. var _item$v;
  360. // 没有加价的属性,默认选中第一个
  361. if ((item == null ? void 0 : (_item$v = item.v) == null ? void 0 : _item$v.length) > 0) {
  362. var v = item.v,
  363. k_id = item.k_id;
  364. var isHasConfigPrice = v.some(function (i) {
  365. return +i.price !== 0;
  366. });
  367. if (!isHasConfigPrice) {
  368. _this3.selectedProp[k_id] = [v[0].id];
  369. }
  370. }
  371. });
  372. }
  373. var propValues = this.selectedPropValues;
  374. if (propValues.length > 0) {
  375. this.$emit('sku-prop-selected', {
  376. propValue: propValues[propValues.length - 1],
  377. selectedProp: this.selectedProp,
  378. selectedSkuComb: this.selectedSkuComb
  379. });
  380. } // 抛出重置事件
  381. this.$emit('sku-reset', {
  382. selectedSku: this.selectedSku,
  383. selectedProp: this.selectedProp,
  384. selectedSkuComb: this.selectedSkuComb
  385. });
  386. this.centerInitialSku();
  387. },
  388. getSkuMessages: function getSkuMessages() {
  389. return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
  390. },
  391. getSkuCartMessages: function getSkuCartMessages() {
  392. return this.$refs.skuMessages ? this.$refs.skuMessages.getCartMessages() : {};
  393. },
  394. validateSkuMessages: function validateSkuMessages() {
  395. return this.$refs.skuMessages ? this.$refs.skuMessages.validateMessages() : '';
  396. },
  397. validateSku: function validateSku() {
  398. if (this.selectedNum === 0) {
  399. return t('unavailable');
  400. }
  401. if (this.isSkuCombSelected) {
  402. return this.validateSkuMessages();
  403. } // 自定义sku校验
  404. if (this.customSkuValidator) {
  405. var err = this.customSkuValidator(this);
  406. if (err) return err;
  407. }
  408. return t('selectSku');
  409. },
  410. onSelect: function onSelect(skuValue) {
  411. var _extends2, _extends3;
  412. // 点击已选中的sku时则取消选中
  413. this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3));
  414. this.$emit('sku-selected', {
  415. skuValue: skuValue,
  416. selectedSku: this.selectedSku,
  417. selectedSkuComb: this.selectedSkuComb
  418. });
  419. },
  420. onPropSelect: function onPropSelect(propValue) {
  421. var _extends4;
  422. var arr = this.selectedProp[propValue.skuKeyStr] || [];
  423. var pos = arr.indexOf(propValue.id);
  424. if (pos > -1) {
  425. arr.splice(pos, 1);
  426. } else if (propValue.multiple) {
  427. arr.push(propValue.id);
  428. } else {
  429. arr.splice(0, 1, propValue.id);
  430. }
  431. this.selectedProp = _extends({}, this.selectedProp, (_extends4 = {}, _extends4[propValue.skuKeyStr] = arr, _extends4));
  432. this.$emit('sku-prop-selected', {
  433. propValue: propValue,
  434. selectedProp: this.selectedProp,
  435. selectedSkuComb: this.selectedSkuComb
  436. });
  437. },
  438. onNumChange: function onNumChange(num) {
  439. this.selectedNum = num;
  440. },
  441. onPreviewImage: function onPreviewImage(selectedValue) {
  442. var _this4 = this;
  443. var imageList = this.imageList;
  444. var index = 0;
  445. var indexImage = imageList[0];
  446. if (selectedValue && selectedValue.imgUrl) {
  447. this.imageList.some(function (image, pos) {
  448. if (image === selectedValue.imgUrl) {
  449. index = pos;
  450. return true;
  451. }
  452. return false;
  453. });
  454. indexImage = selectedValue.imgUrl;
  455. }
  456. var params = _extends({}, selectedValue, {
  457. index: index,
  458. imageList: this.imageList,
  459. indexImage: indexImage
  460. });
  461. this.$emit('open-preview', params);
  462. if (!this.previewOnClickImage) {
  463. return;
  464. }
  465. ImagePreview({
  466. images: this.imageList,
  467. startPosition: index,
  468. onClose: function onClose() {
  469. _this4.$emit('close-preview', params);
  470. }
  471. });
  472. },
  473. onOverLimit: function onOverLimit(data) {
  474. var action = data.action,
  475. limitType = data.limitType,
  476. quota = data.quota,
  477. quotaUsed = data.quotaUsed;
  478. var handleOverLimit = this.customStepperConfig.handleOverLimit;
  479. if (handleOverLimit) {
  480. handleOverLimit(data);
  481. return;
  482. }
  483. if (action === 'minus') {
  484. if (this.startSaleNum > 1) {
  485. Toast(t('minusStartTip', this.startSaleNum));
  486. } else {
  487. Toast(t('minusTip'));
  488. }
  489. } else if (action === 'plus') {
  490. if (limitType === QUOTA_LIMIT) {
  491. if (quotaUsed > 0) {
  492. Toast(t('quotaUsedTip', quota, quotaUsed));
  493. } else {
  494. Toast(t('quotaTip', quota));
  495. }
  496. } else {
  497. Toast(t('soldout'));
  498. }
  499. }
  500. },
  501. onStepperState: function onStepperState(data) {
  502. this.stepperError = data.valid ? null : _extends({}, data, {
  503. action: 'plus'
  504. });
  505. },
  506. onAddCart: function onAddCart() {
  507. this.onBuyOrAddCart('add-cart');
  508. },
  509. onBuy: function onBuy() {
  510. this.onBuyOrAddCart('buy-clicked');
  511. },
  512. onBuyOrAddCart: function onBuyOrAddCart(type) {
  513. // sku 不符合购买条件
  514. if (this.stepperError) {
  515. return this.onOverLimit(this.stepperError);
  516. }
  517. var error = this.validateSku();
  518. if (error) {
  519. Toast(error);
  520. } else {
  521. this.$emit(type, this.getSkuData());
  522. }
  523. },
  524. // @exposed-api
  525. getSkuData: function getSkuData() {
  526. return {
  527. goodsId: this.goodsId,
  528. messages: this.getSkuMessages(),
  529. selectedNum: this.selectedNum,
  530. cartMessages: this.getSkuCartMessages(),
  531. selectedSkuComb: this.selectedSkuComb
  532. };
  533. },
  534. // 当 popup 完全打开后执行
  535. onOpened: function onOpened() {
  536. this.centerInitialSku();
  537. },
  538. centerInitialSku: function centerInitialSku() {
  539. var _this5 = this;
  540. (this.$refs.skuRows || []).forEach(function (it) {
  541. var _ref = it.skuRow || {},
  542. k_s = _ref.k_s;
  543. it.centerItem(_this5.initialSku[k_s]);
  544. });
  545. }
  546. },
  547. render: function render() {
  548. var _this6 = this;
  549. var h = arguments[0];
  550. if (this.isSkuEmpty) {
  551. return;
  552. }
  553. var sku = this.sku,
  554. skuList = this.skuList,
  555. goods = this.goods,
  556. price = this.price,
  557. lazyLoad = this.lazyLoad,
  558. originPrice = this.originPrice,
  559. skuEventBus = this.skuEventBus,
  560. selectedSku = this.selectedSku,
  561. selectedProp = this.selectedProp,
  562. selectedNum = this.selectedNum,
  563. stepperTitle = this.stepperTitle,
  564. selectedSkuComb = this.selectedSkuComb,
  565. showHeaderImage = this.showHeaderImage,
  566. disableSoldoutSku = this.disableSoldoutSku;
  567. var slotsProps = {
  568. price: price,
  569. originPrice: originPrice,
  570. selectedNum: selectedNum,
  571. skuEventBus: skuEventBus,
  572. selectedSku: selectedSku,
  573. selectedSkuComb: selectedSkuComb
  574. };
  575. var slots = function slots(name) {
  576. return _this6.slots(name, slotsProps);
  577. };
  578. var Header = slots('sku-header') || h(SkuHeader, {
  579. "attrs": {
  580. "sku": sku,
  581. "goods": goods,
  582. "skuEventBus": skuEventBus,
  583. "selectedSku": selectedSku,
  584. "showHeaderImage": showHeaderImage
  585. }
  586. }, [h("template", {
  587. "slot": "sku-header-image-extra"
  588. }, [slots('sku-header-image-extra')]), slots('sku-header-price') || h("div", {
  589. "class": "van-sku__goods-price"
  590. }, [h("span", {
  591. "class": "van-sku__price-symbol"
  592. }, ["\uFFE5"]), h("span", {
  593. "class": "van-sku__price-num"
  594. }, [price]), this.priceTag && h("span", {
  595. "class": "van-sku__price-tag"
  596. }, [this.priceTag])]), slots('sku-header-origin-price') || originPrice && h(SkuHeaderItem, [t('originPrice'), " \uFFE5", originPrice]), !this.hideStock && h(SkuHeaderItem, [h("span", {
  597. "class": "van-sku__stock"
  598. }, [this.stockText])]), this.hasSkuOrAttr && !this.hideSelectedText && h(SkuHeaderItem, [this.selectedText]), slots('sku-header-extra')]);
  599. var Group = slots('sku-group') || this.hasSkuOrAttr && h("div", {
  600. "class": this.skuGroupClass
  601. }, [this.skuTree.map(function (skuTreeItem) {
  602. return h(SkuRow, {
  603. "attrs": {
  604. "skuRow": skuTreeItem
  605. },
  606. "ref": "skuRows",
  607. "refInFor": true
  608. }, [skuTreeItem.v.map(function (skuValue) {
  609. return h(SkuRowItem, {
  610. "attrs": {
  611. "skuList": skuList,
  612. "lazyLoad": lazyLoad,
  613. "skuValue": skuValue,
  614. "skuKeyStr": skuTreeItem.k_s,
  615. "selectedSku": selectedSku,
  616. "skuEventBus": skuEventBus,
  617. "disableSoldoutSku": disableSoldoutSku,
  618. "largeImageMode": skuTreeItem.largeImageMode
  619. }
  620. });
  621. })]);
  622. }), this.propList.map(function (skuTreeItem) {
  623. return h(SkuRow, {
  624. "attrs": {
  625. "skuRow": skuTreeItem
  626. }
  627. }, [skuTreeItem.v.map(function (skuValue) {
  628. return h(SkuRowPropItem, {
  629. "attrs": {
  630. "skuValue": skuValue,
  631. "skuKeyStr": skuTreeItem.k_id + '',
  632. "selectedProp": selectedProp,
  633. "skuEventBus": skuEventBus,
  634. "multiple": skuTreeItem.is_multiple
  635. }
  636. });
  637. })]);
  638. })]);
  639. var Stepper = slots('sku-stepper') || h(SkuStepper, {
  640. "ref": "skuStepper",
  641. "attrs": {
  642. "stock": this.stock,
  643. "quota": this.quota,
  644. "quotaUsed": this.quotaUsed,
  645. "startSaleNum": this.startSaleNum,
  646. "skuEventBus": skuEventBus,
  647. "selectedNum": selectedNum,
  648. "stepperTitle": stepperTitle,
  649. "skuStockNum": sku.stock_num,
  650. "disableStepperInput": this.disableStepperInput,
  651. "customStepperConfig": this.customStepperConfig,
  652. "hideQuotaText": this.hideQuotaText
  653. },
  654. "on": {
  655. "change": function change(event) {
  656. _this6.$emit('stepper-change', event);
  657. }
  658. }
  659. });
  660. var Messages = slots('sku-messages') || h(SkuMessages, {
  661. "ref": "skuMessages",
  662. "attrs": {
  663. "goodsId": this.goodsId,
  664. "messageConfig": this.messageConfig,
  665. "messages": sku.messages
  666. }
  667. });
  668. var Actions = slots('sku-actions') || h(SkuActions, {
  669. "attrs": {
  670. "buyText": this.buyText,
  671. "skuEventBus": skuEventBus,
  672. "addCartText": this.addCartText,
  673. "showAddCartBtn": this.showAddCartBtn
  674. }
  675. });
  676. return h(Popup, {
  677. "attrs": {
  678. "round": true,
  679. "closeable": true,
  680. "position": "bottom",
  681. "getContainer": this.getContainer,
  682. "closeOnClickOverlay": this.closeOnClickOverlay,
  683. "safeAreaInsetBottom": this.safeAreaInsetBottom
  684. },
  685. "class": "van-sku-container",
  686. "on": {
  687. "opened": this.onOpened
  688. },
  689. "model": {
  690. value: _this6.show,
  691. callback: function callback($$v) {
  692. _this6.show = $$v;
  693. }
  694. }
  695. }, [Header, h("div", {
  696. "class": "van-sku-body",
  697. "style": this.bodyStyle
  698. }, [slots('sku-body-top'), Group, slots('extra-sku-group'), Stepper, Messages]), slots('sku-actions-top'), Actions]);
  699. }
  700. });