mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
fix: #0909 商品下载后同步库存
This commit is contained in:
parent
c4ce86cf10
commit
efc6cb0281
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Business\KuaiTuanTuan;
|
||||
|
||||
use App\Events\BusinessOrdersUpdate;
|
||||
use App\Models\BusinessGoodsSku;
|
||||
|
||||
class Goods
|
||||
@ -31,10 +32,14 @@ class Goods
|
||||
foreach ($skuList as $sku) {
|
||||
$sku['spec_list'] = json_encode($sku['spec_list'], 256);
|
||||
$data = array_merge($businessGood, $sku);
|
||||
BusinessGoodsSku::updateOrCreate(
|
||||
$businessGoodSku = BusinessGoodsSku::firstOrNew(
|
||||
['shop_id' => $shopId, 'goods_id' => $businessGood['goods_id'], 'sku_id' => $sku['sku_id']],
|
||||
$data
|
||||
);
|
||||
if (empty($businessGood->id)) {
|
||||
$businessGoodSku->save();
|
||||
event(new BusinessOrdersUpdate($businessGoodSku, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,12 +400,15 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.gid = this.$route.query;
|
||||
let page = {
|
||||
per_page: 999,
|
||||
};
|
||||
// 获取商品种类
|
||||
goods_types().then((res) => {
|
||||
goods_types(page).then((res) => {
|
||||
this.cate = res.data.data;
|
||||
});
|
||||
// 获取商品品牌
|
||||
Brand_goods_types().then((res) => {
|
||||
Brand_goods_types(page).then((res) => {
|
||||
this.brand = res.data.data;
|
||||
});
|
||||
this.handleList();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user