<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Shop\Core; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\Response; use ModStart\Field\JsonIdItems; use ModStart\Form\Form; use Module\Voucher\Biz\AbstractVoucherBiz; use Module\Voucher\Model\Voucher; use Module\Voucher\Model\VoucherItem; use Module\Voucher\Type\VoucherType; class ShopVoucherBiz extends AbstractVoucherBiz { const NAME = 'shop'; public function name() { return self::NAME; } public function title() { return '商城'; } public function adminRenderForm(Form $NX6uw) { $NX6uw->radio('type', '类型')->optionType(VoucherType::class)->when('=', VoucherType::EXCHANGE, function (Form $NX6uw) { $NX6uw->jsonIdItems('typeExchange', '兑换商品')->selectUrl(modstart_admin_url('goods/select'))->previewUrl(modstart_admin_url('goods/preview'))->itemStyle(JsonIdItems::ITEM_STYLE_COVER_TITLE)->help('留空表示适配所有商品'); })->when('=', VoucherType::CUT, function (Form $NX6uw) { $NX6uw->decimal('typeCutTotal', '满减金额'); $NX6uw->decimal('typeCutOff', '优惠券面额'); $NX6uw->jsonIdItems('typeCutParamA', '适用商品')->selectUrl(modstart_admin_url('goods/select'))->previewUrl(modstart_admin_url('goods/preview'))->itemStyle(JsonIdItems::ITEM_STYLE_COVER_TITLE)->help('留空表示适配所有商品'); })->when('=', VoucherType::DISCOUNT, function (Form $NX6uw) { $NX6uw->number('typeDiscount', '折扣')->help('0-100，80表示打八折'); $NX6uw->jsonIdItems('typeDiscountParamA', '适用商品')->selectUrl(modstart_admin_url('goods/select'))->previewUrl(modstart_admin_url('goods/preview'))->itemStyle(JsonIdItems::ITEM_STYLE_COVER_TITLE)->help('留空表示适配所有商品'); })->required()->defaultValue(VoucherType::EXCHANGE); } public function performItem($ZA9qu, $YaV4m, $w6bW5 = array()) { return Response::generate(-1, '请在购物结算时使用', null, modstart_web_url('cart')); } }