| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- <?php
- ?>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div style="display: flex; justify-content:space-between">
- <span>基础设置</span>
- <div>
- <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="onSubmit">保存配置</el-button>
- </div>
- </div>
- </div>
- <div class="table-body">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-form size="small" ref="form" label-width="180px" :model="form" :rules="rules">
- <el-form-item label="是否启用插件" prop="is_enable">
- <el-switch
- v-model="form.is_enable"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <el-form-item label="自动更新商品售价" prop="auto_update_price">
- <el-switch
- v-model="form.auto_update_price"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <el-form-item v-if="admin_type == 1" label="标准选品库" prop="is_default">
- <el-switch
- v-model="form.is_default"
- :active-value="1"
- :inactive-value="0">
- </el-switch>
- </el-form-item>
- <div v-if="form.is_default">
- <el-form-item prop="app_key" label="AppKey" prop="app_key" :rules="[{required:true, message: 'AppKey不能为空'}]">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="form.app_key"></el-input>
- </el-col>
- </el-form-item>
- <el-form-item prop="secret_key" label="SecretKey" prop="secret_key" :rules="[{required:true, message: 'SecretKey不能为空'}]">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="form.secret_key"></el-input>
- </el-col>
- </el-form-item>
- <el-form-item label="订单发货通知地址">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="order_ship_callback_url" disabled>
- <template #append><el-button @click="copyLink(order_ship_callback_url)" class="copy_btn">点击复制</el-button></template>
- </el-input>
- </el-col>
- </el-form-item>
- <el-form-item label="订单配货通知地址">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="order_ready_callback_url" disabled>
- <template #append><el-button @click="copyLink(order_ready_callback_url)" class="copy_btn">点击复制</el-button></template>
- </el-input>
- </el-col>
- </el-form-item>
- <el-form-item label="订单售后通知地址">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="order_refund_callback_url" disabled>
- <template #append><el-button @click="copyLink(order_refund_callback_url)" class="copy_btn">点击复制</el-button></template>
- </el-input>
- </el-col>
- </el-form-item>
- <el-form-item label="商品修改通知地址">
- <el-col :span="24">
- <el-input style="width: 500px" v-model="goods_callback_url" disabled>
- <template #append><el-button @click="copyLink(goods_callback_url)" class="copy_btn">点击复制</el-button></template>
- </el-input>
- </el-col>
- </el-form-item>
- </div>
- <h3 style="padding-left: 107px">定价策略</h3>
- <el-form-item label="售价 定价策略" prop="status">
- <el-radio-group v-model="form.price.price.type" size="medium" class="redio-center">
- <!-- 指导价 -->
- <el-radio label="gonghuojia">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.gonghuojia">
- <template slot="prepend">供货价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <!-- 协议价 -->
- <el-radio label="retail_price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.retail_price">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <el-radio label="price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.price">
- <template slot="prepend">商品价格 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-radio-group>
- <div class="tab_tpis">
- 举例:供货价50元 建议零售价100元<br>
- 供货价 x 定价系数 即 50 x 130% = 65 元<br>
- 建议零售价 x 定价系数 即 100 x 80% = 80 元<br>
- 默认为供货价 x 150%(建议零售价不变,供货价上涨可能导致亏损!)<br>
- </div>
- </el-form-item>
- <!-- 成本价 定价策略 -->
- <el-form-item label="成本价 定价策略" prop="status">
- <el-radio-group v-model="form.price.cost_price.type" size="medium" class="redio-center">
- <!-- 指导价 -->
- <el-radio label="gonghuojia">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.gonghuojia">
- <template slot="prepend">供货价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <!-- 协议价 -->
- <el-radio label="retail_price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.retail_price">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <el-radio label="price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.price">
- <template slot="prepend">商品价格 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-radio-group>
- </el-form-item>
- <!-- 原价 定价策略 -->
- <el-form-item label="原价 定价策略" prop="status">
- <el-radio-group v-model="form.price.original_price.type" size="medium" class="redio-center">
- <!-- 指导价 -->
- <el-radio label="gonghuojia">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.gonghuojia">
- <template slot="prepend">供货价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <!-- 协议价 -->
- <el-radio label="retail_price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.retail_price">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- <el-radio label="price">{{''}}</el-radio>
- <span class="redio-input">
- <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.price">
- <template slot="prepend">商品价格 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-radio-group>
- </el-form-item>
- <div v-if="form.is_default">
- <h3 style="padding-left: 107px">收款设置</h3>
- <el-form-item label="联系二维码" prop="contact_image" >
- <com-attachment v-model="form.contact_image" :multiple="false" :max="1">
- <el-tooltip class="item" effect="dark" content="建议尺寸:500 * 500" placement="top">
- <el-button size="mini">选择图片</el-button>
- </el-tooltip>
- </com-attachment>
- <div v-if="form.contact_image" class="customize-share-title" style="width: 80px; height: 80px; overflow: hidden">
- <el-image mode="aspectFill" width='80px' height='80px' :src="form.contact_image ? form.contact_image : ''"></el-image>
- <el-button v-if="form.contact_image" class="del-btn" size="mini" type="danger" icon="el-icon-close" circle @click="form.contact_image = ''"></el-button>
- </div>
- </el-form-item>
- <el-form-item label="联系电话">
- <el-input style="width: 200px" v-model="form.mobile" placeholder="请输入联系电话"></el-input>
- </el-form-item>
- <el-form-item label="资金低于" prop="min_balance" :rules="[{required: true, message:'请输入资金提醒门槛'}]">
- <el-input style="width: 400px" v-model="form.min_balance" placeholder="请输入资金提醒门槛">
- <template #append>元,红色数值提醒</template>
- </el-input>
- </el-form-item>
- </div>
- </el-form>
- </el-tabs>
- </div>
- <!-- 这个是复制用的容器,已隐藏 -->
- <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
- </el-card>
- </div>
- <script>
- const validateNumber = (rule, value, callback) => {
- if (!(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(value)) {
- callback(new Error('请输入数字值'))
- } else {
- callback()
- }
- };
- const app = new Vue({
- el: '#app',
- data: {
- activeName: '',
- form: {
- is_enable: 0,
- app_key: '',
- secret_key: '',
- auto_update_price: 0,
- contact_image: '',
- mobile: '',
- min_balance: 0,
- price: {
- price: {
- type: 'gonghuojia',
- rate: {
- price: 150,
- gonghuojia: 150,
- retail_price: 150,
- },
- },
- cost_price: {
- type: 'gonghuojia',
- rate: {
- price: 150,
- gonghuojia: 150,
- retail_price: 150,
- },
- },
- original_price: {
- type: 'gonghuojia',
- rate: {
- price: 150,
- gonghuojia: 150,
- retail_price: 150,
- },
- }
- }
- },
- pem_value: '',
- rules: {},
- order_ship_callback_url: '<?= $order_ship_callback_url ?>',
- goods_callback_url: '<?= $goods_callback_url ?>',
- order_ready_callback_url: '<?= $order_ready_callback_url ?>',
- order_refund_callback_url: '<?= $order_refund_callback_url ?>',
- admin_type: '<?= $admin_type ?>',
- },
- created() {
- },
- mounted() {
- // 获取列表首页数据
- this.getData()
- },
- methods: {
- //1.0 跳转详情
- handleClick(tab, event) {
- },
- handleSelectionChange(val) {
- let self = this;
- self.choose_list = [];
- val.forEach(function (item) {
- self.choose_list.push(item.id);
- })
- },
- getData() {
- this.loading = true
- request({
- method: 'get',
- params: {
- r: 'qi-shang-tong/setting/index',
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- if (!e.data.data.price) e.data.data.price = this.form.price
- this.form = Object.assign(this.form, e.data.data)
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- },
- onSubmit() {
- this.$refs['form'].validate((valid) => {
- if (valid) {
- this.loading = true
- request({
- method: 'post',
- params: {
- r: 'qi-shang-tong/setting/index',
- },
- data: this.form
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- } else {
- console.log(valid)
- }
- })
- },
- copyLink(url) { //复制链接
- var clipboard = new ClipboardJS('.copy_btn', {
- text: function() {
- return url;
- }
- });
- clipboard.on('success', (e) => {
- this.$message.success('复制成功!');
- clipboard.destroy()
- });
- clipboard.on('error', (e) => {
- this.$message.error('复制失败!');
- this.clipboard.destroy()
- });
- },
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
- .item-box{
- margin-right: 20px;
- }
- .item-box .label{
- margin-right: 8px;
- }
- .item-box .symbol{
- margin: 0 6px;
- }
- .form-nickname{
- width: 180px;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- .index-video-url{
- width: 300px;
- }
- .index-video-url video{
- width: 100%;
- }
- .index-related-info{
- width: 500px;
- }
- .video-top{
- width: 100%;
- display: flex;
- align-items: flex-start;
- box-sizing: border-box;
- padding: 20px;
- /* opacity: .5; */
- background-color: #FFFFFF;
- }
- .video-top .top-right{
- line-height: 26px;
- }
- .video-top .top-right .top-title{
- font-size: 18px;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- width: 360px;
- }
- .video-top .top-right .wrapper{
- display: flex;
- /* align-items: flex-start; */
- }
- .video-top .top-right .wrapper .to-copy{
- /* color: #03C5FF; */
- margin-left: 20px;
- }
- .video-top .top-right .detail-price{
- color: #BC0100;
- font-size: 18px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- }
- /* .atooltip {
- background: #FFFFFF !important;
- border: none !important;
- } */
- .el-table th>.cell{
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper{
- border-bottom: 1.4px solid #D6D6D6;
- }
- .price_col{
- color: #FF5D05;
- }
- .redio-center {
- display: flex;
- align-items: center;
- }
- .redio-input {
- margin-left: -28px;
- margin-right: 20px;
- }
- </style>
|