Commit 222f1f7a by liuliufashi

update

parent 13c91000
...@@ -289,7 +289,9 @@ const onEdithandleChange = (info: any) => { ...@@ -289,7 +289,9 @@ const onEdithandleChange = (info: any) => {
}; };
const onSelectPlain = (e: any) => { const onSelectPlain = (e: any) => {
if(e.target.value == '0'){ if(e.target.value == '0'){
formState.price = "1" formState.value.price = "1"
}else{
formState.value.price = ""
} }
value.value = e.target.value; value.value = e.target.value;
......
...@@ -279,7 +279,9 @@ const handleChange = (info: any) => { ...@@ -279,7 +279,9 @@ const handleChange = (info: any) => {
}; };
const onSelectPlain = (e: any) => { const onSelectPlain = (e: any) => {
if(e.target.value == '0'){ if(e.target.value == '0'){
formState.price = "1" formState.value.price = "1"
}else{
formState.value.price = ""
} }
// free 0 // free 0
value.value = e.target.value; value.value = e.target.value;
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<div> <div>
<a-radio-group v-model:value="status"> <a-radio-group v-model:value="status">
<a-radio-button value="3" class="status" @click="onSearch">全部</a-radio-button> <a-radio-button value="3" class="status" @click="onSearch">全部</a-radio-button>
<a-radio-button value="1" class="status" @click="onSearch">正常</a-radio-button> <a-radio-button value="0" class="status" @click="onSearch">正常</a-radio-button>
<a-radio-button value="2" class="status" @click="onSearch">已下架</a-radio-button> <a-radio-button value="1" class="status" @click="onSearch">已下架</a-radio-button>
</a-radio-group> </a-radio-group>
<a-input-search v-model:value="value" placeholder="请输入商品名称" style="width: 200px; margin-left: 10px" <a-input-search v-model:value="value" placeholder="请输入商品名称" style="width: 200px; margin-left: 10px"
@search="onSearchName" /> @search="onSearchName" />
...@@ -20,14 +20,21 @@ ...@@ -20,14 +20,21 @@
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'tags'"> <template v-if="column.key === 'tags'">
<a-button type="primary" @click="onEdit(record)">编辑</a-button> <a-button type="primary" @click="onEdit(record)">编辑</a-button>
<a-popconfirm title="确定要上架这件商品?" ok-text="确定" cancel-text="取消" @confirm="onPush(record)" v-if="record.status == 1">
<a-button type="primary" style="margin-left: 20px">上架</a-button>
</a-popconfirm>
<!-- <a-button type="primary" style="margin-left: 20px">统计</a-button> --> <!-- <a-button type="primary" style="margin-left: 20px">统计</a-button> -->
<a-popconfirm title="确定删除这条数据" ok-text="确定" cancel-text="取消" @confirm="onDel(record)"> <a-popconfirm title="确定要下架这件商品?" ok-text="确定" cancel-text="取消" @confirm="onDel(record)" v-else>
<a-button type="primary" style="margin-left: 20px">删除</a-button> <a-button type="primary" style="margin-left: 20px">下架</a-button>
</a-popconfirm> </a-popconfirm>
</template> </template>
<template v-if="column.key === 'price'"> <template v-if="column.key === 'price'">
<div>{{ record.price / 100 }}</div> <div>{{ record.price / 100 }}</div>
</template> </template>
<template v-if="column.key === 'status'">
<div v-if="record.status === 0" style="color: rgb(12, 191, 33);">正常</div>
<div v-else style="color: #f56c6c;">已下架</div>
</template>
</template> </template>
</a-table> </a-table>
</div> </div>
...@@ -159,11 +166,11 @@ const columns = [ ...@@ -159,11 +166,11 @@ const columns = [
dataIndex: "subject", dataIndex: "subject",
key: "subject", key: "subject",
}, },
{ // {
title: "商品类型", // title: "商品类型",
dataIndex: "sellingmodel", // dataIndex: "sellingmodel",
key: "sellingmodel", // key: "sellingmodel",
}, // },
{ {
title: "商品售卖数", title: "商品售卖数",
key: "sellcount", key: "sellcount",
...@@ -271,7 +278,7 @@ const handleOk = async () => { ...@@ -271,7 +278,7 @@ const handleOk = async () => {
markingprice: modelRef.value.markingprice * 100, markingprice: modelRef.value.markingprice * 100,
status: modelRef.value.status, status: modelRef.value.status,
parent: modelRef.value.parent, parent: modelRef.value.parent,
free: modelRef.value.sellingmodel, // free: modelRef.value.sellingmodel,
sub: [0] sub: [0]
} }
const data: any = await onUpdateGoods(prarms); const data: any = await onUpdateGoods(prarms);
...@@ -295,7 +302,7 @@ const onSearch = async (e:any) => { ...@@ -295,7 +302,7 @@ const onSearch = async (e:any) => {
uid, uid,
} }
const data:any = await onSelectGoods(prarms); const data:any = await onSelectGoods(prarms);
list.value = data.data; list.value = data.data.goods;
pagination.value.total =data.data.count pagination.value.total =data.data.count
}; };
...@@ -359,7 +366,7 @@ const onEdit = (e: any) => { ...@@ -359,7 +366,7 @@ const onEdit = (e: any) => {
modelRef.value.tenantid = e.tenantid modelRef.value.tenantid = e.tenantid
modelRef.value.userid = e.userid modelRef.value.userid = e.userid
modelRef.value.body = e.body modelRef.value.body = e.body
modelRef.value.sellingmodel = e.price ? '1' : '0' // modelRef.value.sellingmodel = e.price ? '1' : '0'
modelRef.value.price = e.price / 100 modelRef.value.price = e.price / 100
modelRef.value.markingprice = e.markingprice / 100 modelRef.value.markingprice = e.markingprice / 100
modelRef.value.free = e.free modelRef.value.free = e.free
...@@ -371,7 +378,7 @@ const { validate } = useForm( ...@@ -371,7 +378,7 @@ const { validate } = useForm(
const onSelectPlain = (e: any) => { const onSelectPlain = (e: any) => {
if (e.target.value === '0') { if (e.target.value === '0') {
modelRef.value.price = "0" modelRef.value.price = "0"
modelRef.value.sellingmodel = e.target.value; // modelRef.value.sellingmodel = e.target.value;
} }
}; };
const onSubmit = () => { const onSubmit = () => {
...@@ -390,13 +397,20 @@ const onDel = async (e: any) => { ...@@ -390,13 +397,20 @@ const onDel = async (e: any) => {
const data = await onUpdateGoods(e); const data = await onUpdateGoods(e);
await init(); await init();
}; };
const onPush = async (e: any) => {
const uid = getUid();
e.status = "0";
e.uid = uid
const data = await onUpdateGoods(e);
await init();
};
const init = async () => { const init = async () => {
const uid = getUid(); const uid = getUid();
const prarms: any = { const prarms: any = {
size: 10, size: 10,
page: 1, page: 1,
strtus: 0, strtus: 3,
uid, uid,
} }
const data:any = await onSelectGoods(prarms); const data:any = await onSelectGoods(prarms);
...@@ -504,6 +518,7 @@ defineExpose({ ...@@ -504,6 +518,7 @@ defineExpose({
upImage, upImage,
pagination, pagination,
tableChange, tableChange,
onPush,
textChange, textChange,
onEditorFocus, onEditorFocus,
beforeUpload, beforeUpload,
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</a-tag> </a-tag>
</span> </span>
</template> </template>
<template v-else-if="column.key === 'status'"> <template v-else-if="column.key ==='status'">
<div v-if="record.status === 0"> <div v-if="record.status === 0">
<span class="ml20" style="color: rgba(12, 191, 33, 1)">良好</span> <span class="ml20" style="color: rgba(12, 191, 33, 1)">良好</span>
</div> </div>
...@@ -53,16 +53,21 @@ ...@@ -53,16 +53,21 @@
</div> </div>
</template> </template>
<template v-else-if="column.key === 'weight'"> <template v-else-if="column.key === 'weight'">
<div>
<a-input-number id="inputNumber" v-model:value="record.weight" :min="1" :max="10" <a-input-number id="inputNumber" v-model:value="record.weight" :min="1" :max="10"
@blur="onChangeWeight(record)" /> @blur="onChangeWeight(record)" />
<span>1-10</span> <span>1-10</span>
</div>
</template> </template>
<template v-else-if="column.key === 'ref'"> <template v-else-if="column.key === 'ref'">
<span> <span>
<a-button danger @click="onSetShowTable(record)">配置</a-button> <a-button danger @click="onSetShowTable(record)" style="color:#695EDC;border-color: #695EDC;">配置</a-button>
</span> </span>
<span> <span v-if="record.paystate === 0">
<a-button danger style="margin-left: 10px" @click="onDis(record)">禁用</a-button> <a-switch :checked="checked1" style="margin-left: 10px" @click="onDis(record)">禁用</a-switch>
</span>
<span v-else>
<a-switch :checked="checked2" style="margin-left: 10px" @click="onDis(record)">禁用</a-switch>
</span> </span>
</template> </template>
</template> </template>
...@@ -176,10 +181,12 @@ const columns = ref<any>([ ...@@ -176,10 +181,12 @@ const columns = ref<any>([
}, },
{ {
title: "权重", title: "权重",
dataIndex: "weight",
key: "weight", key: "weight",
}, },
{ {
title: "操作", title: "操作",
dataIndex: "ref",
key: "ref", key: "ref",
}, },
]); ]);
...@@ -187,6 +194,8 @@ const columns = ref<any>([ ...@@ -187,6 +194,8 @@ const columns = ref<any>([
const list = ref([]); const list = ref([]);
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const checked1 = ref<any>(false)
const checked2 = ref<any>(true)
const status = ref(0); const status = ref(0);
let modelRef = reactive<any>({}); let modelRef = reactive<any>({});
let rulesRef = reactive<any>({}); let rulesRef = reactive<any>({});
...@@ -354,7 +363,7 @@ const onDis = async(e: any) => { ...@@ -354,7 +363,7 @@ const onDis = async(e: any) => {
newData = await onDisableAli(prarms) newData = await onDisableAli(prarms)
} }
if(newData.state === 1){ if(newData.state === 1){
message.success('禁用成功') message.success('成功')
} }
let data:any={ let data:any={
...@@ -387,32 +396,12 @@ onMounted(async () => { ...@@ -387,32 +396,12 @@ onMounted(async () => {
await init(); await init();
let rulesRef; let rulesRef;
let modelRef; let modelRef;
if (query.value.paytype == 1) { if (query.value.paytype == '1') {
columns.value = [ columns.value= columns.value.filter((item:any)=>{
{ return item.key !== 'zfb'
title: "支付通道名称", });
dataIndex: "name",
key: "name",
},
{
title: "微信",
dataIndex: "wx",
key: "wx",
},
{
title: "状态",
key: "status",
dataIndex: "status",
},
{
title: "权重",
key: "weight",
},
{
title: "操作",
key: "ref",
},
];
rulesRef = reactive({ rulesRef = reactive({
mchid: [ mchid: [
{ {
...@@ -454,31 +443,9 @@ onMounted(async () => { ...@@ -454,31 +443,9 @@ onMounted(async () => {
// server_url: "", // server_url: "",
}); });
} else { } else {
columns.value = [ columns.value= columns.value.filter((item:any)=>{
{ return item.key !== 'wx'
title: "支付通道名称", });
dataIndex: "name",
key: "name",
},
{
title: "支付宝",
dataIndex: "zfb",
key: "zfb",
},
{
title: "状态",
key: "status",
dataIndex: "status",
},
{
title: "权重",
key: "weight",
},
{
title: "操作",
key: "ref",
},
];
rulesRef = reactive({ rulesRef = reactive({
alipaypublickey: [ alipaypublickey: [
{ {
...@@ -527,6 +494,8 @@ defineExpose({ ...@@ -527,6 +494,8 @@ defineExpose({
columns, columns,
visible, visible,
route, route,
checked1,
checked2,
showModal, showModal,
handleOk, handleOk,
formState, formState,
......
...@@ -6,15 +6,14 @@ ...@@ -6,15 +6,14 @@
<a-form-item label="选择商品" name="subject" :rules="rulesRef.subject" :label-col="{ span: 2 }" <a-form-item label="选择商品" name="subject" :rules="rulesRef.subject" :label-col="{ span: 2 }"
labelAlign="left"> labelAlign="left">
<div style="width:100%;display: flex;align-items: center;"> <div style="width:100%;display: flex;align-items: center;">
<a-select v-model:value="formState.subject" :default-active-first-option="false" mode="multiple" style="width: 100%" placeholder="请选择商品" @focus="onSubSearch" @search="onSubSearch" @change="onSubSearch" @select="onSelect" @popupScroll="popupScroll"> <a-select v-model:value="formState.subject" :default-active-first-option="false" mode="multiple" style="width: 100%" placeholder="请选择商品" @focus="onSubSearch" @search="onSubSearch" @change="onSubSearch" @select="onSelectss" @popupScroll="popupScroll">
<a-select-option v-for="(item,index) in optionss.list" :itemKey="item" :value="item.subject" :label="index" :key="index" > <a-select-option v-for="(item,index) in optionss.list" :itemKey="item" :value="item.subject" :label="index" :key="index" >
{{item.subject}} {{item.subject}}
</a-select-option> </a-select-option>
</a-select> </a-select>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item label="项目描述" name="shortname" :label-col="{ span: 2 }" labelAlign="left" <a-form-item label="商品简介" name="shortname" :label-col="{ span: 2 }" labelAlign="left" >
:rules="rulesRef.shortname">
<a-input v-model:value="formState.shortname" placeholder="请输入商品描述" :disabled="true" /> <a-input v-model:value="formState.shortname" placeholder="请输入商品描述" :disabled="true" />
</a-form-item> </a-form-item>
<a-form-item label="支付金额" name="price" :label-col="{ span: 2 }" labelAlign="left"> <a-form-item label="支付金额" name="price" :label-col="{ span: 2 }" labelAlign="left">
...@@ -132,7 +131,7 @@ let optionss = reactive<any>({ ...@@ -132,7 +131,7 @@ let optionss = reactive<any>({
let goodspayditch = ref<any>([]) let goodspayditch = ref<any>([])
const props = defineProps(); const props = defineProps();
const dateFormat = 'YYYY/MM/DD'; const dateFormat = 'YYYY/MM/DD';
const endvalue = ref<Dayjs>(dayjs('10:00', 'HH:mm')); const endvalue = ref<Dayjs>();
const optionsWithDisabled = [ const optionsWithDisabled = [
{ value: '微信', label: '1' }, { value: '微信', label: '1' },
{ label: '2', value: '支付宝' }, { label: '2', value: '支付宝' },
...@@ -141,10 +140,13 @@ const optionsWithDisabled = [ ...@@ -141,10 +140,13 @@ const optionsWithDisabled = [
]; ];
const checkboxValue = ref<any>([]) const checkboxValue = ref<any>([])
const onSelectss =(value:any, option:any)=>{ const onSelectss =(value:any, option:any)=>{
console.log(option.itemKey.price,'option.itemKey.price');
formState.value = { formState.value = {
...option.itemKey paymentmodel:'0',
...option.itemKey,
} }
formState.value.paymentmodel = formState.value.paymentmodel+'' price.value = option.itemKey.price/100
} }
const emit = defineEmits(['onBack']); const emit = defineEmits(['onBack']);
...@@ -164,26 +166,28 @@ const rulesRef = reactive({ ...@@ -164,26 +166,28 @@ const rulesRef = reactive({
}); });
const { validate } = useForm(formState, rulesRef); const { validate } = useForm(formState, rulesRef);
const onSelect = (value: any, option: any) => { const onSelect = (value: any, option: any) => {
console.log(option.itemKey.price,'option.itemKey.price');
price.value = option.itemKey.price/100 price.value = option.itemKey.price/100
} }
const onSubmit = () => { const onSubmit = () => {
validate() validate()
.then(async (res) => { .then(async (res) => {
console.log(toRaw(formState.value),'toRaw(formState.value)');
const uid =getUid() const uid =getUid()
const expireendtime = (moment(toRaw(formState.value).expireendtime.$d).format('YYYY-MM-DD'))+(moment(endvalue.value.$d).format('THH:mm:[00][Z]')) const expireendtime = (moment(toRaw(formState.value).expireendtime.$d).format('YYYY-MM-DD'))+(moment(endvalue.value.$d).format('THH:mm:[00][Z]'))
goodspayditch.value.map((item:any)=>{return item.goodsid = toRaw(formState.value).goodsid}) goodspayditch.value.map((item:any)=>{return item.goodsid === toRaw(formState.value).goodsid})
const prarms = { const prarms = {
subject:toRaw(formState.value).subject, subject:toRaw(formState.value).subject,
shortname:toRaw(formState.value).shortname, shortname:toRaw(formState.value).shortname,
paymentmodel:toRaw(formState.value).paymentmodel, paymentmodel:toRaw(formState.value).paymentmodel,
fullphone:toRaw(formState.value).paymentmodel?1:0, fullphone:toRaw(formState.value).fullphone?1:0,
expireendtime:expireendtime, expireendtime:expireendtime,
starttime: moment(new Date()).format('YYYY-MM-DDTHH:mm:[00][Z]'), starttime: moment(new Date()).format('YYYY-MM-DDTHH:mm:[00][Z]'),
goodsid: toRaw(formState.value).goodsid, goodsid: toRaw(formState.value).goodsid,
goodspayditch:goodspayditch.value, goodspayditch:goodspayditch.value,
payment:formState.value.paymentmodel == '1'?price.value*100:priceSet.value*100, payment:formState.value.paymentmodel == '0'?price.value*100:priceSet.value*100,
uid, uid,
remark:toRaw(formState.value).remark remark:toRaw(formState.value).remark
} }
...@@ -261,7 +265,6 @@ const hideModal = () => { ...@@ -261,7 +265,6 @@ const hideModal = () => {
goodspayditch.value[radioValue.paytype-1] = { goodspayditch.value[radioValue.paytype-1] = {
appointpay: radioValue.id, appointpay: radioValue.id,
goodsid: radioValue.id, goodsid: radioValue.id,
goodspayid: formState.value.goodsid,
optpay: radioValue.paytype, optpay: radioValue.paytype,
name: radioValue.name, name: radioValue.name,
random: '1', random: '1',
...@@ -270,11 +273,6 @@ const hideModal = () => { ...@@ -270,11 +273,6 @@ const hideModal = () => {
listValue.value[radioValue.paytype-1] = radioValue listValue.value[radioValue.paytype-1] = radioValue
visible.value = false; visible.value = false;
}; };
watch(formState,(newVal:any) => {
if(newVal.paymentmodel =='0'){
price.value = optionss.value[newVal.subject.index].price/100
}
})
defineExpose({ defineExpose({
endvalue, endvalue,
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<a-form-item label="支付金额" name="price" :label-col="{ span: 2 }" labelAlign="left"> <a-form-item label="支付金额" name="price" :label-col="{ span: 2 }" labelAlign="left">
<a-radio-group v-model:value="formState.paymentmodel" name="radioGroup" class="pay"> <a-radio-group v-model:value="formState.paymentmodel" name="radioGroup" class="pay">
<div style="display: flex;height: 35px;"> <div style="display: flex;height: 35px;">
<a-radio value="0" style="width:150px;">商品默认金额</a-radio> <a-radio value="0" style="width:150px;" >商品默认金额</a-radio>
<a-input-number style="width:200px;height: 35px;" :value="formState.price" :formatter="value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')" <a-input-number style="width:200px;height: 35px;" :value="formState.price" :formatter="value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')"
:parser="value => value.replace(/\$\s?|(,*)/g, '')" :disabled="true"/> :parser="value => value.replace(/\$\s?|(,*)/g, '')" :disabled="true"/>
<div style="width:50px;"></div> <div style="width:50px;"></div>
...@@ -203,11 +203,12 @@ const handleOk =async(e: MouseEvent) => { ...@@ -203,11 +203,12 @@ const handleOk =async(e: MouseEvent) => {
const uid =getUid() const uid =getUid()
const starttime = moment(new Date()).format('YYYY-MM-DDTHH:mm:[00][Z]') const starttime = moment(new Date()).format('YYYY-MM-DDTHH:mm:[00][Z]')
const expireendtime = (moment(value4.value.$d).format('YYYY-MM-DD'))+(moment(value5.value.$d).format('THH:mm:[00][Z]')) const expireendtime = (moment(value4.value.$d).format('YYYY-MM-DD'))+(moment(value5.value.$d).format('THH:mm:[00][Z]'))
formState.value.fullphone = formState.value.fullphone?'1':'0' const fullphone = formState.value.fullphone?'1':'0'
formState.value.payment= formState.value.payment*100 formState.value.payment= formState.value.payment*100
const params={ const params={
...formState.value, ...formState.value,
uid, uid,
fullphone:fullphone
} }
const data:any = await onUpdateGoodsPay(params) const data:any = await onUpdateGoodsPay(params)
if(data.state == 1){ if(data.state == 1){
...@@ -225,6 +226,7 @@ const onEdit = (e: any) => { ...@@ -225,6 +226,7 @@ const onEdit = (e: any) => {
value5.value = dayjs(moment(e.expireendtime).format(('HH:mm')), 'HH:mm') value5.value = dayjs(moment(e.expireendtime).format(('HH:mm')), 'HH:mm')
formState.value.payment = formState.value.payment/100 formState.value.payment = formState.value.payment/100
formState.value.paymentmodel = formState.value.paymentmodel+'' formState.value.paymentmodel = formState.value.paymentmodel+''
formState.value.fullphone =formState.value.fullphone?true:false
showModal() showModal()
} }
const onSearch = async () => { const onSearch = async () => {
...@@ -258,6 +260,8 @@ const onCreatePay = async () => { ...@@ -258,6 +260,8 @@ const onCreatePay = async () => {
isShow.value = !isShow.value isShow.value = !isShow.value
} }
const onCopy = async(e:any) => { const onCopy = async(e:any) => {
console.log(e,'e');
const value = localStorage.getItem('url') || '' const value = localStorage.getItem('url') || ''
try { try {
await toClipboard(`${value}/#/?ditch=${uid}&goodsid=${e.id}&phone=${e.fullphone}`) await toClipboard(`${value}/#/?ditch=${uid}&goodsid=${e.id}&phone=${e.fullphone}`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment