item.vue 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. <template>
  2. <view class="billing_box_bg">
  3. <view class="c_header fadeIn">
  4. <view class="header_inside">
  5. <image :src="shopImg"></image>
  6. <view class="shop_info">
  7. <view class="shop_title">{{shopName}}</view>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="input-wrap" >
  12. <view class="search-bar">
  13. <app-search-module v-model="py" placeholder="这里搜索" @input="searchFn" />
  14. </view>
  15. <view class="buy-flower-container">
  16. <button class="buy-mall-btn" @click="buyHs()">
  17. <view class="btn-content">
  18. <text class="btn-text">买花束</text>
  19. </view>
  20. </button>
  21. <button @click="scanCode()" style="background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);border: none;">
  22. <view class="btn-content">
  23. <text class="btn-text">扫一扫</text>
  24. </view>
  25. </button>
  26. </view>
  27. </view>
  28. <view class="scroll-middle_bx">
  29. <scroll-view scroll-y scroll-with-animation class="tab-view">
  30. <div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
  31. <text v-if="item.classId=='-1' || item.classId=='-3' || item.classId=='-2'" style="color:red;font-weight:bold;text-align: center;">{{ item.className || "" }}</text>
  32. <text v-else style="text-align: center;">{{ item.className }}</text>
  33. </div>
  34. <view style="height:180upx"></view>
  35. </scroll-view>
  36. <scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true" @scroll="scroll_detail" lower-threshold="100" @scrolltolower="scroll_bottom">
  37. <!--内容部分 start -->
  38. <block v-if="!$util.isEmpty(filterProductInfo)">
  39. <view class="item_list_bx selectAll" v-for="(classItem, classIndex) in filterProductInfo" :key="classIndex" :id="`class_${classIndex}`">
  40. <view class="item_list_title">{{ classItem.className }}</view>
  41. <template v-for="(productItem, productIndex) in classItem.child">
  42. <view :class="[productItem.presell == 1 ? 'middle-box' : 'box']" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
  43. <Commondity v-if="classItem.isActive"
  44. :info="productItem"
  45. :offVerifyRepertory="true"
  46. :bigCount="getSelectItemById(productItem.id, classItem.classId).bigCount"
  47. :smallCount="getSelectItemById(productItem.id, classItem.classId).smallCount"
  48. @customNum="customNum"
  49. @add="addEvent"
  50. @addOneEvent="addCustomNumEvent"
  51. @del="delEvent"
  52. @showBigCover="showBigCover"
  53. @goToSpecialVariety="goToSpecialVariety"
  54. ></Commondity>
  55. <view v-if="productItem.presell && productItem.presell == 1" style="position:absolute;top:150upx;font-size:26upx;color:#3385ff;white-space: nowrap;text-overflow: hidden;">
  56. 配送日:
  57. <block v-if="!$util.isEmpty(productItem.presellDateShow)">
  58. <text v-for="(dateItem, dateIndex) in productItem.presellDateShow" :key="dateIndex" style="">
  59. {{dateItem}}
  60. <text v-if="dateIndex!=productItem.presellDateShow.length-1">,</text>
  61. </text>
  62. </block>
  63. </view>
  64. </view>
  65. </template>
  66. </view>
  67. </block>
  68. <block v-else>
  69. <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfo)"/>
  70. </block>
  71. <!--内容部分 end -->
  72. </scroll-view>
  73. </view>
  74. <modal-module :show="isModel" @cancel="modalCancel" @click="affirm" :title="customData.itemName" color="#333" :size="32" padding="30rpx 30rpx" >
  75. <template slot="customContent">
  76. <view class="select-cmd_bx" v-if="customData">
  77. <view class="kc">&nbsp;</view>
  78. <view class="num_bx">
  79. <input v-model="customData.bigCount" :focus="isFocus" type="number" placeholder="扎数" />
  80. </view>
  81. </view>
  82. </template>
  83. </modal-module>
  84. <FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent" @showCartItem="showCartItem"></FooterCart>
  85. <sel-popup :show="popupShow" :info="infoData" @close="hidePopup" />
  86. <app-activily-coupon :show.sync="isNewCustom" :info="newCustomGift" :ghsId="ghsId" />
  87. <view v-if="cartItemShow == true" style="position: fixed;z-index: 190;top: 0;left: 0;width: 100vw;height: 145vh;background: rgba(0, 0, 0, 0.6);color: #fff;" @click="hideCartItem()">
  88. <view style="position: fixed;bottom: 108upx;width:100vw;background-color:white;" @click.stop="">
  89. <view class="commodity-view">
  90. <view class="summary-bar">
  91. <button class="admin-button-com blue middle" style="border:none;" @click.stop="delMemory()">清空购物车</button>
  92. <button class="admin-button-com blue big" @click.stop="scanCode()" style="border:none;padding:22upx 34upx; display:flex; align-items:center;">
  93. <view class="btn-content">
  94. <text class="btn-text" style="font-size: 28upx;">扫一扫</text>
  95. </view>
  96. </button>
  97. </view>
  98. <view class="commodity-list">
  99. <view class="commodity-item" v-for="(item, index) in selectList" :key="index">
  100. <image class="item-icon" :src="item.cover" alt="" />
  101. <view class="item-info">
  102. <view class="info-line">
  103. <text class="item-name">{{ item.name }}</text>
  104. <view class="item-price">
  105. <text class="unit"></text>
  106. <view class="price">
  107. <view v-if="Number(item.skDiscountPrice) > 0">
  108. <text style="text-decoration:line-through;color:#A9A9A9;font-size:24upx;margin-left:10upx;font-weight:normal;margin-right:12upx;">¥{{ item.skPrice ? parseFloat(item.skPrice) : 0 }}</text>
  109. <text>¥{{ parseFloat(item.skDiscountPrice)}}</text>
  110. </view>
  111. <view v-else>
  112. ¥{{ item.skPrice ? parseFloat(item.skPrice) : 0 }}
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="limit-buy-tip" v-if="getLimitBuyWarn(item)">
  118. {{ getLimitBuyWarn(item) }}
  119. </view>
  120. <view style="text-align:right;">
  121. <view class="open-bx" >
  122. <i class="iconfont iconjian" @click.stop="delCurrent(item)" v-if="item.bigCount > 0 || item.smallCount > 0"></i>
  123. <text class="num" @click.stop="customUpdate(item)">
  124. <text v-if="item.bigCount > 0" style="font-weight:bold;color:#3385ff;">{{ item.bigCount }}</text>
  125. <text v-if="item.smallCount > 0"><text v-if="item.bigCount > 0">/</text>{{ item.smallCount }}</text>
  126. </text>
  127. <i class="iconfont iconzeng" @click.stop="addCurrent(item)"></i>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. <wangCg :loginStyle.sync="globalLoginStyle" @loginSuccess="loginSuccess()"></wangCg>
  137. </view>
  138. </template>
  139. <script>
  140. import { mapGetters } from 'vuex'
  141. import AppTabs from "@/components/plugin/tabs";
  142. import Commondity from "./components/subItem";
  143. import wangCg from "@/components/wangCg";
  144. import AppWrapperEmpty from "./components/app-wrapper-empty";
  145. import GoodsCommondity from "@/components/item/module/app-goods-commodity";
  146. import AppSearchModule from "@/components/item/module/app-search";
  147. import FooterCart from "@/components/item/module/app-footer-cart";
  148. import allMoreSelectInput from "@/components/item/module/allMoreSelectInput";
  149. import AppActivilyCoupon from "@/components/item/module/app-activily-coupon";
  150. import ModalModule from "@/components/item/plugin/modal";
  151. import allMoreSelectInputMins from "@/mixins/allMoreSelectInput";
  152. import productMins from "@/mixins/cgProduct";
  153. import { COMMODITY_TYPE } from "@/utils/declare";
  154. import { getInfo } from "@/api/shop";
  155. import { getLimitBuyInfo } from "@/api/order";
  156. export default {
  157. name: "item",
  158. components: {
  159. AppTabs,
  160. AppSearchModule,
  161. AppWrapperEmpty,
  162. Commondity,
  163. ModalModule,
  164. FooterCart,
  165. allMoreSelectInput,
  166. GoodsCommondity,
  167. wangCg,
  168. AppActivilyCoupon
  169. },
  170. props: {
  171. ghsShopAdminId:{
  172. type:Number,
  173. default: 0
  174. },
  175. },
  176. mixins: [productMins,allMoreSelectInputMins],
  177. data() {
  178. return {
  179. pageType: "cg",
  180. COMMODITY_TYPE,
  181. popupShow:false,
  182. isGhsProduct:true,
  183. isFocus: false,
  184. isModel: false,
  185. isSmallCount: false,
  186. customData: {
  187. bigCount: 0,
  188. smallCount: 0
  189. },
  190. showSubmitModel: false,
  191. hdShopAdminId:0,
  192. fromGhsId:0,
  193. myClass: 'fadeIn',
  194. shopId:0,
  195. infoData:{},
  196. xjData:{},
  197. xjDataInfo:{},
  198. shareDiscount:1,
  199. ghsId:0,
  200. newCustomGift:{xrFlAmount:0},
  201. isNewCustom:false,
  202. cartItemShow:false,
  203. limitBuyWarnList: [],
  204. shopName:'',
  205. shopImg:'',
  206. hdId:0,
  207. autoLoad:false
  208. };
  209. },
  210. onPullDownRefresh() {
  211. this.init().then(res => {
  212. uni.stopPullDownRefresh();
  213. });
  214. },
  215. computed: {
  216. ...mapGetters({ loginInfo:"getLoginInfo" })
  217. },
  218. watch: {
  219. loginInfo: {
  220. deep: true,
  221. handler: function(newVal) {
  222. if(!this.$util.isEmpty(newVal)){
  223. this.globalLoginStyle = 1
  224. }else{
  225. this.globalLoginStyle = 0
  226. }
  227. },
  228. immediate:true
  229. }
  230. },
  231. onShareAppMessage(res) {
  232. return {
  233. title: '花材',
  234. desc: "",
  235. path: "pages/item/item?account="+this.option.account,
  236. }
  237. },
  238. onShow(){
  239. //登录状态
  240. if(!this.$util.isEmpty(this.loginInfo)){
  241. this.globalLoginStyle = 1
  242. }else{
  243. this.globalLoginStyle = 0
  244. }
  245. if(this.xjData.hasUpdate == 1){
  246. const list = this.selectList;
  247. this.customData = this.xjDataInfo
  248. if(this.xjData.cancel == 1){
  249. this.customData.bigCount = 0
  250. this.customData.smallCount = 0
  251. console.log('this.customData',this.customData)
  252. this.affirm({index:0})
  253. }else{
  254. //判断list有没有数据,没有需要初始化
  255. const list = this.selectList;
  256. let has = false
  257. for (let index = 0; index < list.length; index++) {
  258. const element = list[index];
  259. if (element.id == this.xjDataInfo.id && element.classId == this.xjDataInfo.classId) {
  260. has = true
  261. }
  262. }
  263. if(has == false){
  264. let params = { ...this.xjDataInfo, bigCount: null, smallCount: null, autoPrice: null, realityWeight: null, userPrice: null, }
  265. list.push(params);
  266. this.setSelectInfoByType({ type: this.pageType, info: list });
  267. }
  268. this.customData.bigCount = this.xjData.stock
  269. this.customData.smallCount = 0
  270. this.customData.bigPrice = this.xjData.price
  271. this.customData.price = this.xjData.price
  272. this.customData.itemPrice = this.xjData.price
  273. this.customData.userPrice = (Number(this.xjData.stock) * Number(this.xjData.price)).toFixed(2)
  274. this.affirm({index:1})
  275. }
  276. }
  277. this.xjData = {}
  278. },
  279. methods: {
  280. showCartItem(){
  281. if(this.cartItemShow == true){
  282. this.cartItemShow = false
  283. }else{
  284. if(!this.$util.isEmpty(this.selectList)){
  285. if(this.cartItemShow == false){
  286. this.cartItemShow = true
  287. }
  288. }
  289. }
  290. },
  291. delMemory(){
  292. this.cartItemShow = false
  293. this.limitBuyWarnList = []
  294. this.removeMemory()
  295. },
  296. hideCartItem(){
  297. this.cartItemShow = false
  298. },
  299. getLimitBuyWarn(item) {
  300. const info = this.limitBuyWarnList.find(warnItem => warnItem.id == item.id)
  301. if (!info) {
  302. return ''
  303. }
  304. return `超出限购${info.currentBuyNum + info.exceedNum}份`
  305. },
  306. loginSuccess() {
  307. this.initData()
  308. },
  309. //去特殊品种页,如小菊等
  310. goToSpecialVariety(info){
  311. this.xjDataInfo = info
  312. if(info.stock <= 0){
  313. uni.showToast({title:"没有库存",icon:"none"})
  314. }else{
  315. this.$util.pageTo({url: "/pagesPurchase/xj",query: {stock:info.stock,price: info.price,ghsId:this.option.account}})
  316. }
  317. },
  318. showPopup() {
  319. this.popupShow = true;
  320. },
  321. hidePopup() {
  322. this.popupShow = false;
  323. },
  324. buyAlbum(){
  325. let account = this.option.account ? this.option.account : 0
  326. this.$util.pageTo({url: "/pages/home/mall?account="+account+'&hdId='+this.hdId,type:2})
  327. },
  328. buyHs(){
  329. let account = this.option.account ? this.option.account : 0
  330. this.$util.pageTo({url: "/pages/home/category?account="+account+'&hdId='+this.hdId,type:2})
  331. },
  332. showBigCover(item){
  333. this.$util.pageTo({url: "/pages/item/detail?id="+item.id+"&account="+this.option.account+'&hdId='+this.hdId})
  334. },
  335. init(){
  336. this.init = false
  337. if(this.option.hdId && Number(this.option.hdId) > 0){
  338. this.hdId = this.option.hdId
  339. }
  340. const shopId = uni.getStorageSync('account')
  341. this.option.shopId = shopId
  342. getInfo({hdId:this.hdId}).then(res=>{
  343. if(res.code == 1){
  344. if(res.data.info && res.data.info.merchantName){
  345. let sjName = res.data.info.merchantName
  346. let shopName = res.data.info.shopName ? res.data.info.shopName : '首店'
  347. let name = shopName == '首店' ? sjName : sjName+' '+shopName
  348. this.shopName = name
  349. this.shopImg = res.data.info.avatar
  350. }
  351. if(res.data.hd && Number(res.data.hd.id) > 0){
  352. if(Number(this.hdId) == 0){
  353. this.hdId = res.data.hd.id
  354. }
  355. }
  356. //保存当前所在门店信息
  357. uni.setStorageSync('currentShop', res.data.info)
  358. }
  359. })
  360. this.initData()
  361. },
  362. scroll_detail(options){
  363. if(!uni.getStorageSync("resolve")){
  364. this.get_node_details(options)
  365. }
  366. },
  367. addCurrent(info){
  368. if(info.$orig){
  369. info = info.$orig
  370. }
  371. this.addEvent(info)
  372. },
  373. delCurrent(info){
  374. if(info.$orig){
  375. info = info.$orig
  376. }
  377. this.delEvent(info)
  378. },
  379. customUpdate(info){
  380. if(info.$orig){
  381. info = info.$orig
  382. }
  383. this.isModel = true;
  384. this.customData = info;
  385. this.$nextTick(()=>{
  386. this.customData.smallCount = this.customData.smallCount==0 ? null : this.customData.smallCount;
  387. this.customData.bigCount = this.customData.bigCount==0 ? null : this.customData.bigCount;
  388. this.isFocus = true;
  389. })
  390. },
  391. customNum(info) {
  392. this.isModel = true;
  393. this.customData = info;
  394. this.$nextTick(()=>{
  395. this.customData.smallCount = this.customData.smallCount==0 ? null : this.customData.smallCount;
  396. this.customData.bigCount = this.customData.bigCount==0 ? null : this.customData.bigCount;
  397. this.isFocus = true;
  398. })
  399. },
  400. goToCg() {
  401. this.$util.pageTo({ url: "/pagesClient/official/apply",query:{ghsShopAdminId:this.ghsShopAdminId,hdShopAdminId:this.hdShopAdminId,fromGhsId:this.fromGhsId},type:2})
  402. },
  403. // 拨打电话 wangn 2021-5-6
  404. toPhone(phone){
  405. uni.makePhoneCall({
  406. phoneNumber: phone
  407. });
  408. },
  409. modalCancel() {
  410. this.isModel = false;
  411. this.customData = {};
  412. }, // 取消 确认
  413. affirm(val) {
  414. this.isFocus = false;
  415. this.isFocusOne = false;
  416. this.$nextTick(()=>{
  417. //取消
  418. if (val.index === 0) {
  419. if(this.customData.bigCount>0 || this.customData.smallCount>0){
  420. }else{
  421. this.delAllEvent(this.customData)
  422. }
  423. this.modalCancel();
  424. return false
  425. }
  426. //二个都不是数值
  427. if(/(^[1-9]\d*$)/.test(this.customData.bigCount) == false && /(^[1-9]\d*$)/.test(this.customData.smallCount) == false){
  428. this.delAllEvent(this.customData)
  429. this.modalCancel();
  430. return;
  431. }
  432. if(/(^[1-9]\d*$)/.test(this.customData.bigCount)){
  433. if(this.customData.bigCount<=0){
  434. uni.showToast({title:"数量要大于0",icon:"none"})
  435. return;
  436. }
  437. }
  438. if(/(^[1-9]\d*$)/.test(this.customData.smallCount)){
  439. if(this.customData.smallCount<=0){
  440. uni.showToast({title:"数量要大于0",icon:"none"})
  441. return;
  442. }
  443. }
  444. const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
  445. const ratioNum = Number(ratio);
  446. //超过库存时 设置为库存最大值 1
  447. if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
  448. uni.showToast({ title: '库存还剩'+bigNum, icon: "none" })
  449. } else {
  450. this.updateItemEvent(this.customData)
  451. this.modalCancel()
  452. }
  453. })
  454. },
  455. cancelEvent() {
  456. this.showSubmitModel = false;
  457. },
  458. submitEvent(val) {
  459. if (val.index === 0) {
  460. this.cancelEvent();
  461. } else {
  462. uni.navigateTo({
  463. url: "/admin/billing/affirm"
  464. });
  465. this.cancelEvent();
  466. }
  467. },
  468. confirmSelectGoodsEvent() {
  469. if (this.selectList.length > 0) {
  470. uni.navigateTo({
  471. url: "/admin/billing/affirmGoods"
  472. });
  473. } else {
  474. this.$msg("请选择花材");
  475. }
  476. },
  477. confirmSelectEvent() {
  478. if (this.selectList.length > 0) {
  479. //因历史遗留原因,打开花材页马上点花材出现数量0或null的情况,需要过滤 shish 20210716
  480. let selectList = this.selectList;
  481. let list = [];
  482. for (let i=0;i<selectList.length;i++){
  483. if(/(^[1-9]\d*$)/.test(selectList[i].bigCount) == false && /(^[1-9]\d*$)/.test(selectList[i].smallCount) == false){
  484. continue
  485. }
  486. list.push(selectList[i])
  487. }
  488. if(list.length <= 0){
  489. this.$msg("请选择花材")
  490. return
  491. }
  492. const ghsId = Number(this.option.account) || Number(uni.getStorageSync('account')) || 0
  493. if (!ghsId) {
  494. this.$msg("缺少店铺信息")
  495. return
  496. }
  497. let newList = list
  498. .filter(item => Number(item.limitBuy) > 0)
  499. .map(item => {
  500. return {
  501. id: item.id,
  502. bigCount: item.bigCount
  503. }
  504. })
  505. if (newList.length > 0) {
  506. getLimitBuyInfo({ ghsId, list: newList }).then(res => {
  507. const limitBuyInfo = Array.isArray(res.data) ? res.data : []
  508. const warnList = limitBuyInfo.filter(item => item.specialPrice === false && item.reachLimitBuyNum === true)
  509. if (warnList.length > 0) {
  510. this.limitBuyWarnList = warnList
  511. this.cartItemShow = true
  512. this.$msg("有花材超出限购")
  513. return
  514. }
  515. this.limitBuyWarnList = []
  516. this.setLimitBuyInfoByType({ type: this.pageType, info: limitBuyInfo });
  517. })
  518. } else {
  519. this.limitBuyWarnList = []
  520. this.setLimitBuyInfoByType({ type: this.pageType, info: [] });
  521. }
  522. this.setSelectInfoByType({ type: this.pageType, info: list });
  523. let account = this.option.account ? this.option.account : 0
  524. this.pageTo({url: '/pages/billing/affirmGhs?account='+account+'&hdId='+this.hdId,type:2})
  525. } else {
  526. this.$msg("请选择花材");
  527. }
  528. },
  529. change(e) {
  530. this.resetSelectInfoByType(this.pageType);
  531. this.resetLimitBuyInfoByType(this.pageType);
  532. if (this.tabIndex == e.index) {
  533. return false;
  534. } else {
  535. this.tabIndex = e.index;
  536. }
  537. },
  538. scanCode(){
  539. uni.scanCode({
  540. onlyFromCamera: false, // 可从相册识别
  541. scanType: ['barCode'],
  542. success: (res) => {
  543. const itemId = res.result
  544. let foundItem = null;
  545. for (let i = 0; i < this.productInfo.length; i++) {
  546. let classItem = this.productInfo[i];
  547. if (classItem.child) {
  548. for (let j = 0; j < classItem.child.length; j++) {
  549. let productItem = classItem.child[j];
  550. if (productItem.itemId == itemId) {
  551. foundItem = productItem;
  552. break;
  553. }
  554. }
  555. }
  556. if (foundItem) break;
  557. }
  558. if (foundItem) {
  559. const ratio = Number(foundItem.ratio);
  560. const selectItem = this.getSelectItemById(foundItem.id, foundItem.classId);
  561. const bigCount = selectItem ? (selectItem.bigCount || 0) : 0;
  562. const smallCount = selectItem ? (selectItem.smallCount || 0) : 0;
  563. if(foundItem.stock<=0){
  564. uni.showToast({title:'没有货了',icon:'none'})
  565. return
  566. }
  567. if (Number(bigCount) * ratio + Number(smallCount) > Number(foundItem.bigNum) * ratio + Number(foundItem.smallNum)) {
  568. this.$msg("库存只剩"+foundItem.bigNum);
  569. return
  570. }
  571. this.addEvent(foundItem);
  572. this.cartItemShow = true
  573. } else {
  574. this.$msg("未找到对应商品");
  575. }
  576. },
  577. fail: (err) => {
  578. console.log(err)
  579. }
  580. })
  581. }
  582. }
  583. };
  584. </script>
  585. <style lang="scss" scoped>
  586. .billing_box_bg {
  587. height: 100%;
  588. display: flex;
  589. flex-direction: column;
  590. .c_header{
  591. width: 100vw;
  592. padding: 0 15upx;
  593. box-sizing: border-box;
  594. background: linear-gradient(to bottom,#3385FF, #fff);
  595. &>.header_inside{
  596. position: relative;
  597. height: 124upx;
  598. margin-top: 15upx;
  599. background: #fff;
  600. box-shadow: 0upx 1px 21px 0upx rgba(161, 166, 173, 0.4);
  601. border-radius: 20upx;
  602. padding: 35upx 30upx 30upx 30upx;
  603. box-sizing: border-box;
  604. &>image{
  605. height: 60upx;
  606. width: 60upx;
  607. display: inline-block;
  608. border-radius: 10upx;
  609. background-color: #eee;
  610. vertical-align: top;
  611. }
  612. &>.shop_info{
  613. vertical-align: top;
  614. display: inline-block;
  615. height: 100%;
  616. margin-left: 20upx;
  617. &>.shop_title{
  618. margin-top:0upx;
  619. font-size:40upx;
  620. font-weight: 600;
  621. color: #060606;
  622. width: 580upx;
  623. overflow: hidden;
  624. white-space: nowrap;
  625. }
  626. }
  627. }
  628. }
  629. .input-wrap {
  630. display: flex;
  631. padding: 22upx 20upx 22upx 30upx;
  632. align-items: center;
  633. .search-bar {
  634. flex: 1;
  635. }
  636. }
  637. .buy-flower-container {
  638. margin-left: 20upx;
  639. padding: 0;
  640. display: flex;
  641. gap: 10upx;
  642. }
  643. .buy-album-btn {
  644. position: relative;
  645. background: #e91e63;
  646. border: none;
  647. border-radius: 45upx;
  648. padding: 0;
  649. height: 80upx;
  650. min-width: 210upx;
  651. box-shadow: 0 8upx 20upx rgba(233, 30, 99, 0.3);
  652. overflow: hidden;
  653. &:active {
  654. box-shadow: 0 4upx 10upx rgba(233, 30, 99, 0.4);
  655. }
  656. }
  657. .buy-mall-btn {
  658. position: relative;
  659. background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  660. border: none;
  661. padding: 0;
  662. height: 80upx;
  663. min-width: 180upx;
  664. box-shadow: 0 8upx 20upx rgba(165, 94, 234, 0.3);
  665. overflow: hidden;
  666. &:active {
  667. box-shadow: 0 4upx 10upx rgba(165, 94, 234, 0.4);
  668. }
  669. }
  670. .btn-content {
  671. display: flex;
  672. min-width: 130upx;
  673. align-items: center;
  674. justify-content: center;
  675. height: 100%;
  676. position: relative;
  677. z-index: 1;
  678. text-align: center;
  679. gap: 0;
  680. }
  681. .btn-text {
  682. color: white;
  683. font-size: 28upx;
  684. font-weight: bold;
  685. text-shadow: 0 2upx 4upx rgba(0, 0, 0, 0.2);
  686. text-align: center;
  687. line-height: 1;
  688. display: flex;
  689. align-items: center;
  690. justify-content: center;
  691. gap: 8upx;
  692. }
  693. .arrow-icon {
  694. width: 36upx;
  695. height: 32upx;
  696. margin-right: 16upx;
  697. position: relative;
  698. display: flex;
  699. align-items: center;
  700. justify-content: flex-end;
  701. flex-shrink: 0;
  702. &::before {
  703. content: '';
  704. position: absolute;
  705. width: 30upx;
  706. height: 8upx;
  707. background: white;
  708. border-radius: 4upx;
  709. }
  710. &::after {
  711. content: '';
  712. position: absolute;
  713. width: 0;
  714. height: 0;
  715. border-left: 20upx solid white;
  716. border-top: 12upx solid transparent;
  717. border-bottom: 12upx solid transparent;
  718. right: -8upx;
  719. }
  720. }
  721. .sparkle-css {
  722. width: 16upx;
  723. height: 16upx;
  724. position: relative;
  725. animation: twinkle 1s infinite alternate;
  726. &::before {
  727. content: '';
  728. position: absolute;
  729. width: 2upx;
  730. height: 16upx;
  731. background: #fff;
  732. left: 7upx;
  733. top: 0;
  734. border-radius: 1upx;
  735. }
  736. &::after {
  737. content: '';
  738. position: absolute;
  739. width: 16upx;
  740. height: 2upx;
  741. background: #fff;
  742. top: 7upx;
  743. left: 0;
  744. border-radius: 1upx;
  745. }
  746. }
  747. @keyframes bounce {
  748. 0%, 20%, 50%, 80%, 100% {
  749. transform: translateY(0);
  750. }
  751. 40% {
  752. transform: translateY(-6upx);
  753. }
  754. 60% {
  755. transform: translateY(-3upx);
  756. }
  757. }
  758. @keyframes twinkle {
  759. 0% {
  760. opacity: 0.5;
  761. transform: scale(0.8);
  762. }
  763. 100% {
  764. opacity: 1;
  765. transform: scale(1.2);
  766. }
  767. }
  768. .scroll-middle_bx {
  769. flex: 1;
  770. display: flex;
  771. width: 100%;
  772. height: 100%;
  773. overflow: hidden;
  774. }
  775. .tab-view {
  776. ::-webkit-scrollbar {
  777. width: 0;
  778. height: 0;
  779. color: transparent;
  780. }
  781. height: calc(100vh - 100upx);
  782. width: 170upx;
  783. flex-shrink: 0;
  784. background-color: #f0f2f6;
  785. .tab-bar-item {
  786. position: relative;
  787. width: 170upx;
  788. height: 90upx;
  789. box-sizing: border-box;
  790. display: flex;
  791. align-items: center;
  792. justify-content: center;
  793. font-size: 26upx;
  794. color: #444;
  795. font-weight: 400;
  796. &:last-child{
  797. margin-bottom: 110upx;
  798. }
  799. }
  800. .active {
  801. position: relative;
  802. color: $mainColor;
  803. font-size: 26upx;
  804. background: #fff;
  805. }
  806. .active::before {
  807. content: "";
  808. position: absolute;
  809. border-left: 8upx solid $mainColor;
  810. height: 100%;
  811. left: 0;
  812. }
  813. }
  814. .right-box {
  815. height: 100%;
  816. flex: 1;
  817. box-sizing: border-box;
  818. padding-bottom:90upx;
  819. }
  820. .item_list_bx {
  821. padding: 40upx 16upx 20upx 16upx;
  822. &:last-child{
  823. margin-bottom:70upx;
  824. }
  825. .box{
  826. height: 185upx
  827. }
  828. .middle-box{
  829. height: 215upx;
  830. position:relative;
  831. }
  832. .big-box{
  833. height: 285upx
  834. }
  835. }
  836. .item_list_title {
  837. margin-bottom: 20upx;
  838. font-size: 24upx;
  839. font-weight: 600;
  840. color: #666666;
  841. }
  842. .select-cmd_bx {
  843. & .kc {
  844. color: #999999;
  845. font-size: 28upx;
  846. font-weight: 400;
  847. margin-bottom: 60upx;
  848. text-align: center;
  849. margin-top: 10upx;
  850. }
  851. & .num_bx {
  852. display: flex;
  853. align-items: center;
  854. margin-bottom: 80upx;
  855. & > input {
  856. width: 480upx;
  857. height: 80upx;
  858. border: 1upx solid #dddddd;
  859. border-radius: 4upx;
  860. text-align: center;
  861. margin-left: 50upx;
  862. font-size: 40upx;
  863. }
  864. }
  865. }
  866. .fadeIn{
  867. height:160upx;
  868. }
  869. }
  870. .commodity-view {
  871. display: flex;
  872. flex-direction: column;
  873. .commodity-list {
  874. overflow:scroll;
  875. height:60vh;
  876. padding: 20upx;
  877. .commodity-item {
  878. display: flex;
  879. margin-bottom: 20upx;
  880. .item-icon {
  881. flex-shrink: 0;
  882. width: 140upx;
  883. height: 140upx;
  884. }
  885. .item-info {
  886. display: flex;
  887. flex-direction: column;
  888. justify-content: center;
  889. flex: 1;
  890. margin-left: 20upx;
  891. position: relative;
  892. .info-line {
  893. margin-bottom: 20upx;
  894. display: flex;
  895. justify-content: space-between;
  896. align-items: flex-end;
  897. .item-name {
  898. color: #333333;
  899. font-size: 30upx;
  900. overflow: hidden;
  901. white-space: nowrap;
  902. text-overflow: ellipsis;
  903. width:400upx;
  904. }
  905. .item-price {
  906. color: #333;
  907. font-size: 22upx;
  908. .price {
  909. font-size: 32upx;
  910. font-weight: bold;
  911. }
  912. }
  913. }
  914. .limit-buy-tip {
  915. position: absolute;
  916. left: 0;
  917. top: 86upx;
  918. color: red;
  919. font-size: 24upx;
  920. text-align: left;
  921. }
  922. .open-bx {
  923. align-items: center;
  924. & .iconfont {
  925. color: #3385ff;
  926. font-size: 60upx;
  927. }
  928. & > .num {
  929. display: inline-block;
  930. width: 130upx;
  931. height:55upx;
  932. line-height:55upx;
  933. text-align:center;
  934. margin: 0 8upx;
  935. color: #868686;
  936. border-radius: 22upx;
  937. background-color: #f5f5f5;
  938. font-size: 28upx;
  939. }
  940. }
  941. }
  942. }
  943. }
  944. .summary-bar {
  945. padding: 0 20upx;
  946. height: 90upx;
  947. display: flex;
  948. align-items: center;
  949. justify-content: space-between;
  950. border-top: 1px solid #eeeeee;
  951. .describe-view {
  952. display: flex;
  953. align-items: center;
  954. color: #333;
  955. font-size: 24upx;
  956. .price {
  957. font-weight: bold;
  958. font-size: 36upx;
  959. }
  960. }
  961. }
  962. }
  963. </style>