|
|
|
@ -127,63 +127,77 @@
|
|
|
|
<skuEdit ref="skuEditRef" :skuGroup="skuGroup"
|
|
|
|
<skuEdit ref="skuEditRef" :skuGroup="skuGroup"
|
|
|
|
:Pdata="{ skuDefault, skuLibrary, skuGroup, use_sku: model.use_sku }">
|
|
|
|
:Pdata="{ skuDefault, skuLibrary, skuGroup, use_sku: model.use_sku }">
|
|
|
|
</skuEdit>
|
|
|
|
</skuEdit>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="h-2 bg-gray-100"></view>
|
|
|
|
<view class="h-2 bg-gray-100"></view>
|
|
|
|
<view>
|
|
|
|
|
|
|
|
<view style="font-size: 36rpx;border-bottom: 1rpx solid #F0F0F0;display: flex;flex-wrap: wrap;align-items: center;">
|
|
|
|
<view class="p-3 rounded mb-2"
|
|
|
|
<view
|
|
|
|
style="display: flex;justify-content: space-between; align-items: center;margin-bottom: 0;">
|
|
|
|
:style="{
|
|
|
|
<div class="name mb-2 text-xs">商品详情</div>
|
|
|
|
margin: '20rpx',
|
|
|
|
<view class="bg-white px-3 py-2 rounded flex items-center" @click="show_detail = true"
|
|
|
|
fontWeight: formats.bold ? '800' : '400'
|
|
|
|
style="color: #0083ff;align-items: center;display: flex;">
|
|
|
|
}"
|
|
|
|
编辑<wd-icon name="arrow-right" color="#0083ff" />
|
|
|
|
@click="format('bold', (formats.bold ? false : true))">加粗</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.italic ? '800' : '400'
|
|
|
|
|
|
|
|
}"
|
|
|
|
|
|
|
|
@click="format('italic', (formats.italic ? false : true))">斜体</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.underline ? '800' : '400'
|
|
|
|
|
|
|
|
}"
|
|
|
|
|
|
|
|
@click="format('underline', (formats.underline ? false : true))">下划线</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.align == 'center' ? '800' : '400'
|
|
|
|
|
|
|
|
}"
|
|
|
|
|
|
|
|
@click="format('align', (formats.align == 'center' ? 'left' : 'center'))">居中</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view style="margin: 20rpx;" >
|
|
|
|
|
|
|
|
<yUpload :width="40" :height="40" v-model="editor_upload" :size="4"></yUpload>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view style="padding: 10px;">
|
|
|
|
</view>
|
|
|
|
<editor style="min-height: 70vh;" id="editor" class="ql-container"
|
|
|
|
|
|
|
|
placeholder="开始输入..." show-img-size show-img-toolbar
|
|
|
|
<view style="position: fixed;left: 0;right: 0;bottom: 0;top: 0;z-index: 999;" v-if="show_detail">
|
|
|
|
@statuschange="onStatusChange"
|
|
|
|
<view class="wrapper" style="background: #FFF;height: 100vh;">
|
|
|
|
show-img-resize :read-only="false" @ready="onEditorReady">
|
|
|
|
<view>
|
|
|
|
</editor>
|
|
|
|
<view
|
|
|
|
|
|
|
|
style="font-size: 36rpx;border-bottom: 1rpx solid #F0F0F0;display: flex;flex-wrap: wrap;align-items: center;">
|
|
|
|
|
|
|
|
<view :style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.bold ? '800' : '400'
|
|
|
|
|
|
|
|
}" @click="format('bold', (formats.bold ? false : true))">加粗</view>
|
|
|
|
|
|
|
|
<view :style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.italic ? '800' : '400'
|
|
|
|
|
|
|
|
}" @click="format('italic', (formats.italic ? false : true))">斜体</view>
|
|
|
|
|
|
|
|
<view :style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.underline ? '800' : '400'
|
|
|
|
|
|
|
|
}" @click="format('underline', (formats.underline ? false : true))">下划线</view>
|
|
|
|
|
|
|
|
<view :style="{
|
|
|
|
|
|
|
|
margin: '20rpx',
|
|
|
|
|
|
|
|
fontWeight: formats.align == 'center' ? '800' : '400'
|
|
|
|
|
|
|
|
}" @click="format('align', (formats.align == 'center' ? 'left' : 'center'))">居中</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view style="margin: 20rpx;">
|
|
|
|
|
|
|
|
<yUpload :width="40" :height="40" v-model="editor_upload" :size="4"></yUpload>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
style="padding: 10px 30rpx;height: calc(100vh - var(--window-top) - var(--status-bar-height) - 260rpx);">
|
|
|
|
|
|
|
|
<editor style="min-height: 30vh;height: 100%;" id="editor" class="ql-container"
|
|
|
|
|
|
|
|
placeholder="开始输入..." show-img-size show-img-toolbar @statuschange="onStatusChange"
|
|
|
|
|
|
|
|
show-img-resize :read-only="false" @ready="onEditorReady">
|
|
|
|
|
|
|
|
</editor>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view
|
|
|
|
|
|
|
|
style="display: flex;justify-content: space-around;align-items: center;border-top: 1rpx solid #F0F0F0;padding: 20rpx;">
|
|
|
|
|
|
|
|
<wd-button type="info" @click="show_detail = false">取消</wd-button>
|
|
|
|
|
|
|
|
<wd-button type="primary" @click="yDetail">确认</wd-button>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</wd-cell-group>
|
|
|
|
</wd-cell-group>
|
|
|
|
<view class="footer mt-4">
|
|
|
|
<view class="footer mt-4">
|
|
|
|
<wd-button @click="saveGoods" type="primary" size="large" block>保存</wd-button>
|
|
|
|
<wd-button @click="saveGoods" type="primary" size="large" block>保存</wd-button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</wd-form>
|
|
|
|
</wd-form>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import quill from "quill";
|
|
|
|
import quill from "quill";
|
|
|
|
window.Quill = quill;
|
|
|
|
window.Quill = quill;
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
ref,
|
|
|
|
ref,
|
|
|
|
watch
|
|
|
|
watch
|
|
|
|
@ -278,13 +292,14 @@
|
|
|
|
fileList.value.splice(index, 1);
|
|
|
|
fileList.value.splice(index, 1);
|
|
|
|
resolve(true);
|
|
|
|
resolve(true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const editorCtx = ref(null);
|
|
|
|
const editorCtx = ref(null);
|
|
|
|
|
|
|
|
const show_detail = ref(false)
|
|
|
|
const onEditorReady = () => {
|
|
|
|
const onEditorReady = () => {
|
|
|
|
// #ifdef MP-BAIDU
|
|
|
|
// #ifdef MP-BAIDU
|
|
|
|
editorCtx.value = requireDynamicLib('editorLib').createEditorContext('editor');
|
|
|
|
editorCtx.value = requireDynamicLib('editorLib').createEditorContext('editor');
|
|
|
|
// #endif
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS || MP-WEIXIN || H5
|
|
|
|
// #ifdef APP-PLUS || MP-WEIXIN || H5
|
|
|
|
uni.createSelectorQuery().select('#editor').context((res) => {
|
|
|
|
uni.createSelectorQuery().select('#editor').context((res) => {
|
|
|
|
editorCtx.value = res.context
|
|
|
|
editorCtx.value = res.context
|
|
|
|
@ -295,11 +310,11 @@
|
|
|
|
const onStatusChange = (e) => {
|
|
|
|
const onStatusChange = (e) => {
|
|
|
|
formats.value = e.detail
|
|
|
|
formats.value = e.detail
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const format = (name, value) => {
|
|
|
|
const format = (name, value) => {
|
|
|
|
editorCtx.value.format(name, value)
|
|
|
|
editorCtx.value.format(name, value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const editor_upload = ref([]);
|
|
|
|
const editor_upload = ref([]);
|
|
|
|
watch(editor_upload, (newX) => {
|
|
|
|
watch(editor_upload, (newX) => {
|
|
|
|
if (newX && newX.length > 0) {
|
|
|
|
if (newX && newX.length > 0) {
|
|
|
|
@ -312,12 +327,38 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
editor_upload.value = []
|
|
|
|
editor_upload.value = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(newX, `newX is`)
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(show_detail, (newX) => {
|
|
|
|
|
|
|
|
if (newX) {
|
|
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
|
|
title: '加载中'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
|
|
editorCtx.value.setContents({
|
|
|
|
|
|
|
|
html: model.value.detail
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const yDetail = async (e) => {
|
|
|
|
|
|
|
|
let detail = ''
|
|
|
|
|
|
|
|
await editorCtx.value.getContents({
|
|
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
|
|
model.value.detail = res.html
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
show_detail.value = false
|
|
|
|
|
|
|
|
console.log(model.value.detail, 'model.value')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {Ref<Model>} */
|
|
|
|
/** @type {Ref<Model>} */
|
|
|
|
const model = ref({
|
|
|
|
const model = ref({
|
|
|
|
classify_list: [], // 商品分类组
|
|
|
|
classify_list: [], // 商品分类组
|
|
|
|
@ -409,13 +450,7 @@
|
|
|
|
skuLibrary.value = res.data.goods_sku;
|
|
|
|
skuLibrary.value = res.data.goods_sku;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
skuGroup.value = res.data.sku_group ? res.data.sku_group : [];
|
|
|
|
skuGroup.value = res.data.sku_group ? res.data.sku_group : [];
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
editorCtx.value.setContents({
|
|
|
|
|
|
|
|
html: res.data.detail
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
load.value = true;
|
|
|
|
load.value = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
load.value = true;
|
|
|
|
load.value = true;
|
|
|
|
@ -506,21 +541,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
const shop_classify_list = model.value.shop_classify_list.map(item => JSON.parse(item));
|
|
|
|
const shop_classify_list = model.value.shop_classify_list.map(item => JSON.parse(item));
|
|
|
|
const classify_list = model.value.classify_list.map(item => JSON.parse(item));
|
|
|
|
const classify_list = model.value.classify_list.map(item => JSON.parse(item));
|
|
|
|
|
|
|
|
|
|
|
|
let detail = ''
|
|
|
|
|
|
|
|
await editorCtx.value.getContents({
|
|
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
|
|
detail = res.html
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res = await goods.goodsEdit({
|
|
|
|
const res = await goods.goodsEdit({
|
|
|
|
...model.value,
|
|
|
|
...model.value,
|
|
|
|
pic_list,
|
|
|
|
pic_list,
|
|
|
|
freight_id,
|
|
|
|
freight_id,
|
|
|
|
shop_classify_list,
|
|
|
|
shop_classify_list,
|
|
|
|
classify_list,
|
|
|
|
classify_list
|
|
|
|
detail
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
if (res.code == 0) {
|
|
|
|
|