|
|
@@ -6,10 +6,10 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- hotelList: [],
|
|
|
+ storeList: [],
|
|
|
searchParams: {
|
|
|
- hotelId: '',
|
|
|
- hotelName: '',
|
|
|
+ storeId: '',
|
|
|
+ storeName: '',
|
|
|
},
|
|
|
stockList: []
|
|
|
},
|
|
|
@@ -18,32 +18,33 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- this.bindHotelList()
|
|
|
+ this.bindStoreList()
|
|
|
this.bindProductStockList()
|
|
|
},
|
|
|
|
|
|
- bindHotelPickerChange: function (e) {
|
|
|
- var item = this.data.hotelList[e.detail.value]
|
|
|
+ bindStorePickerChange: function (e) {
|
|
|
+ var item = this.data.storeList[e.detail.value]
|
|
|
console.log(item)
|
|
|
this.setData({
|
|
|
- ['searchParams.hotelName']: item.hotelName,
|
|
|
- ['searchParams.hotelId']: item.id
|
|
|
+ ['searchParams.storeName']: item.storeName,
|
|
|
+ ['searchParams.storeId']: item.id
|
|
|
})
|
|
|
this.bindProductStockList()
|
|
|
|
|
|
},
|
|
|
- bindHotelList() {
|
|
|
+ bindStoreList() {
|
|
|
var that = this
|
|
|
- util.request(util.api.hotelList, {}, "GET", false, true, app.globalData.token).then((res) => {
|
|
|
+ util.request(util.api.storeList, {}, "GET", false, true, app.globalData.token).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
that.setData({
|
|
|
- hotelList: res.result
|
|
|
+ storeList: res.result
|
|
|
})
|
|
|
}
|
|
|
}).catch((res) => {})
|
|
|
},
|
|
|
formSubmit: function (e) {
|
|
|
var that = this
|
|
|
+ console.log(that.data.stockList)
|
|
|
util.request(util.api.editVmProductStock, that.data.stockList, "POST", false, true, app.globalData.token).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
util.toast('保存成功')
|
|
|
@@ -74,6 +75,8 @@ Page({
|
|
|
var list = that.data.stockList
|
|
|
var index = dataset.index;
|
|
|
var itemProduct = dataset.item
|
|
|
+ console.log(name)
|
|
|
+ console.log(itemProduct)
|
|
|
itemProduct.skuStock = value
|
|
|
list.splice(index, 1, itemProduct)
|
|
|
that.setData({
|
|
|
@@ -83,6 +86,7 @@ Page({
|
|
|
bindProductStockList() {
|
|
|
var that = this
|
|
|
util.request(util.api.productStockList, that.data.searchParams, "GET", true, true, app.globalData.token).then((res) => {
|
|
|
+ console.log(res)
|
|
|
if (res.code == 200) {
|
|
|
that.setData({
|
|
|
stockList: res.result
|