template1.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. <template>
  2. <view>
  3. <view class="flex-col bg--w111-fff" :style="{ height: windowHeight + 'px' }">
  4. <view :style="{paddingTop: sysHeight + 'px'}" class="text--w111-999">
  5. <view class="h-80 px-32 flex-y-center">
  6. <text class="iconfont icon-ic_leftarrow fs-40 mr-16" @tap="goBack"></text>
  7. <!-- #ifdef MP -->
  8. <view class="w-468 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
  9. <!-- #endif -->
  10. <!-- #ifndef MP -->
  11. <view class="flex-1 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
  12. <!-- #endif -->
  13. <text class="iconfont icon-ic_search fs-28"></text>
  14. <input class="flex-1 h-full fs-28 pl-18" v-model="keyword" placeholder="请输入商品名称" placeholder-class="text--w111-999" @confirm="searchSubmit" />
  15. <!-- <text class="fs-24 pl-18">请输入商品名称</text> -->
  16. </view>
  17. </view>
  18. </view>
  19. <view class="flex border_e">
  20. <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-678 pl-20 pt-24 pb-24"
  21. show-scrollbar="false">
  22. <view class="inline-block mr-8" v-for="(item,index) in categoryList" :key="index"
  23. @tap="tapNav(index,item)">
  24. <view class="flex-col flex-center">
  25. <view :class="index == navActive ? 'active_pic' : 'scroll_pic'">
  26. <image :src="item.pic" mode="aspectFill"></image>
  27. </view>
  28. <view class="w-120 h-40 flex-center fs-24 text--w111-333"
  29. :class="index == navActive ? 'active_cate_text' : ''">{{item.cate_name}}</view>
  30. </view>
  31. </view>
  32. </scroll-view>
  33. <view class="flex-1 flex-col flex-center fs-24" @tap="openCateDrawer(true)">
  34. <text>全</text>
  35. <text>部</text>
  36. <image class="w-28 h-28 block mt-8" src="@/static/img/all_pic.png"></image>
  37. </view>
  38. </view>
  39. <view class="scroll_box flex flex-1">
  40. <view class="w-168 h-full bg--w111-f5f5f5">
  41. <scroll-view :scroll-top="0" scroll-y="true" class="h-full">
  42. <view class="w-168 h-96 flex-center fs-26 text--w111-666"
  43. v-for="(item,index) in categoryErList"
  44. :key="index"
  45. :class="[{'aside_active': index===tabClick},'aside_' + index]"
  46. @tap="longClick(index,item)">{{item.cate_name}}
  47. </view>
  48. </scroll-view>
  49. </view>
  50. <view class="relative w-full h-full">
  51. <view class="flex-1 pl-24 pr-20 abs-lt" v-if="threeCateList.length">
  52. <view class="flex mt-24 mb-16">
  53. <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-464"
  54. show-scrollbar="false">
  55. <view class="inline-block mr-16" v-for="(item,index) in threeCateList" :key="index"
  56. @tap="threeCateClick(index,item)">
  57. <view
  58. class="w-144 h-56 rd-30rpx bg--w111-f5f5f5 flex-center fs-24 text--w111-333"
  59. :class="index===threeClick?'cate_active':''">{{item.cate_name}}</view>
  60. </view>
  61. </scroll-view>
  62. <view class="w-56 h-56 rd-30rpx bg--w111-f5f5f5 flex-center ml-16"
  63. v-if="threeCateList.length"
  64. @tap="openCateDrawer(false)">
  65. <text class="iconfont icon-ic_downarrow fs-32 text--w111-333"></text>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="h-96" v-if="threeCateList.length"></view>
  70. <view v-else class="mt-24"></view>
  71. <view class="pl-24 pr-20" :class="!threeCateList.length ? 'mt-24' : ''">
  72. <scroll-view :scroll-top="0" scroll-y="true" @scrolltolower="lower" @scroll="scroll"
  73. :style="{'height':scrollHeight + 'px'}">
  74. <!-- 小图模板 -->
  75. <view>
  76. <view class="mb-24 flex justify-between" v-for="(item,index) in tempArr" :key="index"
  77. @tap="goDetail(item)">
  78. <easy-loadimage
  79. :image-src="item.image"
  80. :borderSrc="item.activity_frame.image"
  81. width="176rpx"
  82. height="176rpx"
  83. borderRadius="16rpx"></easy-loadimage>
  84. <view class="flex-1 flex-col justify-between pl-20">
  85. <view class="w-full">
  86. <view class="line1 w-346 fs-28 text-#333 lh-40rpx">{{item.store_name}}</view>
  87. <view class="flex items-end flex-wrap mt-12 w-full">
  88. <BaseTag
  89. :text="label.label_name"
  90. :color="label.color"
  91. :background="label.bg_color"
  92. :borderColor="label.border_color"
  93. :circle="label.border_color ? true : false"
  94. :imgSrc="label.icon"
  95. v-for="(label, idx) in item.store_label" :key="idx"></BaseTag>
  96. </view>
  97. </view>
  98. <view class="flex-between-center">
  99. <view class="flex items-baseline">
  100. <baseMoney :money="item.price" symbolSize="24" integerSize="40" color="#FF7E00"
  101. decimalSize="24" weight>
  102. </baseMoney>
  103. </view>
  104. <view class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff"
  105. @tap.stop="goCartDuo(item)" v-if="item.spec_type">
  106. <text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
  107. </view>
  108. <view v-if="!item.spec_type">
  109. <view
  110. class="flex-center w-48 h-48 rd-30rpx bg-primary text--w111-fff "
  111. @tap.stop="goCartDan(item,index)">
  112. <text class="iconfont icon-ic_ShoppingCart1 fs-30"></text>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. <view v-if="!tempArr.length && !loading">
  120. <emptyPage :title="keyword ? '无搜索结果,换个词试试吧' : '暂无商品,看点别的吧~'"
  121. :src="keyword ? '/statics/images/noSearch.gif' : '/statics/images/empty-box.gif'"></emptyPage>
  122. </view>
  123. <view class="white-box"></view>
  124. </scroll-view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="w-full fixed-lb pb-safe bg--w111-fff">
  130. <view class="w-full h-96 flex-between-center pl-28 pr-12">
  131. <view class="flex-y-center" @tap="getCartList(0)">
  132. <view class="w-96 h-96 rd-50rpx bg-primary flex-center relative cart-icon">
  133. <image src="@/static/img/cart_pic.png" class="w-54 h-54"></image>
  134. <uni-badge class="badge-style" v-if="cartData.cartList.length" :text="totalCartNum"></uni-badge>
  135. </view>
  136. <view class="flex items-baseline ml-24">
  137. <baseMoney :money="totalPrice" symbolSize="32" integerSize="48" decimalSize="32"
  138. color="#333" weight></baseMoney>
  139. <view class="fs-24 text--w111-999 lh-34rpx pl-16" v-show="totalPrice > 0">
  140. 查看明细<text class="iconfont icon-ic_uparrow fs-24"></text>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="w-186 h-72 rd-40rpx flex-center text--w111-fff fs-26 fw-500 bg-primary mr-12"
  145. @tap="subOrder">去结算({{cartData.cartList.length}})</view>
  146. </view>
  147. </view>
  148. <view class="more_box abs-lt w-full bg--w111-fff rd-b-32rpx z-20" v-show="showCateDrawer">
  149. <view :style="{paddingTop: sysHeight + 'px'}">
  150. <view class="h-80 px-32 flex-y-center">
  151. <!-- #ifdef MP -->
  152. <view class="w-508 h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
  153. <!-- #endif -->
  154. <!-- #ifndef MP -->
  155. <view class="w-full h-58 flex-y-center rd-30rpx bg--w111-f5f5f5 px-32">
  156. <!-- #endif -->
  157. <text class="iconfont icon-ic_search fs-28"></text>
  158. <text class="fs-24 text--w111-999 pl-18">请输入商品名称</text>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="pt-32 pl-30 pr-30">
  163. <view v-if="!topNavShow">
  164. <view class="fs-32 text--w111-333" v-if="categoryList.length">
  165. {{categoryList[navActive].cate_name}}
  166. </view>
  167. <view class="grid-column-4 grid-gap-24rpx mt-24">
  168. <view class="w-154 h-56 rd-30rpx flex-center fs-24 text--w111-333 bg--w111-f5f5f5"
  169. v-for="(item,index) in threeCateList" :key="index"
  170. @tap="threeCateClick(index,item)" :class="index===threeClick?'cate_active':''">
  171. {{item.cate_name}}
  172. </view>
  173. </view>
  174. </view>
  175. <view class="grid-column-5 grid-gap-x-22rpx grid-gap-y-32rpx" v-if="topNavShow">
  176. <view class="flex-col flex-center" v-for="(item,index) in categoryList" :key="index"
  177. @tap="tapNav(index,item)">
  178. <view :class="index == navActive ? 'active_pic' : 'scroll_pic'">
  179. <image :src="item.pic" mode="aspectFill"></image>
  180. </view>
  181. <view class="w-120 h-40 flex-center fs-24 text--w111-333"
  182. :class="index == navActive ? 'active_cate_text' : ''">{{item.cate_name}}</view>
  183. </view>
  184. </view>
  185. <view class="flex-center fs-24 text--w111-999 h-80 mt-32" @tap="closeCateDrawer">
  186. <text>点击收起 <text class="iconfont icon-ic_uparrow pl-4 fs-24"></text> </text>
  187. </view>
  188. </view>
  189. </view>
  190. <view class="mask" v-show="showCateDrawer" @tap="closeCateDrawer"></view>
  191. <cartList
  192. ref="cartPopup"
  193. :cartData="cartData"
  194. @closeList="closeList"
  195. @onSelect="selectitem"
  196. @onSelectAll="selectAll"
  197. @onDelCart="cartDelChange"
  198. @onCartConfirm="subOrder"
  199. @onCartNum="cartNumChange">
  200. </cartList>
  201. <productWindow
  202. ref="productWindow"
  203. :attr="attr"
  204. :cartButton="storeInfo.cart_button"
  205. :productId="id"
  206. @myevent="onMyEvent"
  207. @ChangeAttr="ChangeAttr"
  208. @ChangeCartNum="ChangeCartNumDuo"
  209. @attrVal="attrVal"
  210. @iptCartNum="iptCartNum"
  211. @deliveryFun="deliveryFun"
  212. @onAddressId="onAddressId"
  213. @onstoreId="onstoreId"
  214. @goCat="goCatNum"></productWindow>
  215. </view>
  216. </template>
  217. <script>
  218. let windowHeight = uni.getSystemInfoSync().windowHeight;
  219. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  220. import { adminCategory, adminProList, adminCartList } from "@/api/admin.js"
  221. import {getAttr,postCartNum} from '@/api/store.js';
  222. import {mapState,mapGetters} from 'vuex';
  223. import {toLogin} from '@/libs/login.js';
  224. import skuSelect from '../../components/skuSelect.js'
  225. import emptyPage from '@/components/emptyPage.vue';
  226. import productWindow from "../../components/productWindow.vue"
  227. import cartList from "../../components/cartList.vue"
  228. export default {
  229. props: {
  230. userId:{
  231. type: [Number, String],
  232. default: 0
  233. },
  234. touristId:{
  235. type: Number,
  236. default: 0
  237. }
  238. },
  239. data() {
  240. return {
  241. windowHeight: windowHeight,
  242. showCateDrawer: false,
  243. sysHeight: sysHeight,
  244. categoryList: [],
  245. navActive: 0,
  246. categoryTitle: '',
  247. categoryErList: [],
  248. tabLeft: 0,
  249. isWidth: 0, //每个导航栏占位
  250. tabClick: 0, //导航栏被点击
  251. iSlong: false,
  252. tempArr: [],
  253. loading: false,
  254. loadend: false,
  255. loadTitle: '加载更多',
  256. page: 1,
  257. limit: 10,
  258. cid: 0, //一级分类
  259. sid: 0, //二级分类
  260. tid: 0, //三级分类
  261. keyword:'',
  262. isAuto: false, //没有授权的不会自动授权
  263. isShowAuth: false, //是否隐藏授权
  264. attr: {
  265. cartAttr: false,
  266. productAttr: [],
  267. productSelect: {},
  268. deliveryType: [],
  269. isType: 0,
  270. },
  271. productValue: [],
  272. attrValue: '', //已选属性
  273. storeName: '', //多属性产品名称
  274. id: 0,
  275. cartData: {
  276. cartList: [],
  277. iScart: false
  278. },
  279. totalPrice: 0.00,
  280. totalCartNum: 0,
  281. lengthCart: 0,
  282. is_vip: 0, //是否是会员
  283. cart_num: 0,
  284. storeInfo: {},
  285. scrollHeight: 0,
  286. threeCateList: [],
  287. threeClick: 0,
  288. topNavShow: true,
  289. selectSku: {},
  290. skuArr: [],
  291. addressId: '',
  292. store_id: '',
  293. delivery_type: 1,
  294. }
  295. },
  296. components: {
  297. productWindow,
  298. emptyPage,
  299. cartList
  300. },
  301. mixins: [skuSelect],
  302. computed: {
  303. ...mapState({
  304. cartNum: state => state.indexData.cartNum
  305. }),
  306. ...mapGetters(['isLogin', 'uid', 'cartNum']),
  307. },
  308. watch:{
  309. cartNum(){
  310. this.getCartList(1);
  311. }
  312. },
  313. mounted() {
  314. this.getAllCategory();
  315. setTimeout(() => {
  316. this.getScrollHeight();
  317. }, 500);
  318. if(this.isLogin){
  319. this.getCartList(1);
  320. }
  321. uni.$on('newAttrNum', (data) => {
  322. if (data.length) {
  323. this.tempArr.forEach((item) => {
  324. data.forEach(j => {
  325. if (item.id == j.id) {
  326. item.cart_num = j.num
  327. }
  328. })
  329. })
  330. }
  331. })
  332. uni.$on('newCartNum', (data) => {
  333. if (data.length) {
  334. this.tempArr.forEach((item) => {
  335. data.forEach(j => {
  336. if (item.id == j.product_id) {
  337. item.cart_num = 0
  338. }
  339. })
  340. })
  341. }
  342. })
  343. },
  344. methods: {
  345. getScrollHeight() {
  346. let sysH = uni.getSystemInfoSync().statusBarHeight;
  347. this.scrollHeight = windowHeight - 138 - sysH;
  348. },
  349. getAllCategory() {
  350. let that = this;
  351. adminCategory().then(res => {
  352. if (!res.data.length) return
  353. let data = res.data;
  354. that.categoryTitle = data[0].cate_name;
  355. that.cid = data[0].id;
  356. that.sid = 0;
  357. that.tid = 0;
  358. that.navActive = 0;
  359. that.tabClick = 0;
  360. that.categoryList = data;
  361. that.categoryErList = res.data[0].children ? res.data[0].children : [];
  362. that.threeCateList = res.data[0].children[0].children ? res.data[0].children[0].children : [];
  363. if (this.threeCateList.length) {
  364. this.threeCateList.unshift({
  365. cate_name: '全部商品',
  366. id: 0
  367. })
  368. }
  369. that.page = 1;
  370. that.loadend = false;
  371. that.tempArr = [];
  372. that.productslist();
  373. })
  374. },
  375. // 产品列表
  376. productslist() {
  377. let that = this;
  378. if (that.loadend) return;
  379. if (that.loading) return;
  380. that.loading = true;
  381. that.loadTitle = '';
  382. adminProList({
  383. page: that.page,
  384. limit: that.limit,
  385. type: 1,
  386. cid: that.cid,
  387. sid: that.sid,
  388. tid: that.tid,
  389. keyword:that.keyword,
  390. product_type:[0],
  391. user_uid:that.userId,
  392. }).then(res => {
  393. let list = res.data,
  394. loadend = list.length < that.limit;
  395. that.tempArr = that.$util.SplitArray(list, that.tempArr);
  396. that.$set(that, 'tempArr', that.tempArr);
  397. that.loading = false;
  398. that.loadend = loadend;
  399. that.loadTitle = loadend ? "没有更多内容啦~" : "加载更多";
  400. that.page = that.page + 1;
  401. }).catch(err => {
  402. that.loading = false;
  403. that.loadTitle = '加载更多'
  404. });
  405. },
  406. tapNav(index, item) {
  407. uni.pageScrollTo({
  408. duration: 0,
  409. scrollTop: 0
  410. })
  411. let list = this.categoryList[index];
  412. this.navActive = index;
  413. this.categoryTitle = list.cate_name;
  414. this.categoryErList = item.children ? item.children : [];
  415. this.threeCateList = [];
  416. if (this.categoryErList.length) {
  417. this.threeCateList = item.children[0].children ? item.children[0].children : [];
  418. if (this.threeCateList && !this.haveAll(this.threeCateList)) {
  419. this.threeCateList.unshift({
  420. cate_name: '全部商品',
  421. id: 0
  422. })
  423. }
  424. }
  425. this.tabClick = 0;
  426. this.tabLeft = 0;
  427. this.cid = list.id;
  428. this.sid = 0;
  429. this.tid = 0;
  430. this.page = 1;
  431. this.loadend = false;
  432. this.tempArr = [];
  433. this.productslist();
  434. },
  435. // 导航栏点击
  436. longClick(index, item) {
  437. this.tabClick = index; //设置导航点击了哪一个
  438. this.threeClick = 0;
  439. this.sid = this.categoryErList[index].id;
  440. this.tid = 0;
  441. this.threeCateList = item.children && item.children.length ? item.children : [];
  442. if (this.threeCateList && this.threeCateList.length && !this.haveAll(this.threeCateList)) {
  443. this.threeCateList.unshift({
  444. cate_name: '全部商品',
  445. id: 0
  446. })
  447. }
  448. this.page = 1;
  449. this.loadend = false;
  450. this.tempArr = [];
  451. this.productslist();
  452. },
  453. threeCateClick(index, item) {
  454. this.threeClick = index;
  455. this.tid = item.id;
  456. this.page = 1;
  457. this.loadend = false;
  458. this.tempArr = [];
  459. this.productslist();
  460. },
  461. searchSubmit(){
  462. this.page = 1;
  463. this.loadend = false;
  464. this.tempArr = [];
  465. this.productslist();
  466. },
  467. deepClone(obj) {
  468. let newObj = Array.isArray(obj) ? [] : {}
  469. if (obj && typeof obj === "object") {
  470. for (let key in obj) {
  471. if (obj.hasOwnProperty(key)) {
  472. newObj[key] = (obj && typeof obj[key] === 'object') ? this.deepClone(obj[key]) : obj[key];
  473. }
  474. }
  475. }
  476. return newObj
  477. },
  478. haveAll(arr) {
  479. let cloneMap = this.deepClone(arr),
  480. list = [];
  481. cloneMap.forEach(item => {
  482. list.push(item.id);
  483. })
  484. return list.includes(0) ? true : false
  485. },
  486. // 生成订单;
  487. subOrder() {
  488. let that = this,
  489. list = that.cartData.cartList,
  490. ids = [];
  491. if (list.length) {
  492. list.forEach(item => {
  493. if (item.attrStatus && item.status) {
  494. ids.push(item.id)
  495. }
  496. });
  497. uni.navigateTo({
  498. url: `/pages/behalf/order_confirm/index?cartId=${ids.join(',')}&uid=${this.userId}&news=0`
  499. });
  500. that.cartData.iScart = false;
  501. } else {
  502. return that.$util.Tips({
  503. title: '请选择产品'
  504. });
  505. }
  506. },
  507. // 计算总价;
  508. getTotalPrice() {
  509. let that = this,
  510. list = that.cartData.cartList,
  511. totalPrice = 0.00,
  512. totalCartNum = 0;
  513. list.forEach(item => {
  514. if (item.attrStatus && item.status) {
  515. totalPrice = that.$util.$h.Add(totalPrice, that.$util.$h.Mul(item.cart_num, item.truePrice));
  516. }
  517. totalCartNum = that.$util.$h.Add(totalCartNum, item.cart_num);
  518. })
  519. that.$set(that, 'totalPrice', totalPrice);
  520. that.$set(that, 'totalCartNum', totalCartNum);
  521. },
  522. getCartList(iSshow) {
  523. let that = this;
  524. adminCartList(this.userId,{
  525. tourist_uid: this.touristId
  526. }).then(res => {
  527. res.data.map(item=>{
  528. this.$set(item,'select',false);
  529. })
  530. that.$set(that.cartData, 'cartList', res.data);
  531. if (res.data.length) {
  532. that.$set(that.cartData, 'iScart', iSshow ? false : !that.cartData.iScart);
  533. } else {
  534. that.$set(that.cartData, 'iScart', false);
  535. }
  536. that.getTotalPrice();
  537. })
  538. },
  539. // 商品详情接口;
  540. getAttrs(id) {
  541. let that = this;
  542. getAttr(id, 0).then(res => {
  543. // uni.hideLoading();
  544. that.$set(that.attr, 'productAttr', res.data.productAttr);
  545. that.$set(that, 'productValue', res.data.productValue);
  546. that.$set(that, 'is_vip', res.data.storeInfo.is_vip);
  547. that.$set(that, 'storeInfo', res.data.storeInfo);
  548. that.skuArr = [];
  549. for (let key in res.data.productValue) {
  550. let obj = res.data.productValue[key];
  551. that.skuArr.push(obj)
  552. }
  553. if (!that.skuArr.length) {
  554. that.skuArr = [{
  555. image: this.storeInfo.image,
  556. suk: this.storeInfo.store_name,
  557. price: this.storeInfo.price
  558. }];
  559. }
  560. this.$set(this, "selectSku", that.skuArr[0]);
  561. that.DefaultSelect();
  562. })
  563. },
  564. //点击sku图片打开轮播图
  565. showImg(index) {
  566. this.$refs.cusPreviewImg.open(this.selectSku.suk)
  567. },
  568. //滑动轮播图选择商品
  569. changeSwitch(e) {
  570. let productSelect = this.skuArr[e];
  571. this.$set(this, 'selectSku', productSelect);
  572. var skuList = productSelect.suk.split(',');
  573. skuList.forEach((i, index) => {
  574. this.$set(this.attr.productAttr[index], 'index', skuList[index]);
  575. })
  576. if (productSelect) {
  577. this.$set(this.attr.productSelect, 'image', productSelect.image);
  578. this.$set(this.attr.productSelect, 'price', productSelect.price);
  579. this.$set(this.attr.productSelect, 'stock', productSelect.stock);
  580. this.$set(this.attr.productSelect, 'unique', productSelect.unique);
  581. this.$set(this.attr.productSelect, 'cart_num', 1);
  582. this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
  583. this.$set(this, 'attrValue', productSelect.suk);
  584. this.$set(this, 'attrTxt', '已选择');
  585. }
  586. },
  587. // 去详情页
  588. goDetail(item) {
  589. if(item.spec_type){
  590. this.goCartDuo(item);
  591. }else{
  592. this.goCartDan(item);
  593. }
  594. },
  595. closeCateDrawer() {
  596. this.showCateDrawer = false;
  597. },
  598. openCateDrawer(type) {
  599. this.topNavShow = type;
  600. this.showCateDrawer = true;
  601. },
  602. lower(e) {
  603. this.productslist();
  604. },
  605. scroll(e) {
  606. uni.$emit('scroll');
  607. },
  608. goBack(){
  609. uni.navigateBack()
  610. },
  611. // 获取配送方式
  612. deliveryFun(e) {
  613. this.delivery_type = e;
  614. },
  615. // 获取自提地址id
  616. onstoreId(row,flag) {
  617. // this.storeList = row;
  618. if(flag == 2 || flag == 3){
  619. this.store_id = row.id;
  620. // this.store_name = row.name;
  621. // this.getStoreDetail(row.id);
  622. }else{
  623. // this.getStoreDetail(0,this.storeInfo.pid);
  624. }
  625. },
  626. // 获取配送地址id
  627. onAddressId(row) {
  628. this.addressId = row.id
  629. },
  630. }
  631. }
  632. </script>
  633. <style lang="scss" scoped>
  634. .scroll_box {
  635. overflow: hidden;
  636. }
  637. .aside_active {
  638. background-color: #fff;
  639. width: 100%;
  640. text-align: center;
  641. color: $primary-admin;
  642. font-weight: 500;
  643. position: relative;
  644. &::after {
  645. content: '';
  646. width: 6rpx;
  647. height: 48rpx;
  648. background-color: $primary-admin;
  649. position: absolute;
  650. left: 0;
  651. top: 50%;
  652. transform: translateY(-50%);
  653. }
  654. }
  655. .cate_active {
  656. color: $primary-admin;
  657. background: $light-primary-admin;
  658. border: 1rpx solid $primary-admin;
  659. }
  660. .text-primary{
  661. color: $primary-admin;
  662. }
  663. .bg-primary{
  664. background: $primary-admin;
  665. }
  666. .bg-primary-light {
  667. background: $light-primary-admin;
  668. }
  669. .cart-icon{
  670. margin-left: -4rpx;
  671. top: -20rpx;
  672. }
  673. .border_e {
  674. border-bottom: 1px solid #eee;
  675. }
  676. .active_pic {
  677. width: 104rpx;
  678. height: 104rpx;
  679. background-color: #fff;
  680. padding: 3rpx;
  681. border-radius: 50%;
  682. border: 3rpx solid $primary-admin;
  683. image {
  684. width: 100%;
  685. height: 100%;
  686. border-radius: 50%;
  687. }
  688. }
  689. .scroll_pic {
  690. image {
  691. width: 92rpx;
  692. height: 92rpx;
  693. border-radius: 50%;
  694. }
  695. }
  696. .active_cate_text {
  697. background: $primary-admin;
  698. color: #fff;
  699. border-radius: 20rpx;
  700. margin-top: 8rpx;
  701. }
  702. .badge-style {
  703. position: absolute;
  704. top: -10rpx;
  705. right: -20rpx;
  706. /deep/ .uni-badge--error {
  707. background-color: $primary-admin !important;
  708. }
  709. }
  710. .white-box{
  711. height: calc(300rpx + env(safe-area-inset-bottom));
  712. }
  713. </style>