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