新增商品状态售罄,增加删除的库存限制

This commit is contained in:
gyq 2025-04-16 18:31:12 +08:00
parent 0a0f672a02
commit 694cb154a6
12 changed files with 137 additions and 27 deletions

View File

@ -5,10 +5,10 @@ ENV = development
# VITE_API_WSS = 'wss://sockets.sxczgkj.com/wss'
# 正式ws
VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
# VITE_API_WSS = 'wss://czgeatws.sxczgkj.com/wss'
# 本地ws
# VITE_API_WSS = 'ws://192.168.1.31:2348'
VITE_API_WSS = 'ws://192.168.1.31:2348'
# 正式 php
VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
@ -20,10 +20,10 @@ VITE_API_PHP_URL = 'https://newblockwlx.sxczgkj.cn/index.php/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 本地调试连接
# VITE_API_URL = 'http://192.168.1.31/'
VITE_API_URL = 'http://192.168.1.31/'
# 线上测试
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
# 线上正式
VITE_API_URL = 'https://cashier.sxczgkj.com'
# VITE_API_URL = 'https://cashier.sxczgkj.com'

View File

@ -0,0 +1,14 @@
<svg width="121" height="120" viewBox="0 0 121 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_5_38)">
<circle cx="60.2939" cy="60" r="58.5" stroke="white" stroke-width="3"/>
<circle cx="60.2938" cy="60" r="51.1997" stroke="white" stroke-width="2" stroke-dasharray="2 2"/>
<line x1="19.8277" y1="50.637" x2="82.4435" y2="27.8676" stroke="white"/>
<line x1="36.7388" y1="93.3029" x2="99.3547" y2="70.5335" stroke="white"/>
<path d="M22.4599 62.0201C23.1265 62.5176 23.7976 63.0902 24.4821 63.7599L32.6011 60.8049L33.2304 62.3625L16.5189 68.445L18.5688 73.5186C20.4655 78.4692 21.3126 82.6787 21.0559 86.1414L19.2488 85.4463C19.4643 82.4581 18.6888 78.6819 16.8999 74.126L14.2207 67.4948L22.7005 64.4084C22.0609 63.8499 21.4032 63.3746 20.7815 62.9883L22.4599 62.0201ZM22.7471 66.8928L24.4471 66.6825C24.4958 67.3794 24.5266 68.0319 24.5574 68.6843L33.3529 65.483L33.9193 66.8849L24.56 70.2914C24.5039 71.9454 24.3398 73.4601 24.0676 74.8353L28.285 73.3004L27.1971 70.6078L28.8209 70.0168L29.9088 72.7093L34.938 70.8789L35.5224 72.3253L30.4932 74.1558L31.5001 76.648L38.2433 74.1937L38.8367 75.6623L32.0935 78.1167L33.514 81.6326L31.8902 82.2236L30.4697 78.7077L22.3282 81.671L21.7348 80.2023L29.8763 77.239L28.8694 74.7468L22.9606 76.8974L22.0649 75.6409C22.4993 74.2831 22.7672 72.7051 22.846 70.9153L19.4405 72.1547L18.8741 70.7528L22.8659 69.2999C22.8353 68.5198 22.7957 67.7175 22.7471 66.8928ZM35.6949 60.0106L41.8292 57.7779C41.8077 56.8924 41.7637 56.015 41.6655 55.1319L43.3928 54.7329C43.464 55.5493 43.5261 56.3435 43.5658 57.1459L55.1127 52.9431L55.742 54.5008L43.5862 58.9252C43.5249 61.1426 43.1977 63.2781 42.6272 65.3235L47.2034 76.65L45.6247 77.2246L41.8217 67.8118C41.3876 68.9143 40.9129 69.9804 40.3616 71.0489L38.8343 70.1499C40.6237 66.7675 41.6063 63.2448 41.8045 59.5736L36.3242 61.5683L35.6949 60.0106ZM45.8068 68.1992L52.3471 65.8187L51.511 63.7492C52.5088 62.5693 53.394 61.3027 54.1711 59.8967L45.6913 62.9831L45.089 61.4922L55.6436 57.6506L56.246 59.1415C55.4777 60.6974 54.5335 62.2662 53.4045 63.8258L53.9709 65.2277L59.609 63.1756L60.2294 64.711L54.5912 66.7631L56.2905 70.9688C56.8209 72.2817 56.414 73.1955 55.0834 73.6798L52.2644 74.7059L51.2245 73.3487C52.0454 73.0754 52.9114 72.7858 53.836 72.4492C54.5126 72.203 54.7296 71.7156 54.4599 71.048L52.9674 67.3541L46.4272 69.7346L45.8068 68.1992ZM57.6942 50.7528L76.9993 43.7263L77.6286 45.284L70.2313 47.9764C70.194 49.0365 70.08 50.099 69.8894 51.1638L70.303 52.1874C74.7565 52.9658 78.7948 54.125 82.4178 55.6651L81.8432 57.3802C78.698 55.8704 75.0971 54.7051 70.9862 53.8786L75.967 66.2065L74.2981 66.8139L69.1555 54.0855C68.0785 57.4384 66.217 60.7705 63.5756 64.0291L61.9582 63.0352C65.9314 58.2709 68.0832 53.4803 68.4271 48.6331L58.3236 52.3105L57.6942 50.7528ZM82.9851 41.1903L97.1482 36.0354L100.205 43.6012L94.1383 45.8093L95.6308 49.5032L103.073 46.7944L103.702 48.3521L96.2601 51.0609L98.1391 55.7116C99.4425 55.4159 100.989 54.955 102.749 54.3147C104.44 53.6991 105.843 53.1374 106.989 52.6438L107.185 54.4102C105.809 54.9109 104.56 55.3401 103.446 55.7201C99.3998 57.1671 96.5271 57.8043 94.796 57.6176C93.2813 57.4542 91.6187 56.6044 89.8622 55.0741C89.8232 57.5387 89.4373 59.7211 88.6821 61.6296L87.1322 60.7388C88.2721 57.6694 88.4342 54.0369 87.5961 49.8496L89.2916 49.5643C89.5381 50.8784 89.7124 52.1423 89.8056 53.3335C91.7197 55.0617 93.4544 55.9618 95.0413 56.0478C95.4336 56.0582 95.8709 56.0522 96.3669 55.9993L92.492 46.4085L86.0419 48.7561L82.9851 41.1903ZM97.9473 42.6873L96.1222 38.17L85.2293 42.1347L87.0544 46.652L97.9473 42.6873Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_5_38">
<rect width="120" height="120" fill="white" transform="translate(0.293854)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,14 @@
<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2_36)">
<circle cx="60" cy="60" r="58.5" stroke="white" stroke-width="3"/>
<circle cx="60" cy="60" r="51.1997" stroke="white" stroke-width="2" stroke-dasharray="2 2"/>
<line x1="19.5338" y1="50.637" x2="82.1497" y2="27.8676" stroke="white"/>
<line x1="36.445" y1="93.3029" x2="99.0608" y2="70.5335" stroke="white"/>
<path d="M57.134 66.8373L60.6344 75.5009L58.4994 76.278L57.912 74.8242L41.9748 80.6248L42.5622 82.0786L40.4272 82.8557L36.9269 74.1921L57.134 66.8373ZM41.2076 78.7259L57.1448 72.9253L55.7423 69.4539L39.8051 75.2546L41.2076 78.7259ZM32.5035 63.2439C31.9245 64.8841 31.2192 66.468 30.3698 68.0364L28.8571 66.1707C30.8456 62.2138 31.8241 58.3182 31.7745 54.5246L34.0473 54.1738C34.046 55.1952 34.0028 56.1979 33.8994 57.2225L41.3568 54.5083C40.4981 53.6637 39.6574 52.9487 38.7805 52.3149L40.8618 51.149C41.7145 51.8936 42.5852 52.7679 43.4617 53.7421L52.2121 50.5573L52.9313 52.3374L43.79 55.6646L44.6651 57.8305L52.4833 54.9849L53.1666 56.6761L45.3484 59.5217L46.1875 61.5986L54.0659 58.7311L54.7491 60.4223L46.8708 63.2898L47.7698 65.515L57.3923 62.0127L58.1235 63.8226L35.9919 71.8779L32.5035 63.2439ZM45.6348 66.2921L44.7358 64.0669L36.4364 67.0876L37.3355 69.3128L45.6348 66.2921ZM44.0525 62.3757L43.2134 60.2988L34.914 63.3195L35.7531 65.3964L44.0525 62.3757ZM42.5301 58.6076L41.655 56.4417L33.5661 59.3858C33.5239 59.5373 33.4997 59.6482 33.4875 59.7888L34.2307 61.6283L42.5301 58.6076ZM56.4839 47.471L62.7084 45.2054L62.121 43.7516L64.2259 42.9855L64.8133 44.4393L69.8952 42.5897L70.5185 44.1325L65.4367 45.9821L66.0001 47.3766L70.27 45.8225L70.8454 47.2466L59.6593 51.318L59.0839 49.8939L63.8951 48.1427L63.3317 46.7483L57.1072 49.0138L56.4839 47.471ZM65.8022 52.0091L62.7651 53.1145L63.0168 53.7375C63.1607 54.0936 63.2864 54.4902 63.3701 54.8682L66.4974 53.7299L65.8022 52.0091ZM68.1212 53.1389L70.7674 52.1758L70.0721 50.4549L67.426 51.4181L68.1212 53.1389ZM63.615 56.2425C63.7454 57.7605 63.5032 59.21 62.8703 60.6315L60.9416 59.8701C61.7612 58.1424 61.8294 56.3478 61.0923 54.438L60.3131 52.5095L71.379 48.4818L73.1171 52.784L63.615 56.2425ZM71.9233 40.6944L79.1401 38.0676L80.0991 40.4412C80.2669 40.8566 80.5433 41.0283 80.9342 40.886L83.1894 40.0652L83.8128 41.608L81.1065 42.593C79.9037 43.0308 79.0505 42.6266 78.559 41.4102L78.0795 40.2234L74.2306 41.6243C74.5542 42.4254 74.6495 43.1735 74.5766 43.8466C74.4254 44.5823 74.0097 45.3462 73.3114 46.1789L71.635 45.5299C72.189 44.6816 72.4844 43.9615 72.5694 43.318C72.5942 42.6964 72.3788 41.8218 71.9233 40.6944ZM83.3605 42.7936L83.84 43.9804C83.6458 45.5486 82.9887 47.081 81.8387 48.5886C83.4017 48.5302 85.2234 48.3436 87.3038 48.0288L87.0971 49.9078C84.4457 50.2603 82.2093 50.3595 80.358 50.2166C79.0219 51.5197 77.3552 52.7729 75.358 53.9763L73.9227 52.729C75.6071 51.7756 77.0149 50.8208 78.1882 49.8832C76.5055 49.4747 75.1958 48.7942 74.2712 47.8716L73.0984 48.2984L72.4751 46.7556L83.3605 42.7936ZM75.925 47.2696C76.6817 47.9471 77.9255 48.3793 79.6446 48.5363C80.7641 47.3802 81.5169 46.2553 81.8789 45.1026L75.925 47.2696ZM68.9973 59.4905C68.6716 60.3918 68.2738 61.2853 67.8219 62.1304L65.6343 61.6674C66.8993 59.5054 67.5631 57.392 67.6858 55.3053L69.8683 54.9874C69.8194 55.7199 69.7283 56.4337 69.6134 57.0882L83.8967 51.8895L84.6639 53.7883L77.0862 56.5464L78.177 59.2463L89.6338 55.0764L90.401 56.9753L78.9442 61.1452L80.3468 64.6166L87.2328 62.1103L86.2619 59.707L88.3668 58.9409L90.5605 64.3705L88.4556 65.1366L87.988 63.9795L71.9907 69.802L72.4582 70.9591L70.3533 71.7253L68.1836 66.355L70.2885 65.5889L71.2355 67.9328L78.2118 65.3937L76.8093 61.9223L64.4204 66.4315L63.6532 64.5326L76.0421 60.0234L74.9512 57.3235L68.9973 59.4905Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_2_36">
<rect width="120" height="120" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,14 @@
<svg width="121" height="120" viewBox="0 0 121 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2_35)">
<circle cx="60.2939" cy="60" r="58.5" stroke="white" stroke-width="3"/>
<circle cx="60.2938" cy="60" r="51.1997" stroke="white" stroke-width="2" stroke-dasharray="2 2"/>
<line x1="19.8277" y1="50.637" x2="82.4435" y2="27.8676" stroke="white"/>
<line x1="36.7388" y1="93.3029" x2="99.3547" y2="70.5335" stroke="white"/>
<path d="M26.044 58.3135L28.1301 57.5543L29.6698 61.365L39.3392 57.8456L40.1259 59.7927L30.4565 63.3121L32.4456 68.2354L43.6092 64.1722L44.3958 66.1193L35.0929 69.5053C38.3977 72.3226 42.9265 74.2477 48.6624 75.3187L47.9721 77.6119C41.831 76.0184 36.9817 73.5399 33.4578 70.1004L33.2323 70.1825L38.3569 82.8664L36.2708 83.6257L31.1462 70.9418L30.8925 71.0341C30.7058 76.3346 28.8006 81.3035 25.1994 85.9962L23.2907 84.5532C26.8122 80.4638 28.8237 76.1582 29.3138 71.6087L19.9826 75.005L19.196 73.0579L30.3595 68.9947L28.3703 64.0714L18.8982 67.5189L18.1116 65.5718L27.5837 62.1243L26.044 58.3135ZM44.9692 53.2121L66.9298 45.2191L67.7165 47.1662L63.0086 48.8797L65.9867 56.2508L72.1605 54.0037L72.936 55.923L66.7622 58.1701L71.7407 70.4923L69.6828 71.2414L64.7042 58.9191L56.5571 61.8844C57.4609 64.8417 57.8806 67.401 57.799 69.6003C57.6718 72.3267 56.6263 74.7811 54.6624 76.9636L52.8662 75.6392C54.6327 73.5285 55.5541 71.2469 55.6021 68.8046C55.5422 66.9758 55.1727 64.9407 54.4992 62.6334L47.9871 65.0036L47.2117 63.0843L53.8365 60.6731C53.6904 60.3115 53.5837 59.9675 53.4714 59.6893L50.8866 53.2917L45.7559 55.1592L44.9692 53.2121ZM52.9727 52.5324L55.5575 58.93C55.6923 59.2638 55.799 59.6079 55.9226 59.9138L63.9288 56.9998L60.9507 49.6287L52.9727 52.5324ZM100.444 51.1754L103.725 59.2975L101.724 60.026L101.173 58.6631L86.2321 64.1012L86.7828 65.4641L84.7812 66.1927L81.4997 58.0705L100.444 51.1754ZM85.5128 62.321L100.454 56.8829L99.1391 53.6285L84.198 59.0666L85.5128 62.321ZM77.3528 47.8066C76.8099 49.3442 76.1488 50.8292 75.3524 52.2996L73.9343 50.5504C75.7985 46.8408 76.7158 43.1887 76.6693 39.6322L78.8 39.3034C78.7989 40.261 78.7583 41.201 78.6614 42.1616L85.6527 39.6169C84.8477 38.8251 84.0595 38.1548 83.2374 37.5607L85.1887 36.4676C85.9881 37.1657 86.8043 37.9853 87.626 38.8987L95.8295 35.9128L96.5038 37.5818L87.9338 40.701L88.7542 42.7315L96.0838 40.0638L96.7244 41.6493L89.3948 44.317L90.1815 46.2641L97.5675 43.5758L98.208 45.1613L90.8221 47.8496L91.6649 49.9358L100.686 46.6524L101.371 48.3491L80.6231 55.9009L77.3528 47.8066ZM89.6634 50.6643L88.8205 48.5781L81.0399 51.41L81.8827 53.4962L89.6634 50.6643ZM88.1799 46.9926L87.3933 45.0455L79.6126 47.8774L80.3993 49.8245L88.1799 46.9926ZM86.7527 43.46L85.9323 41.4295L78.349 44.1896C78.3094 44.3317 78.2867 44.4356 78.2753 44.5674L78.972 46.292L86.7527 43.46Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_2_35">
<rect width="120" height="120" fill="white" transform="translate(0.293854)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,14 @@
<svg width="121" height="121" viewBox="0 0 121 121" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2_37)">
<circle cx="60.706" cy="60.1438" r="58.5" stroke="white" stroke-width="3"/>
<circle cx="60.706" cy="60.1438" r="51.1997" stroke="white" stroke-width="2" stroke-dasharray="2 2"/>
<line x1="20.2398" y1="50.7807" x2="82.8557" y2="28.0114" stroke="white"/>
<line x1="37.151" y1="93.4466" x2="99.7668" y2="70.6773" stroke="white"/>
<path d="M41.9891 67.1295L24.2853 73.5732L27.6006 81.7788C28.095 83.0027 29.0019 83.4064 30.2987 82.9344L44.4505 77.7836C45.127 77.5373 45.6234 77.1652 45.9114 76.6775C46.273 75.9717 45.9202 74.0581 44.8531 70.9368L47.0737 70.8305C48.1854 74.3822 48.5377 76.615 48.1534 77.5845C47.7692 78.3943 46.9625 79.0389 45.8009 79.5255L30.5215 85.0867C28.2381 85.9178 26.6385 85.16 25.7169 82.8791L19.8169 68.276L21.8466 67.5372L23.5099 71.6539L39.1557 65.9593L36.2226 58.6994L17.4193 65.5433L16.6326 63.5962L37.4938 56.0033L41.9891 67.1295ZM43.6958 53.746L68.7574 44.6243L69.5553 46.5992L57.3205 51.0523L59.0175 55.2525C63.2099 55.7047 67.5711 56.4146 72.101 57.3821L71.6081 59.6035C66.8697 58.5204 62.9482 57.7781 59.8716 57.3664L66.2549 73.1657L64.1969 73.9147L55.2626 51.8013L44.4937 55.7209L43.6958 53.746ZM86.686 38.737L95.7634 35.4331L99.6406 45.0294L90.5631 48.3333L86.686 38.737ZM96.9649 43.9294L94.5487 37.949L89.3334 39.8473L91.7496 45.8276L96.9649 43.9294ZM75.9761 40.4016L77.9495 39.6834L78.9609 42.1868L84.4581 40.1859C86.3629 44.9805 87.2273 47.9203 87.0456 49.0712C86.8357 50.2324 86.04 51.0644 84.6305 51.5774C84.1795 51.7416 83.6495 51.8707 83.0069 52.0408L81.769 50.4174L83.432 49.9717C84.4357 49.5745 84.9379 48.9769 84.9389 48.1789C84.8947 47.4292 84.3052 45.5699 83.1815 42.6288L79.5167 43.9626C80.5827 48.0415 80.0148 51.5983 77.8133 54.633L75.791 53.8695C77.823 51.2155 78.4015 48.1653 77.5434 44.6809L73.4557 46.1687L72.759 44.4441L76.9876 42.905L75.9761 40.4016ZM77.6697 56.9187L88.8896 52.835L87.9793 50.5819L90.009 49.8431L90.9193 52.0962L102.167 48.0022L102.932 49.8937L93.5441 53.3104C96.3883 54.8277 100.451 55.6783 105.709 55.8065L104.996 58.0441C99.2876 57.4416 94.9159 56.0655 91.8527 53.9261L91.6835 53.9876L95.1337 62.527L93.1039 63.2658L89.6538 54.7264L89.5128 54.7777C88.7079 58.708 86.3138 62.5466 82.3811 66.339L80.4836 64.9239C84.269 61.7275 86.7018 58.5448 87.7932 55.4036L78.4339 58.8101L77.6697 56.9187Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_2_37">
<rect width="120" height="120" fill="white" transform="translate(0.706001 0.143768)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

