123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813 |
- <template>
- <div class="my-share personal-info">
- <div class="common-title-box">
- <h2>订单管理</h2>
- <div class="btn-box">
- <el-button type="primary" size="small" @click="handInvoice"
- >申请发票</el-button
- >
- </div>
- </div>
- <el-table
- :data="orderList"
- @sort-change="handleSort"
- :default-sort="dataSort"
- v-loading="tableLoading"
- :max-height="tableHeight"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="40" fixed> </el-table-column>
- <el-table-column
- type="index"
- label="#"
- width="48"
- :index="(pageNumber - 1) * pageSize + 1"
- >
- </el-table-column>
- <el-table-column prop="sn" label="交易单号" width="200">
- </el-table-column>
- <el-table-column
- prop="pay_time"
- label="交易时间"
- width="180"
- sortable="custom"
- >
- <template slot-scope="scope">
- {{ scope.row.pay_time ? scope.row.pay_time.substring(0, 16) : "-" }}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="购买商品" min-width="220">
- </el-table-column>
- <el-table-column label="类型" width="72">
- <template slot-scope="scope" v-if="scope.row.goods_type >= 0">
- <span
- class="items-type"
- :style="{
- background: typeList[scope.row.goods_type]
- ? typeList[scope.row.goods_type].bg
- : '',
- color: typeList[scope.row.goods_type]
- ? typeList[scope.row.goods_type].color
- : '',
- }"
- >{{
- typeList[scope.row.goods_type]
- ? typeList[scope.row.goods_type].text
- : "-"
- }}</span
- >
- </template>
- </el-table-column>
- <el-table-column prop="goods_study_phase_name" label="学段" width="64">
- </el-table-column>
- <el-table-column prop="study" label="价格" width="154">
- <template slot-scope="scope">
- <span class="currectPrice"
- >¥{{
- scope.row.hasOwnProperty("goods_price_discount")
- ? scope.row.goods_price_discount
- : scope.row.goods_price | cutMoneyFiter
- }}</span
- >
- <span
- class="oldPrice"
- v-if="
- scope.row.hasOwnProperty('goods_price_discount') &&
- scope.row.goods_price_discount !== scope.row.goods_price
- "
- >(¥{{ scope.row.goods_price | cutMoneyFiter }})</span
- >
- </template>
- </el-table-column>
- <el-table-column label="兑换码" width="194">
- <template slot-scope="scope">
- <template v-if="scope.row.is_use_discount_code == 'false'">
- 无
- </template>
- <template v-else>
- <template v-if="scope.row.discount_code">
- <span class="code" :id="'copy-' + scope.row.discount_code">{{
- scope.row.discount_code
- }}</span>
- <svg-icon
- icon-class="copy"
- class="copy"
- @click="CopyToClipboard('copy-' + scope.row.discount_code)"
- ></svg-icon>
- </template>
- <template v-else>-</template>
- </template>
- </template>
- </el-table-column>
- <el-table-column label="支付金额" width="96">
- <template slot-scope="scope">
- <span>¥{{ scope.row.order_amount | cutMoneyFiter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="pay_type_name" label="支付渠道" width="104">
- </el-table-column>
- <el-table-column prop="status" label="交易状态" width="112">
- <template slot-scope="scope">
- <div class="status-box">
- <span
- :style="{ background: statusList[scope.row.order_status].bg }"
- ></span>
- <b
- :style="{ color: statusList[scope.row.order_status].textColor }"
- >{{ scope.row.order_status_name }}</b
- >
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="退款申请状态" width="112">
- <template
- slot-scope="scope"
- v-if="scope.row.is_has_refund_apply === 'true'"
- >
- <div class="status-box">
- <span
- :style="{
- background: refundStatusList[scope.row.refund_apply_status].bg,
- }"
- ></span>
- <b
- :style="{
- color:
- refundStatusList[scope.row.refund_apply_status].textColor,
- }"
- >{{ refundStatusList[scope.row.refund_apply_status].text }}</b
- >
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="refund_apply_submit_time"
- label="退款申请时间"
- width="165"
- >
- </el-table-column>
- <el-table-column prop="refund_amount" label="退款金额" width="100">
- <template slot-scope="scope" v-if="scope.row.refund_apply_status === 2">
- <span>¥{{ scope.row.refund_amount | cutMoneyFiter }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="操作" width="140" fixed="right">
- <template slot-scope="scope">
- <template
- v-if="
- scope.row.is_use_discount_code == 'false' &&
- scope.row.order_status === 1
- "
- >
- <a class="apply" @click="handleApply(scope.row, scope.$index)"
- >申请退款</a
- >
- </template>
- <template
- v-if="
- scope.row.order_status === 1 ||
- scope.row.order_status === 2 ||
- (scope.row.order_status === 3 &&
- scope.row.order_amount !== scope.row.refund_amount)
- "
- >
- <a class="apply" @click="handleToShlef">去查看</a>
- </template>
- <!-- <template v-if="scope.row.operate==='3'">
- <a class="order-detail"><svg-icon icon-class="question-line"></svg-icon>详情</a>
- </template>
- <template v-if="scope.row.operate==='4'">
- <a class="order-detail"><svg-icon icon-class="question-line"></svg-icon>详情</a>
- <a class="apply">申请退款</a>
- </template> -->
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="pageNumber"
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="pageSize"
- layout="total, prev, pager, next, sizes, jumper"
- :total="total_count"
- >
- </el-pagination>
- <div
- class="kefu-box"
- v-if="kefuShow"
- @mouseover="kefuCode = true"
- @mouseleave="kefuCode = false"
- >
- <div v-if="kefuCode" style="background: #ffffff">
- <img src="../../../assets/21st-kefu-code.jpg" />
- <span>扫一扫,添加客服微信</span>
- </div>
- <div v-else>
- <img class="kefu-img" src="../../../assets/kefu.png" />
- <span style="color: #ff3333; font-weight: bold; font-size: 16px"
- >客服咨询入口</span
- >
- </div>
- </div>
- <el-dialog
- title="发票信息"
- :visible.sync="dialogVisible"
- width="700px"
- class="invoice-dialog"
- >
- <el-form :model="invoiceForm" ref="ruleForm" label-width="90px">
- <el-form-item label="创建模式" prop="create_model">
- <el-radio-group v-model="invoiceForm.create_model">
- <el-radio :label="0">多个订单合并申请一张汇总发票</el-radio>
- <el-radio :label="1">每个订单申请一张发票</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="发票类型" prop="invoice_type">
- <el-radio-group
- v-model="invoiceForm.invoice_type"
- @change="handleChangeType"
- >
- <el-radio :label="0">普通发票</el-radio>
- <el-radio :label="1">专用发票</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="抬头类型" prop="invoice_type">
- <el-radio-group
- v-model="invoiceForm.invoice_object"
- :disabled="disabled"
- >
- <el-radio :label="0">个人</el-radio>
- <el-radio :label="1">企业</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="抬头名称" prop="buyer_info_mc">
- <el-input
- v-model="invoiceForm.buyer_info_mc"
- placeholder="必填"
- @blur="handleTrim('invoiceForm', 'buyer_info_mc')"
- ></el-input>
- </el-form-item>
- <template v-if="invoiceForm.invoice_object === 1">
- <el-form-item label="单位税号" prop="buyer_info_sh">
- <el-input
- v-model="invoiceForm.buyer_info_sh"
- placeholder="必填"
- @blur="handleTrim('invoiceForm', 'buyer_info_sh')"
- ></el-input>
- </el-form-item>
- <el-form-item label="注册地址" prop="buyer_info_dz">
- <el-input
- v-model="invoiceForm.buyer_info_dz"
- :placeholder="invoiceForm.invoice_type === 0 ? '选填' : '必填'"
- @blur="handleTrim('invoiceForm', 'buyer_info_dz')"
- ></el-input>
- </el-form-item>
- <el-form-item label="注册电话" prop="buyer_info_dh">
- <el-input
- v-model="invoiceForm.buyer_info_dh"
- :placeholder="invoiceForm.invoice_type === 0 ? '选填' : '必填'"
- @blur="handleTrim('invoiceForm', 'buyer_info_dh')"
- ></el-input>
- </el-form-item>
- <el-form-item label="开户银行" prop="buyer_info_khh">
- <el-input
- v-model="invoiceForm.buyer_info_khh"
- :placeholder="invoiceForm.invoice_type === 0 ? '选填' : '必填'"
- @blur="handleTrim('invoiceForm', 'buyer_info_khh')"
- ></el-input>
- </el-form-item>
- <el-form-item label="银行账号" prop="buyer_info_zh">
- <el-input
- v-model="invoiceForm.buyer_info_zh"
- :placeholder="invoiceForm.invoice_type === 0 ? '选填' : '必填'"
- @blur="handleTrim('invoiceForm', 'buyer_info_zh')"
- ></el-input>
- </el-form-item>
- </template>
- <template v-else>
- <el-form-item label="身份证号" prop="buyer_info_sfzh">
- <el-input
- v-model="invoiceForm.buyer_info_sfzh"
- placeholder="必填"
- @blur="handleTrim('invoiceForm', 'buyer_info_sfzh')"
- ></el-input>
- </el-form-item>
- </template>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button size="small" @click="dialogVisible = false">取 消</el-button>
- <el-button
- size="small"
- type="primary"
- @click="handleSureInvoice"
- :loading="invoiceLoading"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import { cutMoneyFiter } from "@/utils/defined";
- import { getLogin } from "@/api/ajax";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {},
- props: [],
- filters: {
- cutMoneyFiter,
- },
- data() {
- //这里存放数据
- return {
- pageSize: 10,
- pageNumber: 1,
- statusList: {
- 1: {
- text: "支付成功",
- bg: "#00B42A",
- textColor: "#1D2129",
- },
- 2: {
- text: "兑换成功",
- bg: "#165DFF",
- textColor: "#1D2129",
- },
- 4: {
- text: "已退款",
- textColor: "#0FC6C2",
- bg: "#0FC6C2",
- },
- 5: {
- text: "支付失败",
- bg: "#EF21DA",
- textColor: "#EF21DA",
- },
- 3: {
- text: "已撤回",
- bg: "#FF7D00",
- textColor: "#1D2129",
- },
- 0: {
- text: "未支付",
- bg: "#F53F3F",
- textColor: "#F53F3F",
- },
- },
- refundStatusList: {
- 2: {
- text: "审核通过",
- bg: "#00B42A",
- textColor: "#1D2129",
- },
- 0: {
- text: "待审核",
- bg: "#165DFF",
- textColor: "#1D2129",
- },
- 1: {
- text: "驳回",
- bg: "#FF7D00",
- textColor: "#1D2129",
- },
- },
- typeList: {
- 2: {
- text: "报纸",
- color: "#165DFF",
- bg: "#E8F7FF",
- },
- 4: {
- text: "画刊",
- color: "#F53F3F",
- bg: "#FFECE8",
- },
- 3: {
- text: "精读",
- color: "#0FC6C2",
- bg: "#E8FFFB",
- },
- 0: {
- text: "课程",
- color: "#722ED1",
- bg: "#F5E8FF",
- },
- 1: {
- text: "课程",
- color: "#722ED1",
- bg: "#F5E8FF",
- },
- // '5':{
- // text:'报纸专辑',
- // color:'#165DFF',
- // bg:'#E8F7FF'
- // },
- // '6':{
- // text:'画刊专辑',
- // color:'#F53F3F',
- // bg:'#FFECE8'
- // }
- },
- orderList: [],
- total_count: 0,
- dataSort: {
- prop: "pay_time",
- order: "descending",
- },
- tableLoading: false,
- tableHeight: "", // 表格高度
- kefuShow: true, // 是否显示客服
- kefuCode: false, // 显示客服二维码
- multipleSelection: [], // 选中的id
- invoiceForm: {
- create_model: 0,
- invoice_type: 0,
- invoice_object: 0,
- buyer_info_mc: "",
- buyer_info_sh: "",
- buyer_info_dz: "",
- buyer_info_dh: "",
- buyer_info_zh: "",
- buyer_info_khh: "",
- buyer_info_sfzh: "",
- },
- dialogVisible: false,
- disabled: false,
- invoiceLoading: false,
- };
- },
- //计算属性 类似于data概念
- computed: {},
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- handleChangeType(val) {
- if (val === 1) {
- this.disabled = true;
- this.invoiceForm.invoice_object = 1;
- } else {
- this.disabled = false;
- }
- },
- //计算table高度(动态设置table高度)
- getTableHeight() {
- let tableH = 260; //距离页面下方的高度
- let tableHeightDetil = window.innerHeight - tableH;
- if (tableHeightDetil <= 300) {
- this.tableHeight = 300;
- } else {
- this.tableHeight = window.innerHeight - tableH;
- }
- },
- handleSort(value) {
- let dataSort = {
- prop: value.prop,
- order: value.order,
- };
- this.dataSort = dataSort;
- this.getList();
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.pageNumber = 1;
- this.getList();
- },
- handleCurrentChange(val) {
- this.pageNumber = val;
- this.getList();
- },
- CopyToClipboard(element) {
- var doc = document,
- text = doc.getElementById(element),
- range,
- selection;
- if (doc.body.createTextRange) {
- range = doc.body.createTextRange();
- range.moveToElementText(text);
- range.select();
- } else if (window.getSelection) {
- selection = window.getSelection();
- range = doc.createRange();
- range.selectNodeContents(text);
- selection.removeAllRanges();
- selection.addRange(range);
- }
- document.execCommand("copy");
- this.$message({
- message: "复制成功",
- type: "success",
- });
- window.getSelection().removeAllRanges();
- },
- getList() {
- this.tableLoading = true;
- let MethodName = "/ShopServer/Client/OrderManager/PageQueryMyOrderList";
- let order_column_list = [];
- if (this.dataSort != {}) {
- if (this.dataSort.order == "descending") {
- order_column_list = [this.dataSort.prop + ":desc"];
- } else if (this.dataSort.order == "ascending") {
- // 升序不传值
- order_column_list = [this.dataSort.prop];
- }
- } else {
- order_column_list = ["pay_time:desc"];
- }
- let data = {
- page_capacity: this.pageSize,
- cur_page: this.pageNumber,
- order_column_list: order_column_list,
- pay_status: 1,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.tableLoading = false;
- if (res.status === 1) {
- this.orderList = res.order_list;
- this.total_count = res.total_count;
- }
- })
- .catch(() => {
- this.tableLoading = false;
- });
- },
- // 申请退款
- handleApply(obj, index) {
- let data = {
- order_id: obj.id,
- };
- getLogin(
- "/ShopServer/Client/OrderManager/CheckOrderIsCanSubmitRefundApply",
- data
- ).then((res) => {
- if (res.status === 1) {
- if (res.is_can_submit_refund_apply === "true") {
- this.$confirm("确定申请退款吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let Mname =
- "/ShopServer/Client/OrderManager/SubmitOrderRefundApply";
- getLogin(Mname, data).then((res) => {
- if (res.status === 1) {
- this.$message({
- type: "success",
- message: "申请成功!",
- });
- this.getList();
- }
- });
- })
- .catch(() => {});
- } else {
- this.$confirm(res.cannot_submit_reason, "不可退款原因", {
- confirmButtonText: "确定",
- showCancelButton: false,
- type: "warning",
- });
- }
- }
- });
- },
- handleToShlef() {
- this.$router.push({ path: "/bookShelf" });
- },
- handInvoice() {
- if (this.multipleSelection.length === 0) {
- this.$message.warning("请先选择需要开票的订单");
- return;
- }
- this.dialogVisible = true;
- },
- // 复选框
- handleSelectionChange(val) {
- // this.multipleSelection = [];
- val.forEach((item) => {
- this.multipleSelection.push(item.id);
- });
- console.log(this.multipleSelection);
- },
- // 去掉前后空格
- handleTrim(form, fild) {
- this[form][fild] = this[form][fild].trim();
- },
- // 确定开票
- handleSureInvoice() {
- if (!this.invoiceForm.buyer_info_mc) {
- this.$message.warning("请输入抬头名称");
- return;
- }
- if (this.invoiceForm.invoice_object === 0) {
- if (!this.invoiceForm.buyer_info_sfzh) {
- this.$message.warning("请输入身份证号");
- return;
- }
- } else {
- if (!this.invoiceForm.buyer_info_sh) {
- this.$message.warning("请输入单位税号");
- return;
- }
- if (this.invoiceForm.invoice_type === 1) {
- if (!this.invoiceForm.buyer_info_dz) {
- this.$message.warning("请输入注册地址");
- return;
- } else if (!this.invoiceForm.buyer_info_dh) {
- this.$message.warning("请输入注册电话");
- return;
- } else if (!this.invoiceForm.buyer_info_khh) {
- this.$message.warning("请输入开户银行");
- return;
- } else if (!this.invoiceForm.buyer_info_zh) {
- this.$message.warning("请输入银行账号");
- return;
- }
- }
- }
- let MethodName = "/ShopServer/Client/OrderManager/SubmitInvoiceApply";
- let data = {
- order_id_list: this.multipleSelection,
- create_model: this.invoiceForm.create_model,
- invoice_type: this.invoiceForm.invoice_type,
- invoice_object: this.invoiceForm.invoice_object,
- buyer_info_mc: this.invoiceForm.buyer_info_mc,
- buyer_info_sh: this.invoiceForm.buyer_info_sh,
- buyer_info_dz:
- this.invoiceForm.invoice_object === 1
- ? this.invoiceForm.buyer_info_dz
- : "",
- buyer_info_dh:
- this.invoiceForm.invoice_object === 1
- ? this.invoiceForm.buyer_info_dh
- : "",
- buyer_info_zh:
- this.invoiceForm.invoice_object === 1
- ? this.invoiceForm.buyer_info_zh
- : "",
- buyer_info_khh:
- this.invoiceForm.invoice_object === 1
- ? this.invoiceForm.buyer_info_khh
- : "",
- buyer_info_sfzh:
- this.invoiceForm.invoice_object === 1
- ? ""
- : this.invoiceForm.buyer_info_sfzh,
- };
- getLogin(MethodName, data)
- .then((res) => {
- this.invoiceLoading = false;
- if (res.status === 1) {
- this.$message.success("申请成功,稍后请到发票管理查看");
- this.dialogVisible = false;
- this.multipleSelection = [];
- this.invoiceForm = {
- create_model: 0,
- invoice_type: 0,
- invoice_object: 0,
- buyer_info_mc: "",
- buyer_info_sh: "",
- buyer_info_dz: "",
- buyer_info_dh: "",
- buyer_info_zh: "",
- buyer_info_khh: "",
- buyer_info_sfzh: "",
- };
- }
- })
- .catch(() => {
- this.invoiceLoading = false;
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.getTableHeight();
- this.getList();
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .my-share {
- background: #ffffff;
- border-radius: 4px;
- padding: 24px;
- h2 {
- font-weight: 500;
- font-size: 20px;
- line-height: 28px;
- color: #1d2129;
- margin: 0;
- }
- .el-table {
- margin: 24px 0;
- max-width: 100%;
- }
- .el-pagination {
- text-align: right;
- }
- .status-box {
- display: flex;
- align-items: center;
- span {
- width: 6px;
- height: 6px;
- border-radius: 3px;
- margin-right: 8px;
- margin-top: 2px;
- }
- b {
- font-weight: 400;
- font-size: 14px;
- line-height: 22px;
- color: #1d2129;
- }
- }
- .order-detail {
- color: #165dff;
- margin-right: 8px;
- }
- .apply {
- font-size: 14px;
- line-height: 22px;
- color: #165dff;
- margin-right: 10px;
- font-weight: 500;
- }
- .items-type {
- padding: 1px 8px;
- font-weight: 500;
- font-size: 14px;
- line-height: 22px;
- border-radius: 2px;
- }
- .oldPrice {
- color: #86909c;
- margin-left: 8px;
- }
- .code {
- color: #175dff;
- }
- .copy {
- color: #c9cdd4;
- margin-left: 8px;
- cursor: pointer;
- }
- .kefu-box {
- position: fixed;
- right: 0;
- bottom: 300px;
- z-index: 3;
- text-align: center;
- cursor: pointer;
- img {
- width: 150px;
- }
- .kefu-img {
- width: 70px;
- }
- span {
- display: block;
- text-align: center;
- font-size: 12px;
- line-height: 1.4;
- }
- }
- }
- .common-title-box {
- display: flex;
- justify-content: space-between;
- }
- :deep .el-table-column--selection .cell {
- padding: 0 10px !important;
- }
- :deep .el-form-item {
- margin-bottom: 10px;
- }
- </style>
|