提交 74da1264 authored 作者: 刘旭's avatar 刘旭

测试

上级 8d018bd2
import { request } from '@/utils/request'
// 产品线加入购物车
export const addProductLineCart = (data: any) => request('/wx/productLine/cart', 'POST', data)
// 产品线收藏
export const productLineCollect = (data: any) => request('/wx/productLine/collect', 'POST', data)
\ No newline at end of file
......@@ -3,12 +3,14 @@ import App from './App.vue';
import Model from '@/utils/util';
import uView from './uni_modules/vk-uview-ui';
import config from '@/utils/config';
import { createPinia } from 'pinia';
export function createApp() {
const app = createSSRApp(App);
app.config.globalProperties.$baseUrl = config.baseUrl;
app.config.globalProperties.$model = Model;
app.use(uView);
app.use(createPinia());
return {
app,
};
......
......@@ -186,8 +186,9 @@ let buyNow = (selectShop: any) => {
// 加入产品线
const addProduct = (selectShop: any) => {
skuPopupRef.value.handClose()
let productId: any = getProductId(selectShop.sku_name_arr)
// console.log(selectShop, '加入产品线');
emits('addProduct', selectShop)
emits('addProduct', selectShop, productId)
goodsInfo.value = {}
detailData.value = undefined
detailId.value = undefined
......
......@@ -19,9 +19,10 @@
@touchstart="handleTouchstart($event, index)"
@touchmove.prevent="handleTouchmove($event, index)"
@touchend="handleTouchend"
@tap.prevent="handleTap(index)"
@tap="handleTap(index)"
style="width: 100%; height: 100%;"
>
<!-- @tap="handleTap(index)" -->
<!-- 自定义内容 -->
<view
class="item"
......@@ -33,6 +34,13 @@
</view>
</view>
</template>
<u-action-sheet
:list="sheetList"
v-model="sheetShow"
:cancel-btn="false"
safe-area-inset-bottom
class="action-sheet"
></u-action-sheet>
</view>
</template>
......@@ -58,6 +66,18 @@ export default {
},
data() {
return {
sheetShow: false,
sheetList: [
{
text: '修改规格',
},
{
text: '复制',
},
{
text: '删除',
},
],
// 控件列表
controlsArray: [],
// 每行最大存放的个数
......@@ -126,6 +146,10 @@ export default {
that.controlsArray[s].show = false;
}
that.controlsArray[index].show = true;
that.sheetShow = true;
},
handleLongPress() {
console.log('chanan');
},
/** 处理手指触摸后移动 */
handleTouchmove(event, index) {
......@@ -244,6 +268,8 @@ export default {
</script>
<style scoped lang="scss">
$sheet-heigth: var(--window-bottom);
.drag-and-drop-sort-B {
position: relative;
......@@ -251,4 +277,8 @@ export default {
position: absolute;
}
}
.action-sheet {
bottom: 100px;
}
</style>
......@@ -15,7 +15,6 @@
:show-line="scope.row.show"
:line-color="scope.row.show ? '#0000f0' : ''"
style="margin-left: 20rpx;"
@longPress="handleLongPress"
></u-section>
<view v-else class="add">
<u-icon name="plus" color="#c6c6c6" size="50" @tap="addTabs"></u-icon>
......@@ -37,6 +36,7 @@
</view>
</view>
</view>
<!-- 导航 -->
<uni-goods-nav
class="goods-nav"
:fill="true"
......@@ -46,13 +46,15 @@
@buttonClick="buttonClick"
/>
</view>
<!-- 选择弹出框 -->
<category-popup
ref="categoryRef"
:show="showPopup"
@close="handleClose"
@categoryData="initCategory"
/>
<goodsSku ref="goodsSkuRef" @selected="selected" @add-product="addProduct"></goodsSku>
<!-- 产品线sku -->
<goodsSku ref="goodsSkuRef" @add-product="addProduct"></goodsSku>
</template>
<script lang="ts" setup>
......@@ -62,9 +64,13 @@ import dragAndDropSort from './components/drag-and-drop-sort.vue';
import categoryPopup from './components/categoryPopup.vue';
import goodsSku from '@/pages/goods/goodsSku';
import { indexDetails } from '@/api/index';
import { useStore } from '@/store/useStore';
let store = useStore();
console.log(store.lineData);
let baseUrl = config.baseUrl;
let lineList = ref([{}] as any); //右侧tabber数据
let lineList = ref(store.lineData); //右侧tabber数据
let showPopup = ref(false as Boolean);
let categoryRef = ref();
let goodsSkuRef = ref();
......@@ -101,13 +107,12 @@ let onClick = (e: any) => {
icon: 'none',
});
};
let buttonClick = (e: any) => {
console.log(e);
// this.options[2].info++
};
// 长按选择操作
let handleLongPress = () => {};
// 添加产品线产品
let initCategory = (data: any) => {
......@@ -115,30 +120,23 @@ let initCategory = (data: any) => {
uni.showLoading({
title: '加载中...',
});
setTimeout(() => {
goodsSkuRef.value.init(detailData.value, data.id);
goodsSkuRef.value.skuKey = true;
goodsSkuRef.value.skuMode = 5;
uni.hideLoading();
}, 500);
};
// 监听选择规格,及数量
const selected = (data: any) => {
// console.log(data);
// selectedGoodsItem.value = data[0];
// selectedGoodsSum.value = data[1];
};
// 保存到产品线
let addProduct = (data: any) => {
console.log(data, '加入产品线');
let addProduct = (data: any, productId: number) => {
let index = lineList.value.length - 1;
lineList.value.splice(index, 0, {
name: data.goods_name,
url: data.image,
goodsId: data.goods_id,
number: data.buy_num,
productId: productId,
show: false,
});
store.$patch({
lineData: lineList.value,
});
console.log(store.lineData);
goodsSkuRef.value.skuKey = false;
};
......@@ -151,7 +149,11 @@ const initDetails = (id: number) => {
id,
}).then((res: any) => {
if (res.data.code === 200) {
uni.hideLoading();
detailData.value = res.data.data;
goodsSkuRef.value.init(detailData.value, id);
goodsSkuRef.value.skuKey = true;
goodsSkuRef.value.skuMode = 5;
console.log(res.data.data, '商品详情数据');
}
});
......@@ -159,6 +161,8 @@ const initDetails = (id: number) => {
</script>
<style lang="scss" scoped>
$nav-heigth: var(--window-bottom);
* {
-webkit-touch-callout: none; /*系统默认菜单被禁用*/
-webkit-user-select: none; /*webkit浏览器*/
......@@ -212,6 +216,6 @@ const initDetails = (id: number) => {
width: 100%;
position: fixed;
bottom: 50px;
z-index: 99;
z-index: 0;
}
</style>
import { defineStore, createPinia } from 'pinia'
export let useStore = defineStore('productLine', {
state: () => {
return {
lineData: [{}]
}
}
})
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论