合并冲突

master
lemon橪 2021-06-21 14:32:07 +08:00
commit 2b85a5aba1
3 changed files with 101 additions and 107 deletions

View File

@ -34,14 +34,18 @@
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</li> </li>
<li class="hover-color" @click="goUserCenter('/home/MyOrder')"><span class="nav-item">我的订单</span></li> <li @click="goUserCenter('/home/MyOrder')"><span class="nav-item hover-color">我的订单</span></li>
<li class="hover-color" @click="goUserCenter('/home/MyTracks')"><span class="nav-item">我的足迹</span></li> <li @click="goUserCenter('/home/MyTracks')"><span class="nav-item hover-color">我的足迹</span></li>
<li @click="goUserCenter('/home/MsgList')"><span class="nav-item hover-color">我的消息</span></li>
<li v-if="$route.name !== 'Cart'" style="position:relative;"> <li v-if="$route.name !== 'Cart'" style="position:relative;">
<i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i> <i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i>
<Dropdown placement="bottom-start"> <Dropdown placement="bottom-start">
<router-link to="/cart" target="_blank"> <router-link to="/cart" target="_blank">
<span @mouseenter="getCartList"> <span @mouseenter="getCartList">
<Icon size="18" class="cart-icon" type="ios-cart-outline"></Icon> <Icon
size="18"
type="ios-cart-outline"
></Icon>
购物车 购物车
</span> </span>
@ -124,19 +128,19 @@ export default {
}); });
window.open(url.href, "_blank"); window.open(url.href, "_blank");
}, },
myInfo() { myInfo () { //
let url = this.$router.resolve({ let url = this.$router.resolve({
path: "/home", path: "/home",
}); });
window.open(url.href, "_blank"); window.open(url.href, "_blank");
}, },
signOutFun() { signOutFun () { // 退
storage.removeItem("accessToken"); storage.removeItem('accessToken');
storage.removeItem("refreshToken"); storage.removeItem('refreshToken');
storage.removeItem("userInfo"); storage.removeItem('userInfo');
storage.removeItem("cartNum"); storage.removeItem('cartNum');
this.$store.commit("SET_CARTNUM", 0); this.$store.commit('SET_CARTNUM', 0)
this.$router.push("/login"); this.$router.push('/login');
}, },
goUserCenter(path) { goUserCenter(path) {
// //

View File

@ -11,37 +11,42 @@
</div> --> </div> -->
<!-- 普通发票 --> <!-- 普通发票 -->
<div class="nav-content"> <div class="nav-content">
<Form :model="invoiceForm" ref="form" label-position="left" :rules="ruleInline" :label-width="110"> <Form
:model="invoiceForm"
ref="form"
label-position="left"
:rules="ruleInline"
:label-width="110"
>
<FormItem label="发票类型"> <FormItem label="发票类型">
<RadioGroup v-model="invoice" type="button" button-style="solid"> <RadioGroup v-model="invoiceForm.type" type="button" button-style="solid">
<Radio @on-change="changeInvoice" :label="1">电子普通发票</Radio>
<Radio :label="2" :disabled="true">增值税专用发票</Radio>
</RadioGroup>
</FormItem>
<FormItem label="发票抬头">
<RadioGroup v-model="type" @on-change="changeInvoice" type="button" button-style="solid">
<Radio :label="1">个人</Radio> <Radio :label="1">个人</Radio>
<Radio :label="2">单位</Radio> <Radio :label="2">单位</Radio>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem label="个人名称" v-if="type === 1" prop="receiptTitle"> <FormItem
label="发票抬头"
v-if="invoiceForm.type == 2"
prop="receiptTitle"
>
<i-input v-model="invoiceForm.receiptTitle"></i-input> <i-input v-model="invoiceForm.receiptTitle"></i-input>
</FormItem> </FormItem>
<FormItem label="单位名称" v-if="type === 2" prop="receiptTitle"> <FormItem
<i-input v-model="invoiceForm.receiptTitle"></i-input> label="纳税人识别号"
</FormItem> v-if="invoiceForm.type == 2"
<FormItem label="纳税人识别号" v-if="type === 2" prop="taxpayerId"> prop="taxpayerId"
>
<i-input v-model="invoiceForm.taxpayerId"></i-input> <i-input v-model="invoiceForm.taxpayerId"></i-input>
</FormItem> </FormItem>
<FormItem label="发票内容"> <FormItem label="发票内容">
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid"> <RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
<Radio label="不开发票">不开发票</Radio>
<Radio label="商品明细">商品明细</Radio> <Radio label="商品明细">商品明细</Radio>
<Radio label="商品类别">商品类别</Radio>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
</Form> </Form>
<div style="text-align: center"> <div style="text-align: center">
<Button type="primary" :loading="loading" @click="submit"></Button> <Button type="primary" :loading="loading" @click="save"></Button>
<Button type="default" @click="invoiceAvailable = false">取消</Button> <Button type="default" @click="invoiceAvailable = false">取消</Button>
</div> </div>
</div> </div>
@ -49,29 +54,28 @@
</div> </div>
</template> </template>
<script> <script>
import { receiptSelect } from "@/api/cart.js"; import { saveReceipt } from '@/api/member.js';
import { TINumber } from "@/plugins/RegExp.js"; import { TINumber } from '@/plugins/RegExp.js';
export default { export default {
name: "invoiceModal", name: 'invoiceModal',
data () { data () {
return { return {
invoice: 1,
invoiceAvailable: false, // invoiceAvailable: false, //
loading: false, // loading: false, //
invoiceForm: { invoiceForm: { //
//
// //
receiptTitle: "", // receiptTitle: '', //
taxpayerId: "", // taxpayerId: '', //
receiptContent: "商品明细", // receiptContent: '不开发票', //
type: 1 // 1 2
}, },
type: 1, // 1 2 type: 1, // 1 2
ruleInline: { ruleInline: {
taxpayerId: [ taxpayerId: [
{ required: true, message: "请填写纳税人识别号" }, { required: true, message: '请填写纳税人识别号' },
{ pattern: TINumber, message: "请填写正确的纳税人识别号" }, { pattern: TINumber, message: '请填写正确的纳税人识别号' }
], ]
}, }
}; };
}, },
props: ["invoiceData"], props: ["invoiceData"],
@ -80,73 +84,60 @@ export default {
handler(val) { handler(val) {
this.invoiceForm = { ...val }; this.invoiceForm = { ...val };
if (val.taxpayerId) { if (flag) {
this.type = 2; let params = {
} else { receiptTitle: '个人',
this.type = 1; receiptContent: this.invoiceForm.receiptContent
}
},
deep: true,
immeadite: true,
},
},
methods: {
/**
* 选择发票抬头
*/
changeInvoice(val) {
this.$nextTick(() => {
this.type = val;
});
},
/**
* 保存判断
*/
save() {
let flage = true;
//
const { type, receiptTitle, receiptContent } = JSON.parse(
JSON.stringify(this.invoiceForm)
);
//
if (!receiptTitle) {
this.$Message.error("请填写发票抬头!");
flage = false;
return false;
}
if (type == 2) {
this.$refs.form.validate((valid) => {
if (!valid) {
flage = false;
}
});
} else {
delete this.invoiceForm.taxpayerId;
}
return flage;
},
async submit() {
if (this.save()) {
this.loading = true;
let submit = {
way: this.$route.query.way,
...this.invoiceForm,
}; };
let receipt = await receiptSelect(submit); this.loading = true;
if (receipt.success) { saveReceipt(params)
this.$emit("change", true); .then((res) => {
}
this.loading = false; this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
} else {
//
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
let params = {
receiptTitle: this.invoiceForm.receiptTitle,
taxpayerId: this.invoiceForm.taxpayerId,
receiptContent: this.invoiceForm.receiptContent
};
let flag = true;
this.receiptItems.forEach((e) => {
if (e.taxpayerId === params.taxpayerId) {
flag = false;
}
});
if (!flag) {
this.$Message.error('已有当前税号的发票信息,请直接选择已有发票');
} else {
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
}
});
}
}
} }
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -21,11 +21,10 @@ export default {
// buyer: "https://buyer-api.pickmall.cn", // buyer: "https://buyer-api.pickmall.cn",
// seller: "https://store-api.pickmall.cn", // seller: "https://store-api.pickmall.cn",
// manager: "https://admin-api.pickmall.cn" // manager: "https://admin-api.pickmall.cn"
common: "http://192.168.0.109:8890", common: 'http://192.168.0.109:8890',
buyer: "http://192.168.0.109:8888", buyer: 'http://192.168.0.109:8888',
seller: "http://192.168.0.109:8889", seller: 'http://192.168.0.109:8889',
manager: "http://192.168.0.109:8887" manager: 'http://192.168.0.109:8887'
}, },
api_prod: { api_prod: {
common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",