{"id":59986,"date":"2025-04-24T10:08:22","date_gmt":"2025-04-24T02:08:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/59986\/"},"modified":"2025-04-24T10:08:22","modified_gmt":"2025-04-24T02:08:22","slug":"%e4%bb%bf%e6%b7%98%e5%ae%9d%e8%bf%90%e8%b4%b9-ecshop%e6%8f%90%e5%8f%96%e5%88%b0%e5%95%86%e5%93%81%e8%af%a6%e7%bb%86%e9%a1%b5%e9%9d%a2-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/59986\/","title":{"rendered":"\u4eff\u6dd8\u5b9d\u8fd0\u8d39 ecshop\u63d0\u53d6\u5230\u5546\u54c1\u8be6\u7ec6\u9875\u9762"},"content":{"rendered":"<p>&nbsp;<span style=\"font-family: Verdana, Helvetica, Arial, sans-serif;border-collapse: collapse\">\u65b9\u6cd5\uff1a\u6b64\u65b9\u6cd5\u6ca1\u6709\u8c03\u7528<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u6570\u636e\u5e93<\/span>\u91cc\u90a3\u4e2a\uff0c\u800c\u662f\u7528JS\u5b9e\u73b0\u7684\u3002<\/p>\n<p> \u6b65\u9aa4\uff1a<\/p>\n<p> 1.goods.php\uff08\u7ea2\u8272\u4e3a\u589e\u52a0\u7684<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u4ee3\u7801<\/span>\uff09<br \/> \u5927\u698233\u884c\uff1a<br \/> $goods_id = isset($_REQUEST[&#8216;id&#8217;])&nbsp;&nbsp;? intval($_REQUEST[&#8216;id&#8217;]) : 0;<br \/> <font style=\"line-height: normal\">$smarty-&gt;assign(&#8216;tc_goods_weight&#8217;,get_goods_weight($goods_id));\/\/tc:\u53d6\u5f97<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u5546\u54c1<\/span>\u91cd\u91cf<br \/> $smarty-&gt;assign(&#8216;regionname&#8217;,get_region_name()); \/\/tc:\u53d6\u5f97\u5168\u56fd\u4e00\u7ea7\u7701\u5e02<\/font><\/p>\n<p> <font style=\"line-height: normal\">\u7136\u540e\u5728\u4ee3\u7801\u5c3e\u90e8\u52a0\u4e0a\u4e24\u4e2a\u51fd\u6570\uff1a<\/font><br \/> <font style=\"line-height: normal\">\/\/tc:\u53d6\u5f97\u5168\u56fd\u4e00\u7ea7\u57ce\u5e02\u4fe1\u606f<br \/> function get_region_name(){<br \/> $sql=&#8221;SELECT * FROM ecs_region WHERE parent_id =&#8217;1&#8242;;&#8221;;<br \/> return $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);<br \/> }<br \/> function get_goods_weight($goods_id){<br \/> $sql=&#8221;select goods_weight from ecs_goods where goods_id = &#8216;$goods_id&#8217;;&#8221;;<br \/> $rs = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql);<br \/> return $rs[0][&#8216;goods_weight&#8217;];<br \/> }<\/font><\/p>\n<p> <strong><font style=\"line-height: normal\">\u627e\u5230\uff1a<\/font><\/strong><br \/> &lt;!&#8211; {if $goods.goods_brand neq &#8220;&#8221; and $cfg.show_brand} \u663e\u793a\u5546\u54c1<span style=\"line-height: normal;cursor: pointer;border-bottom-width: 1px;border-bottom-style: solid\">\u54c1\u724c<\/span>&#8211;&gt;<br \/> {$lang.goods_brand}&lt;a href=&#8221;{$goods.goods_brand_url}&#8221; &gt;{$goods.goods_brand}&lt;\/a&gt;&lt;br \/&gt;&nbsp; &nbsp;&nbsp;<br \/> &lt;!&#8211;{\/if}&#8211;&gt;<br \/> <font style=\"line-height: normal\">\u81f3 &lt;label id=&#8221;flowcity&#8221;&gt;\u5317\u4eac&lt;\/label&gt;&lt;img src=&#8221;images\/selectcity.jpg&#8221; \/&gt; \uff1a \u5feb\u9012 &lt;label id=&#8221;tc_flowprice&#8221;&gt;&lt;\/label&gt;\u5143 &lt;br \/&gt;<br \/> &nbsp; &nbsp; &lt;div id=&#8221;showList&#8221; style=&#8221;position:absolute;border:2px solid #ccc; display:none;font-size:12px; padding:5px; background:#fff; width:260px; z-index:99999&#8243;;&gt;<br \/> &nbsp; &nbsp; &lt;div id=&#8221;hiddenprice&#8221; style=&#8221;display:none;&#8221;&gt;{$tc_goods_weight.goods_weight}&lt;\/div&gt;<br \/> &nbsp; &nbsp; &lt;!&#8211;{foreach from=$regionname item=region_names}&#8211;&gt;<br \/> &nbsp; &nbsp;&nbsp;&nbsp;&lt;a href=&#8221;javascript:&#8221;&gt;{$region_names.region_name}&lt;\/a&gt;<br \/> &nbsp; &nbsp; &lt;!&#8211;{\/foreach}&#8211;&gt;<\/font><\/p>\n<p> <font style=\"line-height: normal\">\u6700\u540e\u5c31\u662fJS\uff1a<\/font><br \/> &lt;!&#8211; {literal} &#8211;&gt;<br \/> onload = function(){<br \/> &nbsp;&nbsp;changePrice();<br \/> &nbsp;&nbsp;fixpng();<br \/> &nbsp;&nbsp;<font style=\"line-height: normal\">initprice(); \/\/tc:\u521d\u59cb\u5316\u8fd0\u8d39\u4fe1\u606f<br \/> <\/font>&nbsp;&nbsp;try { onload_leftTime(); }<br \/> &nbsp;&nbsp;catch (e) {}<br \/> }<br \/> <font style=\"line-height: normal\">function initprice(){<br \/> var tc_goodsweight = Math.ceil($(&#8220;hiddenprice&#8221;).innerText);<br \/> tc_goodsweight == 0 ? 1 : tc_goodsweight;<br \/> if(tc_goodsweight &lt;=5)<br \/> &nbsp;&nbsp;$(&#8220;tc_flowprice&#8221;).innerText = &#8216;5&#8217;;<br \/> if(tc_goodsweight &gt;=5 &amp;&amp; tc_goodsweight&lt;=10)<br \/> &nbsp;&nbsp;$(&#8220;tc_flowprice&#8221;).innerText = &#8217;10&#8217;;<br \/> if(tc_goodsweight &gt;=10 &amp;&amp; tc_goodsweight&lt;=15)<br \/> &nbsp;&nbsp;$(&#8220;tc_flowprice&#8221;).innerText = &#8217;15&#8217;;<br \/> if(tc_goodsweight &gt;=15 &amp;&amp; tc_goodsweight&lt;=20)<br \/> &nbsp;&nbsp;$(&#8220;tc_flowprice&#8221;).innerText = &#8217;20&#8217;;<br \/> }<\/font><\/p>\n<p> <font style=\"line-height: normal\">\u5728head\u7684JS\u91cc\u52a0\u4e0a\u51fd\u6570<\/font><\/p>\n<p> <font style=\"line-height: normal\">\/* tc \u8fd0\u8d39JS *\/<br \/> function createCityList(elem){<br \/> var xx = event.clientX;<br \/> var yy = event.clientY;<br \/> $(&#8220;showList&#8221;).style.display=&#8217;block&#8217;;<br \/> $(&#8220;showList&#8221;).style.left=xx+&#8217;px&#8217;;<br \/> $(&#8220;showList&#8221;).style.top=yy+&#8217;px&#8217;;&nbsp;<br \/> }<br \/> function changeCity(cityname,regid){<br \/> var tc_goodsweight = Math.ceil($(&#8220;hiddenprice&#8221;).innerText); \/\/\u53d6\u5f97\u5546\u54c1\u91cd\u91cf<br \/> $(&#8220;flowcity&#8221;).innerText=cityname;<br \/> if(tc_goodsweight== 0)<br \/> &nbsp;&nbsp;tc_goodsweight=1;<br \/> else<br \/> &nbsp;&nbsp;tc_goodsweight=tc_goodsweight;<br \/> \/\/\u5317\u4eac<br \/> if(regid==2){<br \/> &nbsp;&nbsp;initprice();<br \/> }<br \/> \/\/\u6cb3\u5317 \u5929\u6d25<br \/> else if(regid==27 || regid==10){&nbsp;&nbsp;<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;8&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*3 + 8 ); \/\/\u7eed3<br \/> &nbsp;&nbsp;}&nbsp;<br \/> }<br \/> \/\/\u65b0\u7586 **<br \/> else if(regid==28 || regid==29){<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;20&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*10 + 20 );\/\/\u7eed10<br \/> &nbsp;&nbsp;}<br \/> }<br \/> \/\/\u9999\u6e2f<br \/> else if(regid==33){<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;25&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*10 + 25 );\/\/\u7eed10<br \/> &nbsp;&nbsp;}<br \/> }<br \/> \/\/\u6fb3\u95e8<br \/> else if(regid==34){<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;35&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*20 + 35 );\/\/\u7eed10<br \/> &nbsp;&nbsp;}<br \/> }<br \/> \/\/\u53f0\u6e7e<br \/> else if(regid==35){<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;30&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*28 + 30 );\/\/\u7eed10<br \/> &nbsp;&nbsp;}<br \/> }<br \/> \/\/\u5176\u4ed6<br \/> else{<br \/> &nbsp;&nbsp;if(tc_goodsweight==1){<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= &#8220;10&#8221;; \/\/\u9996\u91cd<br \/> &nbsp;&nbsp;}else{<br \/> &nbsp; &nbsp;$(&#8220;tc_flowprice&#8221;).innerText= ((tc_goodsweight &#8211; 1)*5 + 10 );\/\/\u7eed10<br \/> &nbsp;&nbsp;}<br \/> }<\/p>\n<p> $(&#8220;showList&#8221;).style.display=&#8217;none&#8217;;<br \/> }<br \/> function hideCityList(){<br \/> $(&#8220;showList&#8221;).style.display=&#8217;none&#8217;;<br \/> }<\/font><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u65b9\u6cd5\uff1a\u6b64\u65b9\u6cd5\u6ca1\u6709\u8c03\u7528\u6570\u636e\u5e93\u91cc\u90a3\u4e2a\uff0c\u800c\u662f\u7528JS\u5b9e\u73b0\u7684\u3002 \u6b65\u9aa4\uff1a 1.goods.php\uff08\u7ea2\u8272\u4e3a\u589e\u52a0\u7684\u4ee3\u7801\uff09 \u5927\u698233\u884c\uff1a $goods_id = isset($_REQUEST[&#8216;id&#8217;])&nbsp;&nbsp;? intval($_REQUEST[&#8216;id&#8217;]) : 0; $smarty-&gt;assign(&#8216;tc_goods_weight&#8217;,get_goods_weight($goods_id));\/\/tc:\u53d6\u5f97\u5546\u54c1\u91cd\u91cf $smarty-&gt;assign(&#8216;regionname&#8217;,get_region_name()); \/\/tc:\u53d6\u5f97\u5168\u56fd\u4e00\u7ea7\u7701\u5e02 \u7136\u540e\u5728\u4ee3\u7801\u5c3e\u90e8\u52a0\u4e0a\u4e24\u4e2a\u51fd\u6570\uff1a \/\/tc:\u53d6\u5f97\u5168\u56fd\u4e00\u7ea7\u57ce\u5e02\u4fe1\u606f function get_region_name(){ $sql=&#8221;SELECT * FROM ecs_region WHERE parent_id =&#8217;1&#8242;;&#8221;; return $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql); } function get_goods_weight($goods_id){ $sql=&#8221;select goods_weight from ecs_goods where goods_id = &#8216;$goods_id&#8217;;&#8221;; $rs = $GLOBALS[&#8216;db&#8217;]-&gt;getAll($sql); return $rs[0][&#8216;goods_weight&#8217;]; } \u627e\u5230\uff1a &lt;!&#8211; {if $goods.goods_brand neq &#8220;&#8221; and $cfg.show_brand} \u663e\u793a\u5546\u54c1\u54c1\u724c&#8211;&gt; {$lang.goods_brand}&lt;a href=&#8221;{$goods.goods_brand_url}&#8221; &gt;{$goods.goods_brand}&lt;\/a&gt;&lt;br [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-59986","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=59986"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/59986\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=59986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=59986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=59986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}