|
|
@@ -245,6 +245,10 @@
|
|
|
|
|
|
<!-- 底部保存按钮 -->
|
|
|
<view class="footer-btn-wrap">
|
|
|
+ <view class="sort-indicator">
|
|
|
+ <text class="sort-label">商城显示顺序:</text>
|
|
|
+ <text class="sort-value">{{ sortedMethodsText }}</text>
|
|
|
+ </view>
|
|
|
<button class="admin-button-com big blue" @click="submitSave">保存</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -252,7 +256,7 @@
|
|
|
|
|
|
<script>
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
-import { getShMethodConfig, saveShMethodConfig } from "@/api/sh-method";
|
|
|
+import { getShMethodConfig, saveShMethodConfig, getShMethodSorts } from "@/api/sh-method";
|
|
|
|
|
|
export default {
|
|
|
name: "shMethod",
|
|
|
@@ -269,6 +273,7 @@ export default {
|
|
|
{ name: "物流", value: 4 }
|
|
|
],
|
|
|
tabIndex: 0,
|
|
|
+ sortsList: [], // 存储所有配送方式的排序和别名信息
|
|
|
form: {
|
|
|
id: 0,
|
|
|
style: 0,
|
|
|
@@ -288,11 +293,45 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ // 动态计算并按顺序值由小到大列出所有配送方式别名
|
|
|
+ sortedMethodsText() {
|
|
|
+ if (!this.sortsList || this.sortsList.length === 0) {
|
|
|
+ return "加载中...";
|
|
|
+ }
|
|
|
+ // 复制一份数组以避免直接修改 state
|
|
|
+ const sorted = [...this.sortsList];
|
|
|
+ // 按 sort 升序,若 sort 相同则按 style 升序
|
|
|
+ sorted.sort((a, b) => {
|
|
|
+ if (a.sort !== b.sort) {
|
|
|
+ return a.sort - b.sort;
|
|
|
+ }
|
|
|
+ return a.style - b.style;
|
|
|
+ });
|
|
|
+ // 拼接成 "送货 > 自取 > 跑腿..." 的格式
|
|
|
+ return sorted.map(item => item.name).join(" > ");
|
|
|
+ }
|
|
|
+ },
|
|
|
onLoad() {
|
|
|
this.loadConfig(0);
|
|
|
+ this.loadSorts();
|
|
|
},
|
|
|
methods: {
|
|
|
init(){},
|
|
|
+ /**
|
|
|
+ * 加载所有配送方式的排序和别名信息
|
|
|
+ */
|
|
|
+ loadSorts() {
|
|
|
+ getShMethodSorts()
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 1 && res.data) {
|
|
|
+ this.sortsList = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error("加载排序信息失败", err);
|
|
|
+ });
|
|
|
+ },
|
|
|
/**
|
|
|
* 切换 Tab
|
|
|
* @param {number} index - 选中的 Tab 索引
|
|
|
@@ -453,6 +492,8 @@ export default {
|
|
|
this.$msg("保存成功");
|
|
|
// 重新加载配置刷新数据
|
|
|
this.loadConfig(this.tabIndex);
|
|
|
+ // 重新加载排序和别名信息
|
|
|
+ this.loadSorts();
|
|
|
} else {
|
|
|
this.$msg(res.msg || "保存失败");
|
|
|
}
|
|
|
@@ -748,7 +789,28 @@ export default {
|
|
|
border-top: 1upx solid #eeeeee;
|
|
|
z-index: 10;
|
|
|
display: flex;
|
|
|
- justify-content: flex-end; /* 居右边 */
|
|
|
+ justify-content: space-between; /* 居左边展示顺序,居右边保存按钮 */
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.sort-indicator {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ flex: 1;
|
|
|
+ margin-right: 20upx;
|
|
|
+}
|
|
|
+
|
|
|
+.sort-label {
|
|
|
+ font-size: 20upx;
|
|
|
+ color: #999999;
|
|
|
+}
|
|
|
+
|
|
|
+.sort-value {
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #333333;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-top: 4upx;
|
|
|
}
|
|
|
|
|
|
.footer-btn-wrap .admin-button-com.big {
|