Commit 222f1f7a by liuliufashi

update

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