add-goods.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  1. <template>
  2. <app-layout>
  3. <view :class="is_service ? 'preventTouchMove' : ' '">
  4. <view class='title'>基本信息</view>
  5. <view class='goods-img'>
  6. <view class='label'>
  7. <text>商品图片</text>
  8. <text class="label-info">(最多9张,可拖拽改变顺序)</text>
  9. </view>
  10. <view class='goods-list'>
  11. <movable-area style="height: auto; width: 100%;" class="flex-wrap">
  12. <view @touchend.stop='touchend' @touchmove.stop='touchm' @longpress.stop='_longtap(item.pic_url,index,$event)' class='goods-item' v-for="(item,index) in img" :key="index">
  13. <image mode="aspectFill" class='goods-cover move-img' :data-index="index" :src="item.pic_url"></image>
  14. <image @click.stop='del_img(index)' v-if="!beMove" class='del-btn' src='./../image/delete.png'></image>
  15. <view v-if="index == 0 && !beMove" class='main-img'>主图</view>
  16. </view>
  17. <view v-if="img.length < 9" @click.stop='addImg' class='add-goods-img'>
  18. <image src='./../image/add-goods.png'></image>
  19. <view>添加</view>
  20. </view>
  21. <movable-view :data-index="beginIndex" :x="x" :y="y" direction="all" :damping="5000" :friction="1" :disabled="disabled">
  22. <image :hidden='imgHidden' mode="aspectFill" class="goods-cover img-border" :src='img_src'></image>
  23. </movable-view>
  24. </movable-area>
  25. </view>
  26. </view>
  27. <view class='goods-info'>
  28. <view class='info-item goods-name cross-center dir-left-nowrap'>
  29. <view class="form-label">商品名称</view>
  30. <view @click="nameBlur" v-if="inputName" :class="form.name.length > 0 ? 'input' : 'input placeholder'">{{form.name ? form.name :'请输入商品名称'}}</view>
  31. <input :focus="!inputName" @blur="nameBlur" v-else class='input' placeholder-style="color: #cdcdcd" placeholder="请输入商品名称" v-model='form.name'></input>
  32. </view>
  33. <view class='info-item cross-center main-between'>
  34. <view class="form-label">商品分类</view>
  35. <view @click="chooseCat">
  36. <view class='cat-info dir-right-nowrap cross-center'>
  37. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  38. <text v-if="form.cats.length > 0">编辑</text>
  39. <text style="color: #cdcdcd" v-else>未选择</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class='info-item cross-center dir-left-nowrap'>
  44. <view class="form-label">单位</view>
  45. <view class='dir-left-nowrap cross-center'>
  46. <input maxlength="4" placeholder-style="color: #cdcdcd" placeholder="请输入商品单位" v-model='unit' class='input'></input>
  47. </view>
  48. </view>
  49. </view>
  50. <view class='title'>规格、价格及库存</view>
  51. <view class='goods-info'>
  52. <view class='info-item main-between'>
  53. <view>多规格</view>
  54. <switch style="transform:scale(0.7)" :checked="set_attr" @change="set_attr = !set_attr"></switch>
  55. </view>
  56. <view v-if="set_attr" class='info-item cross-center main-between'>
  57. <view class="form-label">商品规格</view>
  58. <view @click="chooseAttr">
  59. <view class='cat-info dir-right-nowrap cross-center'>
  60. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  61. <text v-if="attr">已设置</text>
  62. <text style="color: #cdcdcd" v-else>未设置,点击设置</text>
  63. </view>
  64. </view>
  65. </view>
  66. <view v-if="!set_attr" class='info-item cross-center dir-left-nowrap'>
  67. <view class="form-label">规格</view>
  68. <view class='dir-left-nowrap cross-center price-input'>
  69. <view class="default-attr">默认规格</view>
  70. </view>
  71. </view>
  72. <view class='info-item cross-center dir-left-nowrap'>
  73. <view class="form-label">成本价</view>
  74. <view class='dir-left-nowrap price-input cross-center main-between'>
  75. <input @change="costChange" placeholder-style="color: #cdcdcd" placeholder="请输入成本价" type='digit' class='input' v-model="form.cost_price"></input>
  76. <view>元</view>
  77. </view>
  78. </view>
  79. <view class='info-item cross-center dir-left-nowrap'>
  80. <view class="form-label">原价</view>
  81. <view class='dir-left-nowrap price-input cross-center main-between'>
  82. <input @change="originalChange" placeholder-style="color: #cdcdcd" placeholder="请输入原价" type='digit' class='input' v-model="form.original_price"></input>
  83. <view>元</view>
  84. </view>
  85. </view>
  86. <view class='info-item cross-center dir-left-nowrap'>
  87. <view class="form-label">售价</view>
  88. <view class='dir-left-nowrap price-input cross-center main-between'>
  89. <input @change="priceChange" placeholder-style="color: #cdcdcd" placeholder="请输入售价" type='digit' class='input' v-model="form.price"></input>
  90. <view>元</view>
  91. </view>
  92. </view>
  93. <view v-if="!set_attr" class='info-item cross-center dir-left-nowrap'>
  94. <view class="form-label">库存</view>
  95. <view class='dir-left-nowrap price-input cross-center main-between'>
  96. <input placeholder-style="color: #cdcdcd" placeholder="请输入库存" type='number' v-model="form.goods_num" class='input unit'></input>
  97. <view class="unit-width">{{unit}}</view>
  98. </view>
  99. </view>
  100. <view v-if="!set_attr" class='info-item cross-center dir-left-nowrap'>
  101. <view class="form-label">货号</view>
  102. <view class='dir-left-nowrap price-input cross-center'>
  103. <input placeholder-style="color: #cdcdcd" placeholder="请输入货号" type='number' class='input' v-model="form.goods_no"></input>
  104. </view>
  105. </view>
  106. <view v-if="!set_attr" class='info-item cross-center dir-left-nowrap'>
  107. <view class="form-label">重量</view>
  108. <view class='dir-left-nowrap cross-center price-input'>
  109. <input placeholder-style="color: #cdcdcd" placeholder="请输入重量" type='number' v-model='form.goods_weight' class='input'></input>
  110. <view>g</view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class='title'>运费、包邮及限购</view>
  115. <view class='goods-info'>
  116. <view class='info-item cross-center main-between'>
  117. <view class="form-label">运费设置</view>
  118. <view @click="chooseExpress">
  119. <view class='cat-info dir-right-nowrap cross-center'>
  120. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  121. <text v-if="bePostage.id > 0">{{bePostage.name}}</text>
  122. <text v-else>未选择</text>
  123. </view>
  124. </view>
  125. </view>
  126. <view class='express-setting'>
  127. <view class='express-input cross-center'>
  128. <view class="integral">满件包邮</view>
  129. <view class='dir-left-nowrap cross-center input-item'>
  130. <input placeholder-style="color: #cdcdcd" placeholder="请输入包邮件数" type='number' v-model='form.pieces' class='input'></input>
  131. <view>件</view>
  132. </view>
  133. </view>
  134. <view class='express-etc'>如果设置0或空,则不支持满件包邮</view>
  135. </view>
  136. <view class='express-setting'>
  137. <view class='express-input cross-center'>
  138. <view class="integral">满额包邮</view>
  139. <view class='dir-left-nowrap cross-center input-item'>
  140. <input placeholder-style="color: #cdcdcd" placeholder="请输入包邮金额" type='digit' v-model='form.forehead' class='input'></input>
  141. <view>元</view>
  142. </view>
  143. </view>
  144. <view class='express-etc'>如果设置0或空,则不支持满额包邮</view>
  145. </view>
  146. <view class='info-item main-between'>
  147. <view>限购</view>
  148. <switch style="transform:scale(0.7)" :checked="confine" @change="confine=!confine"></switch>
  149. </view>
  150. <view v-if="confine" class='info-item cross-center dir-left-nowrap'>
  151. <view class="form-label">限购数量</view>
  152. <view class='dir-left-nowrap cross-center price-input'>
  153. <view class='dir-left-nowrap cross-center price-input'>
  154. <input placeholder-style="color: #cdcdcd" placeholder="请输入限购数量" type='number' v-model='form.confine_count' class='input'></input>
  155. <view>件</view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. <view class='title'>商品图文描述</view>
  161. <view class='goods-info'>
  162. <view class='info-item cross-center main-between'>
  163. <view class="form-label">商品图文描述</view>
  164. <view @click="toGoodsDetail">
  165. <view class='cat-info dir-right-nowrap cross-center'>
  166. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  167. <text v-if="goods_detail.length > 0">已添加</text>
  168. <text v-else>未添加</text>
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. <view class='title'>积分设置</view>
  174. <view class='goods-info integral-info'>
  175. <view class='express-setting'>
  176. <view class='express-input cross-center'>
  177. <view class="integral">积分赠送</view>
  178. <input placeholder-style="color: #cdcdcd" placeholder="请输入积分赠送数量或比例" v-model='give_integral' class='input'></input>
  179. </view>
  180. <view class='express-etc'>会员购物赠送积分,如果不填或填0,则默认为不赠送,如果带%则为按成交价格的比例计算积分。</view>
  181. </view>
  182. <view class='express-setting'>
  183. <view class='express-input cross-center'>
  184. <view class="integral">积分抵扣</view>
  185. <input placeholder-style="color: #cdcdcd" placeholder="请输入积分抵扣数量或比例" v-model='forehead_integral' class='input'></input>
  186. </view>
  187. <view class='express-etc'>如果不填或填0,则不支持积分抵扣;如果带%则为按成交价格的比例计算抵扣多少元。</view>
  188. </view>
  189. </view>
  190. <view class='title'>卡券</view>
  191. <view class='goods-info'>
  192. <view class='info-item cross-center main-between'>
  193. <view class="form-label">卡券</view>
  194. <view @click="chooseCard">
  195. <view class='cat-info dir-right-nowrap cross-center'>
  196. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  197. <text v-if="goods_card.length > 0">已选择</text>
  198. <text v-else>未选择</text>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. <view class='title'>服务内容</view>
  204. <view class='goods-info'>
  205. <view class='info-item cross-center main-between'>
  206. <view class="form-label">服务内容</view>
  207. <view @click="chooseService">
  208. <view class='cat-info dir-right-nowrap cross-center'>
  209. <image class="to-more" src='/static/image/icon/arrow-right.png'></image>
  210. <text v-if="beService.length > 0">已选择</text>
  211. <text v-else-if="service.length > 0">未选择</text>
  212. <text v-else>未设置</text>
  213. </view>
  214. </view>
  215. </view>
  216. </view>
  217. <view class="main-between form-button">
  218. <view @click="submit(0)">
  219. <view class='save'>保存</view>
  220. </view>
  221. <view @click="submit(1)">
  222. <view class='send'>上架</view>
  223. </view>
  224. </view>
  225. <view :class="['dialog', `${iphone_x?'iphone_x':''}`]" v-if="dialog">
  226. <view class="picker-list">
  227. <view class="main-between picker-header">
  228. <view @click="toggle">取消</view>
  229. <view @click="toggle(1)">确定</view>
  230. </view>
  231. <picker-view :value="[set_postage?postageIndex:-1]" class="picker" @change="bindChange">
  232. <picker-view-column>
  233. <view v-for="(item,idx) in postage" :key="item.id"
  234. :class="[`cross-center picker-text`,{
  235. 'sure-color': newIndex === idx,
  236. 'cardinal-color': newIndex === idx + 1 || newIndex === idx - 1,
  237. 'even-color': newIndex === idx + 2 || newIndex === idx - 2,
  238. }]">{{item.name}}</view>
  239. </picker-view-column>
  240. </picker-view>
  241. </view>
  242. </view>
  243. </view>
  244. <view class='dialog' v-if="is_service">
  245. <view class='dialog-item'>
  246. <view class='dialog-title'>服务内容</view>
  247. <view class="type-list">
  248. <view v-if="is_service" v-for="(item,index) in service" :key="index" @click='choose(item)' class="dir-left-nowrap type-choose" >
  249. <image v-if="item.isChoose" class="active-status" src='./../image/active.png'></image>
  250. <image v-else class="active-status" src='/static/image/icon/form-er.png'></image>
  251. <view :class="[`${item.isChoose ? 'active':''}`]">{{item.name}}</view>
  252. </view>
  253. </view>
  254. <view class="main-center btn-area">
  255. <view class="submit-btn" @click='cancelService'>取消</view>
  256. <view class="line"></view>
  257. <view class="submit-btn be-submit" @click='submitService'>确认</view>
  258. </view>
  259. </view>
  260. </view>
  261. <view class='dialog' v-if="modal">
  262. <view class='dialog-item'>
  263. <view class='dialog-title'>提示</view>
  264. <view class="error-info" v-if="set_cat">您暂未设置分类</view>
  265. <view class="error-info" v-if="set_postage && postage.length == 0">您暂未设置运费模板</view>
  266. <view class="error-info" v-if="set_service && service.length == 0">您暂未设置服务内容</view>
  267. <view class="error-info" v-if="set_card && card.length == 0">您暂未设置卡券</view>
  268. <view class="error-info">请前往商城后台设置</view>
  269. <view class="main-center btn-area">
  270. <view class="submit-btn be-submit" @click='close'>确认</view>
  271. </view>
  272. </view>
  273. </view>
  274. <view class='dialog' v-if="error">
  275. <view class='dialog-item'>
  276. <view class='dialog-title'>提示</view>
  277. <view class="error-info">{{error}}</view>
  278. <view class="main-center btn-area">
  279. <view class="submit-btn be-submit" @click='close'>确认</view>
  280. </view>
  281. </view>
  282. </view>
  283. <view class='dialog' v-if="beSubmit">
  284. <view class='dialog-item'>
  285. <view class='dialog-title'>提示</view>
  286. <view class="submit-info">是否确认要上架此商品</view>
  287. <view class="main-center btn-area">
  288. <view class="submit-btn" @click='close'>取消</view>
  289. <view class="line"></view>
  290. <view class="submit-btn be-submit" @click='toSubmit'>确认</view>
  291. </view>
  292. </view>
  293. </view>
  294. </app-layout>
  295. </template>
  296. <script>
  297. import { mapState } from "vuex";
  298. export default {
  299. data() {
  300. return {
  301. postageIndex: -1,
  302. height: 0,
  303. give_integral: 0,
  304. forehead_integral: 0,
  305. beSubmit: false,
  306. inputName: true,
  307. form: {
  308. cats: [],
  309. name: '',
  310. cost_price: '',
  311. price: '',
  312. original_price: ''
  313. },
  314. cats: [],
  315. forehead: -1,
  316. unit: '件',
  317. iphone_x: false,
  318. set_attr: false,
  319. modal: false,
  320. error: false,
  321. set_cat: false,
  322. set_postage: false,
  323. set_service: false,
  324. confine: false,
  325. is_service: false,
  326. goods_card: [],
  327. img: [],
  328. card: [],
  329. goods_detail: [],
  330. beMove: false,
  331. service: [],
  332. postage: [],
  333. bePostage: '',
  334. beService: [],
  335. default_service: [],
  336. newIndex: '0',
  337. index: '0',
  338. attr: false,
  339. have_children: false,
  340. disabled: true,
  341. imgHidden: true,
  342. flag: false,
  343. x: 0,
  344. y: 0,
  345. id: 0,
  346. first_service: true,
  347. choose_list: [],
  348. elements: [],
  349. img_src: '',
  350. loading: false,
  351. dialog: false,
  352. loading: false
  353. }
  354. },
  355. computed: {
  356. ...mapState({
  357. theme: state => state.mallConfig.theme,
  358. userInfo: state => state.user.info,
  359. adminImg: state => state.mallConfig.__wxapp_img.app_admin,
  360. })
  361. },
  362. methods: {
  363. money(val) {
  364. let num = val.toString(); //先转换成字符串类型
  365. if (num.indexOf('.') == 0) { //第一位就是 .
  366. num = '0' + num
  367. }
  368. num = num.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
  369. num = num.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
  370. num = num.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
  371. num = num.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
  372. if (num.indexOf(".") < 0 && num != "") {
  373. num = parseFloat(num);
  374. }
  375. return +num
  376. },
  377. costChange(e) {
  378. this.form.cost_price = this.money(e.detail.value)
  379. },
  380. originalChange(e) {
  381. this.form.original_price = this.money(e.detail.value)
  382. },
  383. priceChange(e) {
  384. this.form.price = this.money(e.detail.value)
  385. },
  386. nameBlur() {
  387. this.inputName = !this.inputName;
  388. },
  389. catchTouchMove() {
  390. return false;
  391. },
  392. toSubmit() {
  393. let that = this;
  394. if(that.loading) {
  395. return false
  396. }
  397. uni.showLoading({
  398. title: '提交中...'
  399. });
  400. that.loading = true;
  401. that.beSubmit = false;
  402. that.$request({
  403. url: that.$api.app_admin.edit,
  404. data: {
  405. form: JSON.stringify(that.form)
  406. },
  407. method: 'post'
  408. }).then(response=>{
  409. that.loading = false;
  410. that.$hideLoading();
  411. uni.hideLoading();
  412. that.loading = false;
  413. if(response.code == 0) {
  414. if(response.code == 0) {
  415. uni.showToast({
  416. title: response.msg,
  417. duration: 1000
  418. });
  419. uni.setStorage({
  420. key: "goods_status",
  421. data: '保存成功'
  422. })
  423. setTimeout(function() {
  424. uni.navigateBack();
  425. }, 500)
  426. }else {
  427. uni.showToast({
  428. title: response.msg,
  429. icon: 'none',
  430. duration: 1000
  431. });
  432. }
  433. }else {
  434. uni.showToast({
  435. title: response.msg,
  436. icon: 'none',
  437. duration: 1000
  438. });
  439. }
  440. }).catch(response => {
  441. that.loading = false;
  442. that.$hideLoading();
  443. uni.hideLoading();
  444. });
  445. },
  446. submit(status) {
  447. let pass = false;
  448. let that = this;
  449. let form = that.form;
  450. let cats = [];
  451. if (that.img.length > 0) {
  452. form.pic_url = that.img;
  453. } else {
  454. that.error = '请上传商品图片';
  455. return false
  456. }
  457. if (!form.name) {
  458. that.error = '请设置商品名称';
  459. return false
  460. }
  461. if (that.cats.length == 0) {
  462. that.error = '请设置商品分类';
  463. return false
  464. }else {
  465. for(let i in that.cats) {
  466. cats.push(that.cats[i].value)
  467. }
  468. }
  469. if (!that.unit) {
  470. that.error = '请设置商品单位';
  471. return false
  472. } else {
  473. if (!form.unit) {
  474. form.unit = that.unit
  475. }
  476. }
  477. if (!form.cost_price) {
  478. that.error = '请设置商品成本价';
  479. return false
  480. }
  481. if (form.cost_price < 0) {
  482. that.error = '成本价不得小于零';
  483. return false
  484. }
  485. if (!form.original_price) {
  486. that.error = '请设置商品原价';
  487. return false
  488. }
  489. if (form.original_price < 0) {
  490. that.error = '商品原价不得小于零';
  491. return false
  492. }
  493. if (!form.price) {
  494. that.error = '请设置商品售价';
  495. return false
  496. }
  497. if (form.price < 0.01) {
  498. that.error = '商品售价不得小于零';
  499. return false
  500. }
  501. if(!that.set_attr) {
  502. form.use_attr = 0;
  503. form.attr = [];
  504. if (!form.goods_num) {
  505. that.error = '商品库存不得为空';
  506. return false
  507. } else if (form.goods_num < 0) {
  508. that.error = '商品库存不得小于零';
  509. return false
  510. } else {
  511. pass = true;
  512. }
  513. }else {
  514. form.use_attr = 1;
  515. form.goods_num = 0;
  516. if (!form.attr_groups || form.attr_groups.length == 0) {
  517. that.error = '请设置商品规格';
  518. return false
  519. }else {
  520. pass = true
  521. }
  522. }
  523. form.cards = that.goods_card;
  524. form.services = [];
  525. if (that.beService.length > 0) {
  526. form.services = that.beService;
  527. }
  528. let service_num = 0;
  529. if(that.beService.length == that.default_service.length) {
  530. for(let i in that.beService) {
  531. if(that.beService[i] == that.default_service[i]) {
  532. service_num++;
  533. }
  534. }
  535. }
  536. form.is_default_services = 1;
  537. if(that.beService.length == 0 || service_num != that.beService.length) {
  538. form.is_default_services = 0;
  539. }
  540. form.status = status;
  541. form.virtual_sales = 0;
  542. form.cover_pic = '';
  543. form.sort = 100;
  544. form.accumulative = 1;
  545. form.member_price = {};
  546. form.mchCats = [];
  547. if (that.goods_detail.length > 0) {
  548. form.detail = '';
  549. for(let i in that.goods_detail) {
  550. if(that.goods_detail[i].type == "img") {
  551. form.detail += '<p><img src="' + that.goods_detail[i].pic_url + '"/></p>'
  552. }else if(that.goods_detail[i].type == "line") {
  553. form.detail += '<p><img src="' + that.adminImg.line + '"/></p>'
  554. }else if(that.goods_detail[i].type == "text") {
  555. form.detail += '<p>' + that.goods_detail[i].text + '</p>'
  556. }
  557. }
  558. } else {
  559. that.error = '请设置图文描述';
  560. return false
  561. }
  562. if (that.forehead_integral) {
  563. if (that.forehead_integral > 0) {
  564. form.forehead_integral_type = 1;
  565. } else {
  566. form.forehead_integral_type = 2;
  567. form.forehead_integral = that.forehead_integral.replace('%', '')
  568. }
  569. }
  570. if (that.give_integral) {
  571. if (that.give_integral > 0) {
  572. form.give_integral_type = 1;
  573. form.give_integral = that.give_integral;
  574. } else {
  575. form.give_integral_type = 2;
  576. form.give_integral = that.give_integral.replace('%', '')
  577. }
  578. }
  579. form.freight_id = that.bePostage.id;
  580. form.freight = that.bePostage;
  581. form.individual_share = 0;
  582. form.is_level = 0;
  583. form.individual_share = 0;
  584. form.video_url = '';
  585. if (pass) {
  586. that.form = form;
  587. that.form.cats = cats;
  588. if(that.id > 0) {
  589. that.form.id = that.id;
  590. }
  591. if(status == 0) {
  592. that.toSubmit();
  593. }else {
  594. that.beSubmit = true;
  595. }
  596. }
  597. },
  598. close() {
  599. this.error = null;
  600. this.modal = false;
  601. this.beSubmit = false;
  602. },
  603. inputAttr(index) {
  604. this.attr[index].attr_list[0].attr_id = (+index + 2).toString();
  605. },
  606. _longtap: function (img_src,index,e) {
  607. let that = this;
  608. var query = uni.createSelectorQuery();
  609. var nodesRef = query.selectAll(".move-img");
  610. nodesRef.fields({
  611. dataset: true,
  612. rect: true
  613. }, (result) => {
  614. that.elements = result;
  615. }).exec()
  616. const detail = e.detail;
  617. that.img[index].pic_url = '';
  618. that.x = e.currentTarget.offsetLeft;
  619. that.y = e.currentTarget.offsetTop;
  620. that.imgHidden = false;
  621. that.flag = true;
  622. that.beMove = true;
  623. that.img_src = img_src;
  624. that.beginIndex = index;
  625. },
  626. //触摸结束
  627. touchend: function (e) {
  628. let that = this;
  629. if (!that.flag) {
  630. return;
  631. }
  632. const x = e.changedTouches[0].pageX
  633. const y = e.changedTouches[0].pageY
  634. const list = that.elements;
  635. let data = that.img
  636. const beginIndex = that.beginIndex;
  637. for (var j = 0; j < list.length; j++) {
  638. const item = list[j];
  639. if (x > item.left && x < item.right && y > item.top && y < item.bottom) {
  640. const endIndex = item.dataset.index;
  641. //向后移动
  642. if (beginIndex < endIndex) {
  643. let tem = data[beginIndex];
  644. for (let i = beginIndex; i < endIndex; i++) {
  645. data[i] = data[i + 1]
  646. }
  647. data[endIndex] = tem;
  648. }
  649. //向前移动
  650. if (beginIndex > endIndex) {
  651. let tem = data[beginIndex];
  652. for (let i = beginIndex; i > endIndex; i--) {
  653. data[i] = data[i - 1]
  654. }
  655. data[endIndex] = tem;
  656. }
  657. data[endIndex].pic_url = that.img_src;
  658. that.img = data;
  659. }
  660. }
  661. if (!that.img[beginIndex].pic_url) {
  662. that.img[beginIndex].pic_url = that.img_src;
  663. }
  664. that.imgHidden = true;
  665. that.flag = false;
  666. that.beMove = false;
  667. that.beginIndex = null;
  668. },
  669. //滑动
  670. touchm: function (e) {
  671. if (this.flag) {
  672. const x = e.touches[0].pageX
  673. const y = e.touches[0].pageY
  674. this.x = x - 60;
  675. this.y = y - 129;
  676. }
  677. },
  678. cancelService() {
  679. let beService = this.beService;
  680. let service = this.service;
  681. if (beService.length > 0) {
  682. service.forEach(function(res, index) {
  683. res.isChoose = false;
  684. beService.forEach(function(row) {
  685. if (row.id == res.id) {
  686. res.isChoose = true;
  687. }
  688. })
  689. })
  690. } else {
  691. service.forEach(function(res, index) {
  692. res.isChoose = false;
  693. })
  694. }
  695. this.beService = beService;
  696. this.service = service;
  697. this.set_service = false;
  698. this.is_service = false;
  699. setTimeout(v=>{
  700. uni.pageScrollTo({
  701. scrollTop: 45550,
  702. duration: 0
  703. });
  704. },0)
  705. },
  706. submitService() {
  707. let beService = [];
  708. this.service.forEach(function(row) {
  709. if (row.isChoose) {
  710. beService.push(row)
  711. }
  712. })
  713. this.beService = beService;
  714. this.set_service = false;
  715. this.is_service = false;
  716. setTimeout(v=>{
  717. uni.pageScrollTo({
  718. scrollTop: 45550,
  719. duration: 0
  720. });
  721. },0)
  722. },
  723. choose(item) {
  724. let that = this;
  725. that.service.forEach(function(row) {
  726. if (row.id == item.id) {
  727. row.isChoose = !row.isChoose;
  728. that.$forceUpdate();
  729. }
  730. })
  731. },
  732. toGoodsDetail() {
  733. uni.navigateTo({
  734. url: '/pages/app_admin/goods-detail/goods-detail'
  735. })
  736. },
  737. addImg() {
  738. let that = this;
  739. let num = 9 - that.img.length;
  740. uni.chooseImage({
  741. count: num,
  742. sizeType: ['original', 'compressed'],
  743. sourceType: ['album', 'camera'],
  744. success(res) {
  745. // tempFilePath可以作为img标签的src属性显示图片
  746. const tempFilePaths = res.tempFilePaths;
  747. let img = that.img;
  748. tempFilePaths.forEach(function (row, index) {
  749. uni.showLoading({
  750. title: '上传中...'
  751. });
  752. let fileName = '';
  753. // #ifdef MP-BAIDU
  754. fileName = row.substr(row.lastIndexOf('/') + 1);
  755. // #endif
  756. uni.uploadFile({
  757. url: that.$api.upload.file,
  758. filePath: row,
  759. name: 'file',
  760. fileType: 'image',
  761. formData: {
  762. file: row,
  763. file_name: fileName
  764. },
  765. success(res) {
  766. // #ifndef MP-BAIDU
  767. const imgInfo = JSON.parse(res.data);
  768. // #endif
  769. // #ifdef MP-BAIDU
  770. const imgInfo = res.data;
  771. // #endif
  772. let para = {
  773. pic_url: imgInfo.data.url,
  774. id: imgInfo.data.id
  775. }
  776. if (imgInfo.code == 0) {
  777. img.push(para)
  778. }
  779. that.img = img;
  780. if (index == tempFilePaths.length - 1) {
  781. uni.hideLoading();
  782. }
  783. },
  784. fail(e) {
  785. console.log('upload fail:', e);
  786. if (e && e.errMsg) {
  787. uni.showModal({
  788. title: '错误',
  789. content: e.errMsg,
  790. showCancel: false,
  791. });
  792. }
  793. }
  794. })
  795. })
  796. }
  797. })
  798. },
  799. del_img(index) {
  800. this.img.splice(index, 1);
  801. },
  802. chooseCat() {
  803. uni.navigateTo({
  804. url: '/pages/app_admin/goods-cat/goods-cat'
  805. })
  806. },
  807. chooseAttr() {
  808. let that = this;
  809. uni.navigateTo({
  810. url: '/pages/app_admin/goods-attr/goods-attr'
  811. })
  812. uni.setStorage({
  813. key: "goods_unit",
  814. data: that.unit
  815. })
  816. },
  817. bindChange(e) {
  818. this.newIndex = e.detail.value[0]
  819. },
  820. toggle(status) {
  821. this.choose_list = [];
  822. this.dialog = false;
  823. this.set_cat = false;
  824. if (status == 1) {
  825. if (this.set_postage) {
  826. this.bePostage = this.postage[this.newIndex]
  827. }
  828. }else {
  829. this.set_postage = false;
  830. }
  831. },
  832. chooseService() {
  833. let that = this;
  834. if(that.first_service) {
  835. that.$request({
  836. url: that.$api.app_admin.service,
  837. }).then(response=>{
  838. that.$hideLoading();
  839. if(response.code == 0) {
  840. that.service = response.data.list;
  841. if (response.data.list.length == 0) {
  842. that.modal = true;
  843. } else {
  844. that.is_service = true;
  845. }
  846. let beService = [];
  847. response.data.list.forEach(function (row) {
  848. row.isChoose = false
  849. if (row.is_default == 1) {
  850. beService.push(row);
  851. row.isChoose = true
  852. }
  853. })
  854. that.set_service = true;
  855. that.beService = beService;
  856. that.default_service = beService;
  857. that.first_service = false;
  858. }else {
  859. uni.showToast({
  860. title: response.msg,
  861. icon: 'none',
  862. duration: 1000
  863. });
  864. }
  865. }).catch(response => {
  866. that.$hideLoading();
  867. });
  868. }else {
  869. if (that.service.length == 0) {
  870. that.modal = true;
  871. } else {
  872. that.is_service = true;
  873. }
  874. }
  875. },
  876. chooseCard() {
  877. let that = this;
  878. that.$request({
  879. url: that.$api.app_admin.card,
  880. }).then(response=>{
  881. that.$hideLoading();
  882. if(response.code == 0) { true;
  883. that.card = response.data.list;
  884. if(response.data.list.length == 0) {
  885. that.set_card = true;
  886. that.modal = true;
  887. }else {
  888. uni.navigateTo({
  889. url: '/pages/app_admin/goods-card/goods-card'
  890. })
  891. }
  892. }else {
  893. uni.showToast({
  894. title: response.msg,
  895. icon: 'none',
  896. duration: 1000
  897. });
  898. }
  899. }).catch(response => {
  900. that.$hideLoading();
  901. });
  902. },
  903. chooseExpress() {
  904. let that = this;
  905. that.$request({
  906. url: that.$api.app_admin.postage,
  907. }).then(response=>{
  908. that.$hideLoading();
  909. if(response.code == 0) {
  910. if (response.data.list.length == 0) {
  911. that.set_postage = true;
  912. that.modal = true;
  913. that.postage = response.data.list;
  914. } else {
  915. let arr = [];
  916. response.data.list.forEach(function (row, index) {
  917. arr.push(response.data.list[index].id)
  918. })
  919. let index = arr.indexOf(that.bePostage.id);
  920. if(index > -1) {
  921. that.postageIndex = index;
  922. that.newIndex = index;
  923. }else {
  924. that.bePostage = ''
  925. }
  926. that.set_postage = true;
  927. that.dialog = true;
  928. that.postage = response.data.list;
  929. }
  930. }else {
  931. uni.showToast({
  932. title: response.msg,
  933. icon: 'none',
  934. duration: 1000
  935. });
  936. }
  937. }).catch(response => {
  938. that.$hideLoading();
  939. });
  940. },
  941. getService(id) {
  942. let that = this;
  943. that.$request({
  944. url: that.$api.app_admin.service,
  945. }).then(response=>{
  946. that.$hideLoading();
  947. if(response.code == 0) {
  948. that.service = response.data.list;
  949. for(let i in that.service) {
  950. that.service[i].isChoose = false;
  951. }
  952. if(id > 0) {
  953. for(let j in that.beService) {
  954. for(let i in that.service) {
  955. if(that.service[i].id == that.beService[j].id) {
  956. that.service[i].isChoose = true;
  957. that.first_service = false;
  958. }
  959. }
  960. }
  961. }else {
  962. console.log(2)
  963. that.beService = [];
  964. response.data.list.forEach(function(row) {
  965. row.isChoose = false
  966. if (row.is_default == 1) {
  967. that.beService.push(row);
  968. row.isChoose = true
  969. }
  970. })
  971. }
  972. }else {
  973. uni.showToast({
  974. title: response.msg,
  975. icon: 'none',
  976. duration: 1000
  977. });
  978. }
  979. }).catch(response => {
  980. that.$hideLoading();
  981. });
  982. },
  983. getPostage(id) {
  984. let that = this;
  985. that.$request({
  986. url: that.$api.app_admin.postage,
  987. }).then(response=>{
  988. that.$hideLoading();
  989. if(response.code == 0) {
  990. that.postage = response.data.list;
  991. if(id > 0) {
  992. return
  993. }else {
  994. that.bePostage = '';
  995. response.data.list.forEach(function(row) {
  996. if (row.status == 1) {
  997. that.bePostage = row;
  998. }
  999. })
  1000. }
  1001. }else {
  1002. uni.showToast({
  1003. title: response.msg,
  1004. icon: 'none',
  1005. duration: 1000
  1006. });
  1007. }
  1008. }).catch(response => {
  1009. that.$hideLoading();
  1010. });
  1011. },
  1012. getCard() {
  1013. let that = this;
  1014. that.$request({
  1015. url: that.$api.app_admin.card,
  1016. }).then(response=>{
  1017. that.$hideLoading();
  1018. if(response.code == 0) {
  1019. that.card = response.data.list;
  1020. }else {
  1021. uni.showToast({
  1022. title: response.msg,
  1023. icon: 'none',
  1024. duration: 1000
  1025. });
  1026. }
  1027. }).catch(response => {
  1028. that.$hideLoading();
  1029. });
  1030. },
  1031. getDetail(id) {
  1032. let that = this;
  1033. that.$request({
  1034. url: that.$api.app_admin.goods_edit,
  1035. data: {
  1036. id: id
  1037. }
  1038. }).then(response=>{
  1039. that.$hideLoading();
  1040. that.getService(id);
  1041. that.getPostage(id);
  1042. if(response.code == 0) {
  1043. that.form = response.data.detail;
  1044. that.img = that.form.pic_url;
  1045. that.cats = that.form.cats;
  1046. that.set_attr = that.form.use_attr;
  1047. that.beService = that.form.services;
  1048. that.bePostage = that.form.freight;
  1049. that.goods_card = that.form.cards;
  1050. that.forehead_integral = +that.form.forehead_integral;
  1051. if(that.form.forehead_integral_type == 2) {
  1052. that.forehead_integral = that.form.forehead_integral + '%';
  1053. }
  1054. that.give_integral = +that.form.give_integral;
  1055. if(that.form.give_integral_type == 2) {
  1056. that.give_integral = that.form.give_integral + '%';
  1057. }
  1058. if(that.form.attr_groups.length > 0 && that.form.attr.length > 0) {
  1059. that.attr = true;
  1060. uni.setStorage({
  1061. key: "goods_attr_groups",
  1062. data: that.form.attr_groups
  1063. })
  1064. uni.setStorage({
  1065. key: "goods_attr",
  1066. data: that.form.attr
  1067. })
  1068. }
  1069. let detail = that.form.detail.split(/<\/p>|<br\/>|<img /);
  1070. let good_detail = [];
  1071. let para;
  1072. console.log(detail)
  1073. for(let i in detail) {
  1074. detail[i] = detail[i].replace(/<p>/g, '').replace(/<\/p>/g, '');
  1075. para = {type: ''};
  1076. if(detail[i].indexOf('src') > -1) {
  1077. para.type = 'img'
  1078. para.id = ''
  1079. para.pic_url = detail[i].slice(5, detail[i].length -3)
  1080. }else {
  1081. para.type = 'text'
  1082. para.text = detail[i]
  1083. }
  1084. good_detail[i] = para;
  1085. }
  1086. for(let i in good_detail) {
  1087. if(good_detail[i].text == '') {
  1088. good_detail.splice(i,1);
  1089. }
  1090. }
  1091. that.goods_detail = good_detail;
  1092. uni.setStorage({
  1093. key: "goods_card",
  1094. data: that.form.cards
  1095. })
  1096. uni.setStorage({
  1097. key: "goods_cat",
  1098. data: that.cats
  1099. })
  1100. uni.setStorage({
  1101. key: "goods_detail",
  1102. data: good_detail
  1103. })
  1104. }else {
  1105. uni.showToast({
  1106. title: response.msg,
  1107. icon: 'none',
  1108. duration: 1000
  1109. });
  1110. }
  1111. }).catch(response => {
  1112. that.$hideLoading();
  1113. });
  1114. }
  1115. },
  1116. onLoad(options) {
  1117. let that = this;
  1118. uni.getSystemInfo({
  1119. success: function (res) {
  1120. if(res.model.indexOf('iPhone X') > -1 || res.model.indexOf('iPhone 11') > -1 || res.model.indexOf('iPhone11') > -1 || res.model.indexOf('iPhone12') > -1 || res.model.indexOf('Unknown Device') > -1) {
  1121. that.iphone_x = true;
  1122. }
  1123. }
  1124. })
  1125. uni.getSystemInfo({
  1126. success: function (res) {
  1127. let clientHeight = res.windowHeight;
  1128. let clientWidth = res.windowWidth;
  1129. let ratio = 750 / clientWidth;
  1130. that.height = clientHeight * ratio;
  1131. }
  1132. });
  1133. that.getCard();
  1134. uni.removeStorage({
  1135. key: 'goods_card',
  1136. success(res) {
  1137. that.goods_card = [];
  1138. }
  1139. })
  1140. uni.removeStorage({
  1141. key: 'goods_cat',
  1142. success(res) {
  1143. console.log(res)
  1144. }
  1145. })
  1146. uni.removeStorage({
  1147. key: 'goods_unit',
  1148. success(res) {
  1149. console.log(res)
  1150. }
  1151. })
  1152. uni.removeStorage({
  1153. key: 'goods_attr_groups',
  1154. success(res) {
  1155. console.log(res)
  1156. }
  1157. })
  1158. uni.removeStorage({
  1159. key: 'goods_attr',
  1160. success(res) {
  1161. console.log(res)
  1162. }
  1163. })
  1164. uni.removeStorage({
  1165. key: 'temp_attr',
  1166. success(res) {
  1167. console.log(res)
  1168. }
  1169. })
  1170. uni.removeStorage({
  1171. key: 'temp_attr_info',
  1172. success(res) {
  1173. console.log(res)
  1174. }
  1175. })
  1176. uni.removeStorage({
  1177. key: 'goods_detail',
  1178. success(res) {
  1179. that.goods_detail = [];
  1180. }
  1181. })
  1182. if(options.id > 0) {
  1183. that.$showLoading({
  1184. type: 'global',
  1185. text: '加载中...'
  1186. });
  1187. that.id = options.id;
  1188. setTimeout(v=>{
  1189. uni.setNavigationBarTitle({
  1190. title: '编辑商品',
  1191. });
  1192. that.getDetail(options.id);
  1193. },500)
  1194. }else {
  1195. that.getService();
  1196. that.getPostage();
  1197. }
  1198. },
  1199. onShow() {
  1200. let that = this;
  1201. uni.getStorage({
  1202. key: 'goods_card',
  1203. success(res) {
  1204. that.goods_card = res.data;
  1205. }
  1206. })
  1207. uni.getStorage({
  1208. key: 'goods_cat',
  1209. success(res) {
  1210. that.cats = res.data;
  1211. }
  1212. })
  1213. uni.getStorage({
  1214. key: 'goods_detail',
  1215. success(res) {
  1216. that.goods_detail = res.data;
  1217. }
  1218. })
  1219. uni.getStorage({
  1220. key: 'goods_attr_groups',
  1221. success(res) {
  1222. that.form.attr_groups = res.data;
  1223. that.attr = true;
  1224. }
  1225. })
  1226. uni.getStorage({
  1227. key: 'goods_attr',
  1228. success(res) {
  1229. that.form.attr = res.data;
  1230. }
  1231. })
  1232. uni.removeStorage({
  1233. key: 'temp_attr',
  1234. success(res) {
  1235. console.log(res)
  1236. }
  1237. })
  1238. uni.removeStorage({
  1239. key: 'temp_attr_info',
  1240. success(res) {
  1241. console.log(res)
  1242. }
  1243. })
  1244. }
  1245. }
  1246. </script>
  1247. <style scoped lang="scss">
  1248. .preventTouchMove{
  1249. bottom: 0;
  1250. left: 0;
  1251. width: 100%;
  1252. overflow: hidden;
  1253. position: fixed;
  1254. z-index: 0;
  1255. }
  1256. .title {
  1257. font-size: #{28rpx};
  1258. color: #999;
  1259. margin: #{30rpx} #{24rpx} #{13rpx};
  1260. }
  1261. .goods-img {
  1262. background-color: #fff;
  1263. padding: #{32rpx} #{24rpx};
  1264. }
  1265. .goods-list {
  1266. margin-top: #{8rpx};
  1267. margin-left: #{-24rpx};
  1268. }
  1269. .goods-item {
  1270. position: relative;
  1271. margin-left: #{24rpx};
  1272. margin-top: #{24rpx};
  1273. height: #{218rpx};
  1274. width: #{218rpx};
  1275. }
  1276. .label {
  1277. font-size: #{28rpx};
  1278. color: #999;
  1279. }
  1280. .goods-cover {
  1281. height: #{218rpx};
  1282. width: #{218rpx};
  1283. }
  1284. .del-btn {
  1285. height: #{40rpx};
  1286. width: #{40rpx};
  1287. position: absolute;
  1288. right: #{-8rpx};
  1289. top: #{-16rpx};
  1290. }
  1291. .main-img {
  1292. height: #{40rpx};
  1293. line-height: #{40rpx};
  1294. width: #{218rpx};
  1295. text-align: center;
  1296. font-size: #{24rpx};
  1297. color: #fff;
  1298. background-color: rgba(68, 109, 253, 0.5);
  1299. position: absolute;
  1300. bottom: 0;
  1301. left: 0;
  1302. }
  1303. .add-goods-img {
  1304. background-color: #f4f5f9;
  1305. position: relative;
  1306. margin-left: #{24rpx};
  1307. margin-top: #{24rpx};
  1308. height: #{218rpx};
  1309. width: #{218rpx};
  1310. font-size: #{24rpx};
  1311. color: #999;
  1312. z-index: 10;
  1313. text-align: center;
  1314. }
  1315. .add-goods-img image {
  1316. height: #{40rpx};
  1317. width: #{40rpx};
  1318. margin: #{70rpx} auto #{10rpx};
  1319. }
  1320. .goods-info {
  1321. background-color: #fff;
  1322. padding: 0 #{24rpx};
  1323. .info-item:first-of-type {
  1324. border-top: 0;
  1325. }
  1326. .info-item.goods-name {
  1327. border-top: #{1rpx} solid #e2e2e2;
  1328. }
  1329. }
  1330. .form-label {
  1331. width: #{176rpx};
  1332. }
  1333. .info-item {
  1334. border-top: #{1rpx} solid #e2e2e2;
  1335. height: #{88rpx};
  1336. line-height: #{88rpx};
  1337. font-size: #{28rpx};
  1338. color: #353535;
  1339. }
  1340. view.input {
  1341. height: #{80rpx};
  1342. line-height: #{80rpx};
  1343. white-space: nowrap;
  1344. overflow: auto;
  1345. }
  1346. view.input.placeholder {
  1347. color: #cdcdcd;
  1348. }
  1349. .input {
  1350. width: #{476rpx};
  1351. background-color: #fff;
  1352. padding-left: #{25rpx};
  1353. font-size: #{28rpx};
  1354. }
  1355. .input.unit {
  1356. width: #{396rpx};
  1357. }
  1358. .unit-width {
  1359. width: #{112rpx};
  1360. text-align: right;
  1361. }
  1362. .cat-info {
  1363. width: #{526rpx};
  1364. color: #666;
  1365. }
  1366. .to-more {
  1367. height: #{24rpx};
  1368. width: #{12rpx};
  1369. margin-left: #{10rpx};
  1370. }
  1371. .price-input {
  1372. position: relative;
  1373. color: #666;
  1374. height: #{88rpx};
  1375. .default-attr {
  1376. padding-left: #{25rpx};
  1377. }
  1378. }
  1379. .money {
  1380. position: absolute;
  1381. height: #{88rpx};
  1382. line-height: #{88rpx};
  1383. width: #{20rpx};
  1384. left: 0;
  1385. top: 0;
  1386. }
  1387. .attr-info {
  1388. background-color: #fff;
  1389. padding: 0 #{24rpx};
  1390. margin-top: #{20rpx};
  1391. }
  1392. .attr-input {
  1393. width: #{638rpx};
  1394. }
  1395. .attr-input .input {
  1396. color: #666;
  1397. width: #{412rpx};
  1398. }
  1399. .attr-input .input.unit {
  1400. width: #{330rpx};
  1401. }
  1402. .express-setting {
  1403. height: #{136rpx};
  1404. padding: #{16rpx} 0 #{20rpx};
  1405. border-top: #{1rpx} solid #e2e2e2;
  1406. }
  1407. .express-input {
  1408. position: relative;
  1409. .input-item {
  1410. font-size: #{28rpx};
  1411. color: #353535;
  1412. .input {
  1413. width: #{650rpx};
  1414. }
  1415. }
  1416. }
  1417. .express-input .input {
  1418. width: #{702rpx};
  1419. padding-left: #{216rpx};
  1420. }
  1421. .express-input .integral {
  1422. position: absolute;
  1423. left: 0;
  1424. z-index: 2;
  1425. }
  1426. .express-etc {
  1427. color: #999;
  1428. font-size: #{24rpx};
  1429. margin-top: #{16rpx};
  1430. }
  1431. .form-button {
  1432. width: #{656rpx};
  1433. margin: 0 auto;
  1434. }
  1435. .save {
  1436. height: #{80rpx};
  1437. line-height: #{80rpx};
  1438. text-align: center;
  1439. width: #{300rpx};
  1440. margin: #{80rpx} 0;
  1441. font-size: #{28rpx};
  1442. color: #446dfd;
  1443. border: #{2rpx} solid #446dfd;
  1444. background-color: #FFFFFF;
  1445. border-radius: #{40rpx};
  1446. }
  1447. .send {
  1448. height: #{80rpx};
  1449. line-height: #{80rpx};
  1450. text-align: center;
  1451. width: #{300rpx};
  1452. margin: #{80rpx} #{24rpx};
  1453. font-size: #{28rpx};
  1454. color: #fff;
  1455. background-color: #446dfd;
  1456. border-radius: #{40rpx};
  1457. }
  1458. .dialog {
  1459. position: fixed;
  1460. height: 100%;
  1461. width: 100%;
  1462. bottom: 0;
  1463. left: 0;
  1464. z-index: 10;
  1465. background-color: rgba(0, 0, 0, .3);
  1466. }
  1467. .dialog.iphone_x .picker-list{
  1468. padding-bottom: #{50rpx};
  1469. }
  1470. .picker {
  1471. width: 100%;
  1472. height: #{440rpx};
  1473. color: #999999;
  1474. }
  1475. .dialog.iphone_x .picker{
  1476. height:#{490rpx};
  1477. }
  1478. .picker-list {
  1479. background-color: #fff;
  1480. padding-top: #{20rpx};
  1481. position: fixed;
  1482. bottom: 0;
  1483. left: 0;
  1484. width: 100%;
  1485. }
  1486. .picker-header {
  1487. padding: 0 #{24rpx};
  1488. color: #446dfd;
  1489. font-size: #{32rpx};
  1490. }
  1491. .is_cat {
  1492. padding: #{50rpx} 0 0 #{24rpx};
  1493. color: #666666;
  1494. font-size: #{28rpx};
  1495. border-bottom: #{1rpx} solid #e2e2e2;
  1496. }
  1497. .is_cat text {
  1498. margin-right: #{48rpx};
  1499. display: inline-block;
  1500. max-width: #{130rpx};
  1501. white-space: nowrap;
  1502. overflow: hidden;
  1503. text-overflow: ellipsis;
  1504. }
  1505. .is_cat text:last-of-type {
  1506. padding-bottom: #{24rpx};
  1507. color: #446dfd;
  1508. border-bottom: #{2rpx} solid #446dfd;
  1509. }
  1510. .type-list {
  1511. max-height: #{400rpx};
  1512. overflow: auto;
  1513. }
  1514. .type-choose {
  1515. padding: 0 #{24rpx} 0 #{72rpx};
  1516. height: #{36rpx};
  1517. line-height: #{36rpx};
  1518. color: #353535;
  1519. font-size: #{32rpx};
  1520. text-align: left;
  1521. margin: #{35rpx} 0 #{50rpx};
  1522. }
  1523. .type-choose .active {
  1524. color: #446dfd;
  1525. }
  1526. .active-status {
  1527. width: #{36rpx};
  1528. height: #{36rpx};
  1529. display: block;
  1530. margin-right: #{24rpx};
  1531. }
  1532. .attr-btn-item {
  1533. padding-left: #{88rpx};
  1534. background-color: #fff;
  1535. }
  1536. .dialog-item {
  1537. padding-top: #{20rpx};
  1538. position: fixed;
  1539. top: 25%;
  1540. left: 0;
  1541. right: 0;
  1542. margin: 0 auto;
  1543. width: #{620rpx};
  1544. border-radius: #{16rpx};
  1545. background-color: #fff;
  1546. }
  1547. .btn-area {
  1548. height: #{88rpx};
  1549. position: relative;
  1550. border-top: #{1rpx} solid #e2e2e2;
  1551. }
  1552. .btn-area .line {
  1553. height: #{32rpx};
  1554. width: #{1rpx};
  1555. background-color: #e2e2e2;
  1556. position: absolute;
  1557. top: #{28rpx};
  1558. left: 0;
  1559. right: 0;
  1560. margin: 0 auto;
  1561. }
  1562. .submit-btn {
  1563. height: #{88rpx};
  1564. line-height: #{88rpx};
  1565. font-size: #{32rpx};
  1566. color: #666;
  1567. width: #{310rpx};
  1568. text-align: center;
  1569. }
  1570. .submit-btn.be-submit {
  1571. color: #446dfd;
  1572. }
  1573. .dialog-title {
  1574. text-align: center;
  1575. margin: #{15rpx} 0 #{50rpx};
  1576. }
  1577. .img-border {
  1578. height: #{250rpx};
  1579. width: #{250rpx};
  1580. margin-top: #{-16rpx};
  1581. margin-left: #{-16rpx};
  1582. }
  1583. .screen {
  1584. height: 100%;
  1585. overflow: hidden;
  1586. }
  1587. .error-info {
  1588. text-align: center;
  1589. margin: #{50rpx};
  1590. }
  1591. .submit-info {
  1592. text-align:center;
  1593. margin-bottom: #{60rpx};
  1594. }
  1595. .picker-text {
  1596. line-height: #{88rpx};
  1597. color: #446dfd;
  1598. font-size: #{32rpx};
  1599. padding-left: #{24rpx};
  1600. }
  1601. .picker-text.sure-color {
  1602. color: #446dfd;
  1603. }
  1604. .picker-text.cardinal-color {
  1605. color: #999999;
  1606. }
  1607. .picker-text.even-color {
  1608. color: #cdcdcd;
  1609. }
  1610. .integral {
  1611. font-size: #{28rpx};
  1612. color: #353535;
  1613. }
  1614. .integral-info .express-setting {
  1615. height: #{164rpx};
  1616. }
  1617. .integral-info .express-setting:first-of-type {
  1618. border-top:0
  1619. }
  1620. .label-info {
  1621. font-size: #{24rpx};
  1622. color: #999999;
  1623. }
  1624. </style>