| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715 |
- <div id="app" v-cloak>
- <el-card v-loading="loading" style="border:0;min-width: 800px;" shadow="never"
- body-style="background-color: #f3f3f3;padding: 0 0;">
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="172px" style="position: relative"
- size="small" :rules="rules">
- <el-tabs v-model="activeName">
- <!-- 基础设置 -->
- <el-tab-pane label="基础设置" name="first">
- <el-row>
- <el-col :span="24">
- <div class="title">
- <span>基础设置</span>
- </div>
- <div class="form-body">
- <!-- appKey -->
- <el-form-item label="appKey" prop="app_key">
- <el-input @focus="updateHideStatus(1)" v-if="hideStatus_1" readonly
- :placeholder="ruleForm.app_key ? 'app_key 被隐藏,点击查看' : '请填写 app_key'">
- </el-input>
- <el-input v-else v-model="ruleForm.app_key" placeholder="请填写 app_key">
- </el-input>
- </el-form-item>
- <!-- appSecret -->
- <el-form-item label="appSecret" prop="app_secret">
- <el-input @focus="updateHideStatus(2)" v-if="hideStatus_2" readonly
- :placeholder="ruleForm.app_secret ? 'app_secret 被隐藏,点击查看' : '请填写 app_secret'">
- </el-input>
- <el-input v-else v-model="ruleForm.app_secret" placeholder="请填写 app_secret">
- </el-input>
- </el-form-item>
- <!-- 回调地址 -->
- <el-form-item label="回调地址">
- <el-input readonly v-model="ruleForm.callback_url" disabled>
- <el-button
- slot="append"
- class="copy_btn"
- @click="copyLink(ruleForm.callback_url)"
- >复制</el-button>
- </el-input>
- </el-form-item>
- </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <!-- 更新设置 -->
- <el-tab-pane label="更新设置" name="second" v-if="1">
- <el-row>
- <el-col :span="24">
- <div class="title">
- <span>更新设置</span>
- </div>
- <div class="form-body">
- <!-- 自动更新商品现价 -->
- <el-form-item label="自动更新商品价格" prop="status">
- <el-switch v-model="ruleForm.auto_present_price" active-value="1"
- inactive-value="0">
- </el-switch>
- </el-form-item>
- <!-- 自动更新商品基本信息 -->
- <el-form-item label="自动更新商品基本信息" prop="status">
- <el-switch v-model="ruleForm.auto_base_info" active-value="1" inactive-value="0">
- </el-switch>
- </el-form-item>
- </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <!-- 定价策略 -->
- <el-tab-pane label="定价策略" name="third">
- <el-row>
- <el-col :span="24">
- <div class="title">
- <span>定价策略</span>
- </div>
- <div class="form-body">
- <!-- 售价 定价策略 -->
- <el-form-item label="售价 定价策略" prop="sell_strategy">
- <el-radio-group v-model="ruleForm.sell_strategy" size="medium" class="redio-center">
- <!-- 官方销售价 -->
- <el-radio label="1">{{''}}</el-radio>
- <el-form-item prop="sell_guide">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.sell_guide"
- minlength="1" maxlength="3"
- oninput="value=value.replace(/[^\d]/g,'')" required="required">
- <template slot="prepend">官方销售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 采购价 -->
- <el-radio label="2">{{''}}</el-radio>
- <el-form-item prop="sell_sales">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.sell_sales" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">采购价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 建议零售价 -->
- <el-radio label="3">{{''}}</el-radio>
- <el-form-item prop="sell_market">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.sell_market" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- </el-radio-group>
- <div class="tab_tpis">
- 举例:采购价50元 官方销售价100元<br>
- 采购价 x 定价系数 即 50 x 130% = 65 元<br>
- 官方销售价 x 定价系数 即 100 x 80% = 80 元<br>
- </div>
- </el-form-item>
- <!-- 成本价 定价策略 -->
- <el-form-item label="成本价 定价策略" prop="status">
- <el-radio-group v-model="ruleForm.cost_strategy" size="medium" class="redio-center">
- <!-- 官方销售价 -->
- <el-radio label="1">{{''}}</el-radio>
- <el-form-item prop="cost_guide">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.cost_guide" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">官方销售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 采购价 -->
- <el-radio label="2">{{''}}</el-radio>
- <el-form-item prop="cost_sales">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.cost_sales" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">采购价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 建议零售价 -->
- <el-radio label="3">{{''}}</el-radio>
- <el-form-item prop="cost_market">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.cost_market" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- </el-radio-group>
- <div class="tab_tpis">
- </div>
- </el-form-item>
- <!-- 原价 定价策略 -->
- <el-form-item label="原价 定价策略" prop="status">
- <el-radio-group v-model="ruleForm.original_strategy" size="medium"
- class="redio-center">
- <!-- 官方销售价 -->
- <el-radio label="1">{{''}}</el-radio>
- <el-form-item prop="original_guide">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.original_guide" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">官方销售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 采购价 -->
- <el-radio label="2">{{''}}</el-radio>
- <el-form-item prop="original_sales">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.original_sales" min="1"
- oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">采购价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- <!-- 建议零售价 -->
- <el-radio label="3">{{''}}</el-radio>
- <el-form-item prop="original_market">
- <span class="redio-input">
- <el-input style="width:300px;" v-model="ruleForm.original_market"
- min="1" oninput="value=value.replace(/[^\d]/g,'')">
- <template slot="prepend">建议零售价 x 定价系数</template>
- <template slot="append">%</template>
- </el-input>
- </span>
- </el-form-item>
- </el-radio-group>
- <div class="tab_tpis">
- </div>
- </el-form-item>
- </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <!-- 推送设置 -->
- <el-tab-pane label="推送设置" name="four">
- <el-row>
- <el-col :span="24">
- <div class="title">
- <span>推送设置</span>
- </div>
- <div class="form-body">
- <!-- 售后推送 -->
- <el-form-item label="售后推送" prop="status">
- <el-switch
- v-model="ruleForm.refund_auto_push"
- active-value="1"
- active-text="自动推送"
- inactive-value="0"
- inactive-text="手动推送"
- active-color="#13ce66"
- inactive-color="#ff4949"
- >
- </el-switch>
- </el-form-item>
- </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- </el-tabs>
- <el-button :loading="submitLoading" class="button-item" size="small" type="primary"
- @click="submit('ruleForm')">保存
- </el-button>
- </el-form>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- hideStatus_1: true,
- hideStatus_2: true,
- loading: false,
- submitLoading: false,
- activeName: getQuery('tab') ? getQuery('tab') : 'first',
- ruleForm: {
- sell_strategy: "1",
- cost_strategy: "1",
- original_strategy: "1",
- sell_guide: 100,
- sell_sales: 100,
- sell_market: 100,
- cost_guide: 100,
- cost_sales: 100,
- cost_market: 100,
- original_guide: 100,
- original_sales: 100,
- original_market: 100,
- auto_present_price: "1",
- auto_base_info: "1",
- refund_auto_push: 0,
- },
- rules: {
- app_key: [
- { required: true, message: '不能为空' },
- ],
- app_secret: [
- { required: true, message: '不能为空' },
- ],
- sell_strategy: [
- { required: true, message: '不能为空' },
- ],
- cost_strategy: [
- { required: true, message: '不能为空' },
- ],
- original_strategy: [
- { required: true, message: '不能为空' },
- ],
- sell_guide: [
- { required: true, message: '不能为空' },
- ],
- sell_sales: [
- { required: true, message: '不能为空' },
- ],
- sell_market: [
- { required: true, message: '不能为空' },
- ],
- cost_guide: [
- { required: true, message: '不能为空' },
- ],
- cost_sales: [
- { required: true, message: '不能为空' },
- ],
- cost_market: [
- { required: true, message: '不能为空' },
- ],
- original_guide: [
- { required: true, message: '不能为空' },
- ],
- original_sales: [
- { required: true, message: '不能为空' },
- ],
- original_market: [
- { required: true, message: '不能为空' },
- ],
- },
- };
- },
- created() {
- this.loadData();
- },
- mounted: function () {
- this.getTab();
- },
- methods: {
- // 点击显示apikey
- updateHideStatus(type) {
- if (type == 1) {
- this.hideStatus_1 = false;
- }
- if (type == 2) {
- this.hideStatus_2 = false;
- }
- },
- getTab() {
- let tab_name = getQuery('tab');
- },
- loadData() {
- this.loading = true;
- request({
- params: {
- r: 'star-chain/default/index',
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- let copyForm = Object.assign({}, this.ruleForm)
- let form = Object.assign(copyForm, e.data.data)
- this.ruleForm = form
- console.log("ruleForm:", form);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- },
- submit(formName) {
- console.log(this.ruleForm)
- this.$refs[formName].validate(valid => {
- if (valid) {
- this.submitLoading = true;
- request({
- params: {
- r: 'star-chain/default/edit',
- },
- method: 'post',
- data: {
- setting: this.ruleForm
- },
- }).then(e => {
- if (e.data.code === 0) {
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- this.submitLoading = false;
- }).catch(e => {
- });
- } else {
- this.$message.error('部分参数验证不通过');
- }
- });
- },
- 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()
- });
- },
- },
- computed: {
- }
- });
- </script>
- <style>
- .el-tabs__header {
- padding: 0 20px;
- height: 56px;
- line-height: 56px;
- background-color: #fff;
- margin-bottom: 0;
- }
- .title {
- margin-top: 10px;
- padding: 18px 20px;
- border-top: 1px solid #F3F3F3;
- border-bottom: 1px solid #F3F3F3;
- background-color: #fff;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- margin-top: 12px;
- padding: 9px 25px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .del-btn {
- position: absolute;
- right: -8px;
- top: -8px;
- padding: 4px 4px;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .el-tabs__header {
- padding: 0 20px;
- height: 56px;
- line-height: 56px;
- background-color: #fff;
- margin-bottom: 0;
- }
- .title {
- margin-top: 10px;
- padding: 18px 20px;
- border-top: 1px solid #F3F3F3;
- border-bottom: 1px solid #F3F3F3;
- background-color: #fff;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- padding: 9px 25px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .del-btn {
- position: absolute;
- right: -8px;
- top: -8px;
- padding: 4px 4px;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .btn-abs {
- position: absolute;
- top: 12px;
- right: 18px;
- }
- .form-body .app-share {
- padding-top: 12px;
- border-top: 1px solid #e2e2e2;
- margin-top: -20px;
- }
- .form-body .app-share .app-share-bg {
- position: relative;
- width: 310px;
- height: 360px;
- background-repeat: no-repeat;
- background-size: contain;
- background-position: center
- }
- .form-body .app-share .app-share-bg .title {
- width: 160px;
- height: 29px;
- line-height: 1;
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .form-body .app-share .app-share-bg .pic-image {
- background-repeat: no-repeat;
- background-position: 0 0;
- background-size: cover;
- width: 160px;
- height: 130px;
- }
- .form-body .tab_tpis {
- font-size: 12px;
- color: #737373;
- }
- .redio-center {
- display: flex;
- align-items: center;
- }
- .redio-input {
- margin-left: -28px;
- margin-right: 20px;
- }
- .el-form-item--mini.el-form-item,
- .el-form-item--small.el-form-item {
- /* margin-bottom: 0; */
- }
- .el-radio {
- padding-bottom: 16px;
- }
- </style>
|