1
src/assets/no-sale.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="goods.name" width="600" v-model="dialogVisible">
<el-dialog :title="goods.name" width="600" v-model="dialogVisible" top="5vh">
<div class="header">选择规格</div>
<div v-loading="loading">
<div class="row" v-for="(item, index) in goods.selectSpec" :key="index">
@ -14,9 +14,9 @@
</div>
<div class="footer">
<div class="info">
<span>库存{{ stockNumber }}</span>
<template v-if="goodsInfo.id">
<!-- <span>库存{{ goodsInfo.stockNumber }}</span> -->
<span>{{ goodsInfo.salePrice }}</span>
<span class="price">{{ formatDecimal(+goodsInfo.salePrice) }}</span>
</template>
</div>
<div class="btn_wrap">
@ -25,12 +25,12 @@
</div>
<div class="btn">
<el-button type="primary" style="width: 100%;"
:disabled="!goodsInfo.id || !+goodsInfo.isGrounding || !!+goodsInfo.isPauseSale"
:disabled="!goodsInfo.id || !+goodsInfo.isGrounding || !!+goodsInfo.isSoldStock"
@click="submitSku">
<template v-if="goodsInfo.id && !+goodsInfo.isGrounding">
未上架
</template>
<template v-if="goodsInfo.id && +goodsInfo.isPauseSale">
<template v-if="goodsInfo.id && +goodsInfo.isSoldStock">
已售罄
</template>
<template v-if="(+goodsInfo.isGrounding && !+goodsInfo.isPauseSale) || !goodsInfo.id">
@ -45,20 +45,19 @@
<script setup>
import { ref } from 'vue'
const emit = defineEmits(['success'])
import { formatDecimal } from '@/utils/index.js'
const emit = defineEmits(['success'])
const type = ref('shop')
const dialogVisible = ref(false)
const goods = ref({})
const selectedSkuNum = ref(0)
const selectedSkuTag = ref('')
const goodsInfo = ref({})
const loading = ref(false)
const selecSkuArray = ref([])
const stockNumber = ref(0)
//
function submitSku() {
@ -164,6 +163,7 @@ async function queryProductSkuAjax() {
//
function show(item, t = 'shop') {
stockNumber.value = item.stockNumber
type.value = t
let arr = []
for (let val in item.selectSpecInfo) {
@ -250,6 +250,10 @@ defineExpose({
align-items: center;
justify-content: space-between;
font-size: 20px;
.price {
color: var(--el-color-danger);
}
}
.btn_wrap {

View File

@ -568,6 +568,8 @@ export const useGoods = defineStore("goods", {
item.group_text = group_text;
item.packFee = val.packFee;
item.unitName = val.unitName;
item.isStock =
item.number >= val.stockNumber && val.isStock ? 1 : 0;
}
});

View File

@ -151,7 +151,7 @@ export const useSocket = defineStore("socket", {
break;
}
} else {
ElMessage.error("操作失败");
ElMessage.error(data.msg || "操作失败");
}
} else if (data.data_type == "order") {
// 收到订单消息,打印订单小票

View File

@ -18,7 +18,7 @@
</el-text>
</div>
<div class="item"
:class="{ disabled: goodsStore.cartList.length && (goodsStore.cartList[goodsStore.cartActiveIndex].goods_type == 'package' && goodsStore.cartList[goodsStore.cartActiveIndex].group_type == 1) }"
:class="{ disabled: goodsStore.cartList.length && (goodsStore.cartList[goodsStore.cartActiveIndex].goods_type == 'package' && goodsStore.cartList[goodsStore.cartActiveIndex].group_type == 1) || goodsStore.cartList.length && goodsStore.cartList[goodsStore.cartActiveIndex].isStock }"
@click="numberChange('add')">
<el-icon class="icon add">
<CloseBold />
@ -408,6 +408,11 @@ function numberChange(t) {
}
break;
case 'add':
let goods = goodsStore.originGoodsList.find(pro => pro.id == item.product_id)
if (item.number >= goods.stockNumber && goods.isStock) {
ElMessage.error('库存不足')
return
}
goodsStore.cartList[goodsStore.cartActiveIndex].number++
if (goodsStore.allSelected) {
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex], pack_number: goodsStore.cartList[goodsStore.cartActiveIndex].number }, 'edit')
@ -422,6 +427,13 @@ function numberChange(t) {
//
function updateNumber(num) {
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
let goods = goodsStore.originGoodsList.find(pro => pro.id == item.product_id)
if (num > goods.stockNumber && goods.isStock) {
ElMessage.error('库存不足')
return
}
goodsStore.cartList[goodsStore.cartActiveIndex].number = num
if (goodsStore.allSelected) {
goodsStore.operateCart({ ...goodsStore.cartList[goodsStore.cartActiveIndex], pack_number: goodsStore.cartList[goodsStore.cartActiveIndex].number }, 'edit')

View File

@ -72,9 +72,24 @@
<div class="cover" v-if="shopListType == 'img'">
<el-image :src="`${item.coverImg}?x-oss-process=image/resize,m_lfit,w_120,h_120`"
class="el_img" fit="cover"></el-image>
<div class="sell_out" v-if="item.isSoldStock">
<img class="sell_out_icon" src="../../../assets/icon_xq.png">
<!-- 已下架 -->
<div class="sell_out" v-if="!item.isSale">
<img class="sell_out_icon" src="@/assets/icon_goods_yxj.svg">
</div>
<!-- 未开售不在可售时间内 -->
<div class="sell_out" v-else-if="!item.isSaleTime">
<img class="sell_out_icon" src="@/assets/icon_goods_wks.svg">
</div>
<!-- 售罄 -->
<div class="sell_out" v-else-if="item.isSoldStock">
<img class="sell_out_icon" src="@/assets/icon_goods_sq.svg">
</div>
<!-- 库存不足 -->
<div class="sell_out" v-else-if="item.isStock && item.stockNumber <= 0">
<img class="sell_out_icon" src="@/assets/icon_goods_kcbz.svg">
</div>
<div class="weight" v-if="item.type == 'weight'">称重</div>
<div class="weight" v-if="item.type == 'package' && item.groupType == 1">可选套餐</div>
<div class="weight" v-if="item.type == 'package' && item.groupType == 0">固定套餐</div>
@ -492,11 +507,24 @@ function showSkuHandle(item) {
item.showMore = true
}
} else {
if (item.isStock && item.stockNumber <= 0) {
ElMessage({
type: 'error',
message: '库存不足',
})
return
}
if (item.isSoldStock) {
ElMessage({
type: 'error',
message: '该商品已售罄',
showClose: true,
})
return
}
if (!item.isSaleTime) {
ElMessage({
type: 'error',
message: '不在可售时间内',
})
return
}
@ -504,10 +532,10 @@ function showSkuHandle(item) {
ElMessage({
type: 'error',
message: '该商品已下架,请编辑上架后操作',
showClose: true,
})
return
}
let goodsItem = goodsStore.cartList.find(goods => goods.product_id == item.id)
if (item.type == 'sku') {
//
@ -518,7 +546,17 @@ function showSkuHandle(item) {
//
goodsStore.operateCart({ ...goodsItem, number: +goodsItem.number + 1 }, 'edit')
} else {
console.log(item);
//
//
if (item.isStock && item.skuList[0].suitNum > item.stockNumber) {
ElMessage({
type: 'error',
message: '库存不足',
})
return
}
goodsStore.addCart({ ...item.skuList[0], lowPrice: item.skuList[0].salePrice, number: item.skuList[0].suitNum })
}
} else if (item.type == 'weight') {
@ -686,7 +724,6 @@ async function closeSellHandle() {
ElMessage({
type: 'success',
message: '操作成功',
showClose: true,
})
updateGoods()
} catch (error) {
@ -722,7 +759,6 @@ async function putawayHandle(item) {
ElMessage({
type: 'success',
message: '操作成功',
showClose: true,
})
updateGoods()
} catch (error) {
@ -755,7 +791,6 @@ async function goodEditorConfirm() {
ElMessage({
type: 'success',
message: '操作成功',
showClose: true,
})
updateGoods()
} catch (error) {
@ -775,7 +810,7 @@ async function goodStockNumberHandle(item) {
// type: 'warning',
// message: '',
// showClose: true,
//
// })
// } else {
// goodsEditorStockItem.value = item
@ -805,7 +840,7 @@ async function goodsEditorStockConfirm() {
ElMessage({
type: 'success',
message: '操作成功',
showClose: true,
})
updateGoods()
} catch (error) {
@ -1082,12 +1117,12 @@ onMounted(() => {
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.3);
// backdrop-filter: blur(2px);
background-color: rgba(0, 0, 0, 0.5);
// backdrop-filter: blur(2px);
z-index: 10;
.sell_out_icon {
$size: 60px;
$size: 80px;
width: $size;
height: $size;
object-fit: cover;