parent
2dd4d55cd6
commit
fe3575cf53
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Yunshop\CulturalSpace\Api;
|
||||
|
||||
use app\common\components\ApiController;
|
||||
use Yunshop\CulturalSpace\models\GoodsCulturalSpace;
|
||||
|
||||
class GoodsController extends ApiController{
|
||||
|
||||
/**
|
||||
* Common: 获取可以使用文创豆兑换的商品列表
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/28 17:46
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getGoodsList(){
|
||||
$result = GoodsCulturalSpace::getExchangeGoodsList();
|
||||
|
||||
return $this->successJson('success',$result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\frontend\models\Goods;
|
||||
|
||||
|
|
@ -48,4 +49,53 @@ class GoodsCulturalSpace extends BaseModel{
|
|||
return $this->belongsTo(Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 获取可以使用文创豆兑换的商品
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/28 17:44
|
||||
* @return array
|
||||
*/
|
||||
public static function getExchangeGoodsList(){
|
||||
$result = self::uniacid()
|
||||
->select(['id','goods_id','legumes_exchange_price'])
|
||||
->with(['belongsToGoods'=>function($query){
|
||||
$query->select(['id','title','thumb']);
|
||||
}])
|
||||
->where('is_open',1)
|
||||
->where('is_legumes_exchange',1)
|
||||
->orderBy('id','DESC')
|
||||
->paginate(10)
|
||||
->toArray();
|
||||
$data = [
|
||||
'current_page' => (int)$result['current_page'],
|
||||
'data' => (array)$result['data'],
|
||||
'last_page' => (int)$result['last_page'],
|
||||
];
|
||||
// 计算需要使用的文创豆
|
||||
$currentFee = (float)CulturalFund::uniacid()->value('current_fee');// 当前费率
|
||||
$holdExchangeLegumes = 0;// 当前用户持有的用以兑换商品的文创豆
|
||||
$data['data'] = array_map(function($item) use ($currentFee,$holdExchangeLegumes){
|
||||
// 使用的文创豆
|
||||
$useLegumes = ceil($item['legumes_exchange_price'] * $currentFee);
|
||||
return [
|
||||
'id' => $item['id'],
|
||||
'goods_id' => $item['goods_id'],
|
||||
'legumes_exchange_price' => $item['legumes_exchange_price'],
|
||||
'goods_title' => $item['belongs_to_goods']['title'],
|
||||
'goods_thumb' => $item['belongs_to_goods']['thumb'],
|
||||
'use_legumes' => $useLegumes,
|
||||
'is_allow_exchange' => (int)$holdExchangeLegumes >= $useLegumes,
|
||||
];
|
||||
},$data['data']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
@section('content')
|
||||
<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
|
||||
<link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
|
||||
<link rel="stylesheet" href="{{static_url('../resources/views/goods/assets/css/common.css?time='.time())}}">
|
||||
|
||||
<style>
|
||||
.vue-head{
|
||||
max-width: 900px!important;
|
||||
|
|
@ -13,13 +15,14 @@
|
|||
color: #b5b5b5;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="all" id="app">
|
||||
<el-form :model="set" label-width="170px">
|
||||
<div class="vue-head">
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="基本设置" name="set_base">
|
||||
<div class="vue-main-title">
|
||||
<div class="vue-main-title" >
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">基本设置</div>
|
||||
</div>
|
||||
|
|
@ -29,6 +32,20 @@
|
|||
<el-option v-for="(item,index) in poster_list" :key="index" :label="item.title" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务视频">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<div class="upload-boxed">
|
||||
<div class="el-icon-plus" v-show="!set.task_video_link" @click="displaySelectMaterialPopup('video',3)"></div>
|
||||
<div>
|
||||
<video v-if="set.task_video_link" style="width: 150px;height:119px;object-fit: cover;" controls="controls" class="" :src="set.task_video_link"></video>
|
||||
<i class="goods-images_remove el-icon-close" style="top:-6px" v-if="set.task_video_link" @click="removeVideo()"></i>
|
||||
</div>
|
||||
<div class="upload-boxed-text" @click="displaySelectMaterialPopup('video',3)">点击重新上传视频</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="贡献值设置" name="set_contribution">
|
||||
|
|
@ -139,7 +156,19 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
|
||||
<upload-multimedia-img
|
||||
:upload-show="showSelectMaterialPopup"
|
||||
:type="materialType"
|
||||
:name="formFieldName"
|
||||
:selNum="selNum"
|
||||
:select="select"
|
||||
@replace="showSelectMaterialPopup = !showSelectMaterialPopup"
|
||||
@sure="selectedMaterial"
|
||||
></upload-multimedia-img>
|
||||
</div>
|
||||
@include('public.admin.uploadMultimediaImg')
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el:"#app",
|
||||
|
|
@ -153,6 +182,12 @@
|
|||
is_open_contribution_bonus: 0,
|
||||
},
|
||||
poster_list: JSON.parse('{!! json_encode($poster_list) !!}') || {},
|
||||
|
||||
showSelectMaterialPopup: false,
|
||||
materialType: "",
|
||||
formFieldName: "",
|
||||
selNum: "one",
|
||||
select:"open",
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
|
|
@ -171,6 +206,26 @@
|
|||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 视频选择
|
||||
displaySelectMaterialPopup(fieldName = "thumb", type = 1) {
|
||||
this.formFieldName = fieldName;
|
||||
this.showSelectMaterialPopup = !this.showSelectMaterialPopup;
|
||||
this.materialType = String(type);
|
||||
},
|
||||
// 视频删除
|
||||
removeVideo(){
|
||||
this.set.task_video_link = ""
|
||||
this.$forceUpdate()
|
||||
},
|
||||
selectedMaterial(name, image, imageUrl) {
|
||||
let originalImageUrl = JSON.parse(JSON.stringify(imageUrl))
|
||||
if(typeof imageUrl == 'string') {
|
||||
this.set.task_video_link = imageUrl;
|
||||
return
|
||||
}
|
||||
this.set.task_video_link = imageUrl[0].url
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue