|
@@ -190,12 +190,17 @@ export default {
|
|
|
/**
|
|
/**
|
|
|
* 解析路由 index,从 groupBuyDraft 加载待编辑商品
|
|
* 解析路由 index,从 groupBuyDraft 加载待编辑商品
|
|
|
* 编辑态按单条展示(列表中每规格已是独立一条)
|
|
* 编辑态按单条展示(列表中每规格已是独立一条)
|
|
|
|
|
+ * index>=0 为编辑,-1 为新增,据此切换导航栏标题
|
|
|
*/
|
|
*/
|
|
|
init() {
|
|
init() {
|
|
|
this.goodsIndex = parseInt(this.option && this.option.index, 10)
|
|
this.goodsIndex = parseInt(this.option && this.option.index, 10)
|
|
|
if (isNaN(this.goodsIndex)) {
|
|
if (isNaN(this.goodsIndex)) {
|
|
|
this.goodsIndex = -1
|
|
this.goodsIndex = -1
|
|
|
}
|
|
}
|
|
|
|
|
+ // 新增/编辑共用本页,标题按入口区分,避免一直显示 pages.json 里的「新增」
|
|
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
|
|
+ title: this.goodsIndex >= 0 ? '编辑' : '新增'
|
|
|
|
|
+ })
|
|
|
const draft = uni.getStorageSync(DRAFT_KEY) || {}
|
|
const draft = uni.getStorageSync(DRAFT_KEY) || {}
|
|
|
if (this.goodsIndex >= 0 && draft.goods && draft.goods[this.goodsIndex]) {
|
|
if (this.goodsIndex >= 0 && draft.goods && draft.goods[this.goodsIndex]) {
|
|
|
const item = draft.goods[this.goodsIndex]
|
|
const item = draft.goods[this.goodsIndex]
|
|
@@ -389,8 +394,7 @@ export default {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
// 列表展示名带规格后缀,便于区分同商品多规格
|
|
// 列表展示名带规格后缀,便于区分同商品多规格
|
|
|
- const displayName = form.specName
|
|
|
|
|
- ? `${this.goodsBase.name}(${form.specName})` : this.goodsBase.name
|
|
|
|
|
|
|
+ const displayName = this.goodsBase.name
|
|
|
items.push({
|
|
items.push({
|
|
|
id: parseInt(form.id, 10) || 0,
|
|
id: parseInt(form.id, 10) || 0,
|
|
|
goodsId,
|
|
goodsId,
|