GoodsForm2.vue 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981
  1. <template>
  2. <page-meta :root-font-size="fontSize+'px'"></page-meta>
  3. <seller-base :show="false">
  4. <view class="div container goods-form-2">
  5. <view class="div common-header-wrap">
  6. <view :style="'height:'+navHeight+'px'"></view>
  7. <view class="common-header-holder"></view>
  8. <view class="common-header-fixed">
  9. <title-header />
  10. <uni-nav-bar title="商品发布" class="common-header" left-icon="back" @clickLeft="goBack()">
  11. </uni-nav-bar>
  12. </view>
  13. </view>
  14. <step :options="options" :active="1"></step>
  15. <view class="div label">特殊商品</view>
  16. <view class="div main-content">
  17. <view class="div" v-if="goods_class.gc_virtual">
  18. <flex-line :show-border="true"><text class="span line-name">虚拟商品</text>
  19. <view class="div" slot="right">
  20. <switch @change="switchChange(1,$event)" :checked="!!goods.is_virtual"></switch>
  21. </view>
  22. </flex-line>
  23. <view class="div" v-if="goods.is_virtual">
  24. <view class="div" @click="showPopup('showVirtualPicker')">
  25. <flex-line :is-link="true" :show-border="true"><text class="line-name">虚拟商品类型</text>
  26. <view class="div" slot="right">{{goods.virtual_type_text}}</view>
  27. </flex-line>
  28. </view>
  29. <view class="div" v-if="!ifSpec && goods.virtual_type==1" @click="showCard()">
  30. <flex-line :is-link="true" :show-border="true"><text class="line-name">卡券管理</text>
  31. <view class="div" slot="right">添加卡券【{{goods.card_num?goods.card_num:0}}】</view>
  32. </flex-line>
  33. </view>
  34. <flex-line v-if="!ifSpec && goods.virtual_type==2" class="field-line" :show-border="true"><text
  35. class="field-name">网盘信息</text>
  36. <view class="field-line-right" slot="right"><input class="field-input"
  37. v-model="goods.vc_pan" /></view>
  38. </flex-line>
  39. <flex-line v-if="!ifSpec && goods.virtual_type==3" :show-border="true">
  40. <text>商品资源</text>
  41. <view class="div" slot="right">
  42. <uni-file-picker style="text-align: right;"
  43. v-model="vc_file[0]" file-extname="zip" file-mediatype="all" :limit="1" :auto-upload="false"
  44. @select="uploadResource"></uni-file-picker>
  45. </view>
  46. </flex-line>
  47. <view v-if="goods.virtual_type==0" class="div">
  48. <flex-line :is-link="true" :show-border="true">
  49. <text class="span line-name">虚拟商品有效期</text>
  50. <view class="span" slot="right">
  51. <uni-datetime-picker class="common-datetime-picker" type="date"
  52. v-model="goods.virtual_indate" :start="$moment().format('YYYY-MM-DD')">
  53. </uni-datetime-picker>
  54. </view>
  55. </flex-line>
  56. </view>
  57. <flex-line class="field-line" :show-border="true"><text class="span field-name">购买上限</text>
  58. <view class="div field-line-right" slot="right"><input class="field-input"
  59. v-model="goods.virtual_limit" /></view>
  60. </flex-line>
  61. <flex-line v-if="goods.virtual_type==0" :show-border="true"><text
  62. class="span line-name">支持过期退款</text>
  63. <view class="div" slot="right">
  64. <switch @change="switchChange(2,$event)" :checked="!!goods.virtual_invalid_refund">
  65. </switch>
  66. </view>
  67. </flex-line>
  68. </view>
  69. </view>
  70. <view class="div" v-if="!goods.is_virtual">
  71. <flex-line :show-border="true"><text class="span line-name">F码商品</text>
  72. <view class="div" slot="right">
  73. <switch @change="switchChange(3,$event)" :checked="!!goods.is_goodsfcode"></switch>
  74. </view>
  75. </flex-line>
  76. <view class="div" v-if="goods.is_goodsfcode">
  77. <flex-line class="field-line" :show-border="true"><text class="span field-name">生成F码数量</text>
  78. <view class="div field-line-right" slot="right"><input class="field-input"
  79. v-model="g_fccount" /></view>
  80. </flex-line>
  81. <flex-line class="field-line" :show-border="true"><text class="span field-name">F码前缀</text>
  82. <view class="div field-line-right" slot="right"><input class="field-input"
  83. v-model="g_fcprefix" /></view>
  84. </flex-line>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="div label">商品基本信息</view>
  89. <view class="div main-content">
  90. <view class="div" @click="goClass">
  91. <flex-line :is-link="true" :show-border="true"><text class="span line-name">商品分类</text><text
  92. class="span" slot="right">{{goods_class.gctag_name}}</text></flex-line>
  93. </view>
  94. <flex-line class="field-line" :show-border="true"><text class="span field-name">商品名称</text>
  95. <view class="div field-line-right" slot="right"><input class="field-input"
  96. v-model="goods.goods_name" /></view>
  97. </flex-line>
  98. <flex-line class="field-line" :show-border="true"><text class="span field-name">商品卖点</text>
  99. <view class="div field-line-right" slot="right"><input class="field-input"
  100. v-model="goods.goods_advword" /></view>
  101. </flex-line>
  102. <flex-line class="field-line" :show-border="true"><text class="span field-name">商品价格</text>
  103. <view class="div field-line-right" slot="right"><input class="field-input" :readonly="ifSpec"
  104. v-model="goods.goods_price" /></view>
  105. </flex-line>
  106. <flex-line class="field-line" :show-border="true"><text class="span field-name">市场价</text>
  107. <view class="div field-line-right" slot="right"><input class="field-input"
  108. v-model="goods.goods_marketprice" /></view>
  109. </flex-line>
  110. <flex-line class="field-line" :show-border="true"><text class="span field-name">成本价</text>
  111. <view class="div field-line-right" slot="right"><input class="field-input"
  112. v-model="goods.goods_costprice" /></view>
  113. </flex-line>
  114. <flex-line class="field-line" style="display: none" :show-border="true"><text
  115. class="span field-name">折扣</text>
  116. <view class="div field-line-right" slot="right"><input class="field-input"
  117. v-model="goods.goods_discount" readonly /></view>
  118. </flex-line>
  119. <flex-line class="field-line" :show-border="true"><text class="span field-name">商品重量</text>
  120. <view class="div field-line-right" slot="right"><input class="field-input" :readonly="ifSpec"
  121. v-model="goods.goods_weight" /></view>
  122. </flex-line>
  123. <flex-line v-if="goods.is_virtual==0 || goods.virtual_type==0" class="field-line" :show-border="true">
  124. <text class="span field-name">商品库存</text>
  125. <view class="div field-line-right" slot="right"><input class="field-input" :readonly="ifSpec"
  126. v-model="goods.goods_storage" /></view>
  127. </flex-line>
  128. <flex-line class="field-line" :show-border="true"><text class="span field-name">库存预警值</text>
  129. <view class="div field-line-right" slot="right"><input class="field-input" :readonly="ifSpec"
  130. v-model="goods.goods_storage_alarm" /></view>
  131. </flex-line>
  132. <flex-line class="field-line" :show-border="true"><text class="span field-name">商家货号</text>
  133. <view class="div field-line-right" slot="right"><input class="field-input" :readonly="ifSpec"
  134. v-model="goods.goods_serial" /></view>
  135. </flex-line>
  136. <view class="div" v-if="mulSpec" @click="showPopup('showSpecName')">
  137. <flex-line :is-link="true" :show-border="true"><text class="span line-name">设置规格名</text></flex-line>
  138. </view>
  139. <view class="div" v-if="mulSpec" @click="showPopup('showSpecValue')">
  140. <flex-line :is-link="true" :show-border="true"><text class="span line-name">设置规格值</text></flex-line>
  141. </view>
  142. <flex-line class="mt-5" :show-border="true">
  143. <text class="span">商品图片</text>
  144. <view class="div" slot="right">
  145. <view class="div user-avatar-wrapper">
  146. <view class="div user-avatar">
  147. <uni-file-picker class="common-avatar" v-model="imageValue['goods_image']"
  148. fileMediatype="image" mode="grid" :limit="1" :auto-upload="false"
  149. @select="uploadImage('goods_image',$event)" :image-styles="{
  150. width:'160px',
  151. height:'160px',
  152. }"></uni-file-picker>
  153. </view>
  154. </view>
  155. </view>
  156. </flex-line>
  157. <flex-line class="mt-5" :show-border="true">
  158. <text class="span">商品视频</text>
  159. <view class="div" slot="right">
  160. <view class="div user-avatar-wrapper">
  161. <view class="div user-avatar">
  162. <uni-file-picker class="common-avatar" style="text-align: right;"
  163. v-model="imageValue['goods_video']" fileMediatype="video" mode="grid" :limit="1"
  164. :auto-upload="false" @select="uploadVideo"></uni-file-picker>
  165. </view>
  166. </view>
  167. </view>
  168. </flex-line>
  169. </view>
  170. <view class="div label">商品详情描述</view>
  171. <view class="div main-content">
  172. <view class="div" v-if="ifAttr" @click="showPopup('showAttr')">
  173. <flex-line :is-link="true" :show-border="true"><text class="span line-name">商品属性</text></flex-line>
  174. </view>
  175. <view class="div" @click="showPopup('showDesc')">
  176. <flex-line :is-link="true" :show-border="true"><text class="span line-name">商品描述</text></flex-line>
  177. </view>
  178. <view class="div" @click="showPopup('showBrand')">
  179. <flex-line :is-link="true" :show-border="true"><text class="span line-name">商品品牌</text><text
  180. class="span" slot="right">{{goods.brand_name}}</text></flex-line>
  181. </view>
  182. </view>
  183. <view class="div label">商品物流信息</view>
  184. <view class="div main-content">
  185. <view class="div" @click="onRegion">
  186. <flex-line :is-link="true" :show-border="true"><text class="span line-name">地区</text><text
  187. class="span" slot="right">{{area_info}}</text></flex-line>
  188. </view>
  189. <flex-line :show-border="true"><text class="span line-name">固定运费</text>
  190. <view class="div" slot="right">
  191. <switch @change="switchChange(4,$event)" :checked="!!ifFixedFreight"></switch>
  192. </view>
  193. </flex-line>
  194. <flex-line v-if="ifFixedFreight" class="field-line" :show-border="true"><text
  195. class="span field-name">运费</text>
  196. <view class="div field-line-right" slot="right"><input class="field-input"
  197. v-model="goods.goods_freight" /></view>
  198. </flex-line>
  199. <view class="div" v-if="!ifFixedFreight" @click="showTransportList">
  200. <flex-line :is-link="true" :show-border="true"><text class="span line-name">售卖区域</text><text
  201. class="span" slot="right">{{goods.transport_title}}</text></flex-line>
  202. </view>
  203. </view>
  204. <view class="div label">发票信息</view>
  205. <view class="div main-content">
  206. <flex-line :show-border="true"><text class="span line-name">开增值税发票</text>
  207. <view class="div" slot="right">
  208. <switch @change="switchChange(5,$event)" :checked="!!goods.goods_vat"></switch>
  209. </view>
  210. </flex-line>
  211. </view>
  212. <view class="div label">其他信息</view>
  213. <view class="div main-content">
  214. <view class="div" @click="showPopup('showClass')">
  215. <flex-line :is-link="true" :show-border="true"><text class="span line-name">本店分类</text></flex-line>
  216. </view>
  217. <flex-line :show-border="true"><text class="span line-name">立即发布</text>
  218. <view class="div" slot="right">
  219. <switch @change="switchChange(6,$event)" :checked="!!goods.goods_state"></switch>
  220. </view>
  221. </flex-line>
  222. <view class="div" v-if="!goods.goods_state">
  223. <flex-line :is-link="true" :show-border="true">
  224. <text class="span line-name">发布时间</text>
  225. <view class="span" slot="right">
  226. <uni-datetime-picker class="common-datetime-picker" type="datetime"
  227. v-model="goods.goods_shelftime" :start="$moment().format('YYYY-MM-DD HH:mm')">
  228. </uni-datetime-picker>
  229. </view>
  230. </flex-line>
  231. </view>
  232. <flex-line :show-border="true"><text class="span line-name">预约</text>
  233. <view class="div" slot="right">
  234. <switch @change="switchChange(7,$event)" :checked="!!goods.is_appoint"></switch>
  235. </view>
  236. </flex-line>
  237. <view class="div" v-if="goods.is_appoint">
  238. <flex-line :is-link="true" :show-border="true">
  239. <text class="span line-name">发售日期</text>
  240. <view class="span" slot="right">
  241. <uni-datetime-picker class="common-datetime-picker" type="date"
  242. v-model="goods.appoint_satedate" :start="$moment().format('YYYY-MM-DD')">
  243. </uni-datetime-picker>
  244. </view>
  245. </flex-line>
  246. </view>
  247. <flex-line :show-border="true"><text class="span line-name">商品推荐</text>
  248. <view class="div" slot="right">
  249. <switch @change="switchChange(8,$event)" :checked="!!goods.goods_commend"></switch>
  250. </view>
  251. </flex-line>
  252. <view class="div pt-10 pb-10">
  253. <view class="div common-btn ds-button-large" @click="nextStep">{{commonid?'保存':'下一步'}}</view>
  254. </view>
  255. </view>
  256. <view class="div">
  257. <uni-popup background-color="#fff" ref="isshow" class="popup">
  258. <image mode="aspectFit" class="img" :src="showimage" :style="getBannerStyle"
  259. @click="hidePopup('isshow')">
  260. </uni-popup>
  261. <uni-popup background-color="#fff" ref="isVideo" class="popup">
  262. <view class="div iconfont close-btn" @click="hidePopup('isVideo')">&#xe69a;</view>
  263. <video autoplay="autoplay" controls="controls" :src="showVideo" :style="getBannerStyle"
  264. @click="hidePopup('isVideo')" />
  265. </uni-popup>
  266. </view>
  267. <view class="div">
  268. <uni-popup background-color="#fff" ref="showBrand" type="right">
  269. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  270. <view class="div common-header-wrap">
  271. <view :style="'height:'+navHeight+'px'"></view>
  272. <view class="common-header-holder"></view>
  273. <view class="common-header-fixed">
  274. <title-header />
  275. <uni-nav-bar title="品牌" class="common-header" left-icon="back"
  276. @clickLeft="hidePopup('showBrand')">
  277. <view class="div common-btn btn" slot="right"
  278. @click="hidePopup('showBrand');goods.brand_id=0;goods.brand_name=''">取消</view>
  279. </uni-nav-bar>
  280. </view>
  281. </view>
  282. <view class="div common-popup-content">
  283. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  284. <view class="div brand-list">
  285. <view class="div" v-for="(bclass,index) in brand_list" :key="index">
  286. <text class="h2">{{index}}</text>
  287. <view class="ul">
  288. <view class="li" v-for="item in bclass" v-bind:key="item.brand_id"
  289. @click="selectBrand(item.brand_id,item.brand_name)">
  290. <view class="div p-img"
  291. :style="'background-image:url('+item.brand_pic+')'"></view>
  292. </view>
  293. </view>
  294. </view>
  295. </view>
  296. </scroll-view>
  297. </view>
  298. </view>
  299. </uni-popup>
  300. <uni-popup background-color="#fff" ref="showTransportList" type="right">
  301. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  302. <transport-list ref="transportList" :ifComponent='true' :startLoading="true"
  303. @useTransport="useTransport" @editTransport="editTransport"
  304. @addTransport="transparentQuery={action:'add',transport_id:0};showPopup('showTransportForm')"
  305. @closeTransortList="hidePopup('showTransportList')" />
  306. </view>
  307. </uni-popup>
  308. <uni-popup background-color="#fff" ref="showTransportForm" type="right">
  309. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  310. <transport-form :query="transparentQuery" :ifComponent='true' @saveTransport="saveTransport"
  311. @closeTransortForm="hidePopup('showTransportForm')" />
  312. </view>
  313. </uni-popup>
  314. <uni-popup background-color="#fff" ref="showClass" type="right">
  315. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  316. <view class="div common-header-wrap">
  317. <view :style="'height:'+navHeight+'px'"></view>
  318. <view class="common-header-holder"></view>
  319. <view class="common-header-fixed">
  320. <title-header />
  321. <uni-nav-bar title="店铺分类" class="common-header" left-icon="back"
  322. @clickLeft="hidePopup('showClass')">
  323. </uni-nav-bar>
  324. </view>
  325. </view>
  326. <view class="div common-popup-content">
  327. <scroll-view class='pb-30' style="position: absolute;top:0;right:0;left:0;bottom:0"
  328. scroll-y="true">
  329. <view class="block-wrapper">
  330. <view class="div" v-for="(item,index) in sgcate_id" :key="index"
  331. @click="showPopup('showClassPicker');sgcate_index=index">
  332. <flex-line :is-link="true" :show-border="true"><text
  333. class="span line-name">选择分类</text><text class="span"
  334. slot="right">{{sgcate_name[index]}}</text></flex-line>
  335. </view>
  336. </view>
  337. </scroll-view>
  338. <view class='common-add-btn-wrapper'>
  339. <view class="div common-btn common-add-btn" @click="addStoreClass">新增</view>
  340. </view>
  341. </view>
  342. </view>
  343. <uni-popup background-color="#fff" ref="showClassPicker" type="bottom">
  344. <view>
  345. <view class="div toolbar">
  346. <text class="button toolbar-item cancel-item" @click="cancelClass">取消</text>
  347. <view class="div picker-header">选择分类</view>
  348. <text class="button toolbar-item confirm-item" @click="confirmClass">确定</text>
  349. </view>
  350. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onClassChange"
  351. :value="gcPicker">
  352. <picker-view-column v-for="(item,index) in buildItems" :key="index">
  353. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text
  354. class="popup-item">{{v.value}}</text></view>
  355. </picker-view-column>
  356. </picker-view>
  357. </view>
  358. </uni-popup>
  359. </uni-popup>
  360. <uni-popup background-color="#fff" ref="showSpecValue" type="right">
  361. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  362. <view class="div common-header-wrap">
  363. <view :style="'height:'+navHeight+'px'"></view>
  364. <view class="common-header-holder"></view>
  365. <view class="common-header-fixed">
  366. <title-header />
  367. <uni-nav-bar title="设置规格值" class="common-header" left-icon="back"
  368. @clickLeft="calcSpec()">
  369. </uni-nav-bar>
  370. </view>
  371. </view>
  372. <view class="div common-popup-content">
  373. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  374. <view class="div" v-for="(spvalue_key,k) in specArray.spvalue_key" :key="k">
  375. <view class="div label">{{spec[spvalue_key].label}}</view>
  376. <view class="block-wrapper">
  377. <flex-line class="field-line" :show-border="true"><text
  378. class="span field-name">商品价格</text>
  379. <view class="div field-line-right" slot="right"><input class="field-input"
  380. v-model="spec[spvalue_key].goods_price" /></view>
  381. </flex-line>
  382. <flex-line class="field-line" :show-border="true"><text
  383. class="span field-name">市场价</text>
  384. <view class="div field-line-right" slot="right"><input class="field-input"
  385. v-model="spec[spvalue_key].goods_marketprice" /></view>
  386. </flex-line>
  387. <flex-line class="field-line" :show-border="true"><text
  388. class="span field-name">商品重量</text>
  389. <view class="div field-line-right" slot="right"><input class="field-input"
  390. v-model="spec[spvalue_key].goods_weight" /></view>
  391. </flex-line>
  392. <flex-line v-if="goods.is_virtual==0 || goods.virtual_type==0"
  393. class="field-line" :show-border="true"><text
  394. class="span field-name">商品库存</text>
  395. <view class="div field-line-right" slot="right"><input class="field-input"
  396. v-model="spec[spvalue_key].goods_storage" /></view>
  397. </flex-line>
  398. <view v-if="goods.is_virtual==1 && goods.virtual_type==1"
  399. @click="showCard(spvalue_key)">
  400. <flex-line :is-link="true" :show-border="true"><text
  401. class="line-name">卡券管理</text>
  402. <view slot="right">
  403. 添加卡券【{{spec[spvalue_key].card_num?spec[spvalue_key].card_num:0}}】
  404. </view>
  405. </flex-line>
  406. </view>
  407. <flex-line v-if="goods.is_virtual==1 && goods.virtual_type==2"
  408. class="field-line" :show-border="true"><text class="field-name">网盘信息</text>
  409. <view class="field-line-right" slot="right"><input class="field-input"
  410. v-model="spec[spvalue_key].vc_pan" /></view>
  411. </flex-line>
  412. <flex-line v-if="goods.is_virtual==1 && goods.virtual_type==3" :show-border="true">
  413. <text>商品资源</text>
  414. <view slot="right">
  415. <uni-file-picker style="text-align: right;"
  416. v-model="vc_file[spvalue_key]" file-extname="zip" file-mediatype="all" :limit="1"
  417. :auto-upload="false" @select="uploadResource($event,spvalue_key)"></uni-file-picker>
  418. </view>
  419. </flex-line>
  420. <flex-line class="field-line" :show-border="true"><text
  421. class="span field-name">库存预警值</text>
  422. <view class="div field-line-right" slot="right"><input class="field-input"
  423. v-model="spec[spvalue_key].goods_storage_alarm" /></view>
  424. </flex-line>
  425. <flex-line class="field-line" :show-border="true"><text
  426. class="span field-name">商家货号</text>
  427. <view class="div field-line-right" slot="right"><input class="field-input"
  428. v-model="spec[spvalue_key].goods_serial" /></view>
  429. </flex-line>
  430. </view>
  431. </view>
  432. </scroll-view>
  433. </view>
  434. </view>
  435. </uni-popup>
  436. <uni-popup background-color="#fff" ref="showDesc" type="right">
  437. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  438. <view class="div common-header-wrap">
  439. <view :style="'height:'+navHeight+'px'"></view>
  440. <view class="common-header-holder"></view>
  441. <view class="common-header-fixed">
  442. <title-header />
  443. <uni-nav-bar title="商品描述" class="common-header" left-icon="back"
  444. @clickLeft="hidePopup('showDesc')">
  445. </uni-nav-bar>
  446. </view>
  447. </view>
  448. <view class="div common-popup-content">
  449. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  450. <view class="div body-list">
  451. <view class="div body-item" v-for="(item,index) in bodyList" :key='index'>
  452. <view class="div" v-if="item.type=='text'">{{item.value?item.value:'请输入内容'}}
  453. </view>
  454. <view class="div" v-if="item.type=='image'">
  455. <image mode="aspectFit"
  456. :style="'width:'+windowWidth+'px;height:'+windowWidth+'px'" class="img"
  457. v-if="item.value" :src="item.value_url"><text class="span"
  458. v-else>请上传图片</text>
  459. </view>
  460. <view class="div btn-list">
  461. <!--上移-->
  462. <text class="i iconfont" v-show="index!=0"
  463. @click="bodyMove(index,'up')">&#xe648;</text>
  464. <!--下移-->
  465. <text class="i iconfont" v-show="index!=(bodyList.length-1)"
  466. @click="bodyMove(index,'down')">&#xe643;</text>
  467. <!--插入-->
  468. <text class="i iconfont" @click="bodyAdd(index)">&#xe69c;</text>
  469. <!--编辑-->
  470. <text class="i iconfont" @click="bodyEdit(index,item)">&#xe658;</text>
  471. <!--删除-->
  472. <text class="i iconfont" v-show="index!=(bodyList.length-1)"
  473. @click="bodyDel(index)">&#xe641;</text>
  474. </view>
  475. </view>
  476. </view>
  477. </scroll-view>
  478. </view>
  479. </view>
  480. <uni-popup background-color="#fff" class="middle-popup" ref="bodyEditVisible">
  481. <view style="padding:1rem">
  482. <flex-line v-if="bodyItem.type=='text'" class="field-line" :show-border="true"><textarea
  483. class="field-input" placeholder="请输入内容" v-model="bodyItem.value"></textarea>
  484. </flex-line>
  485. <view v-if="bodyItem.type=='image'" class="div user-avatar">
  486. <uni-file-picker class="common-avatar" v-model="imageValue['goods_body']"
  487. fileMediatype="image" mode="grid" :limit="1" :auto-upload="false"
  488. @select="uploadImage('goods_body',$event)" :image-styles="{
  489. width:'100px',
  490. height:'100px',
  491. }"></uni-file-picker>
  492. </view>
  493. </view>
  494. </uni-popup>
  495. <uni-popup background-color="#fff" class="middle-popup" ref="bodyAddVisible">
  496. <view style="padding:1rem">
  497. <flex-line :show-border="true">
  498. <text class="span">类型</text>
  499. <view class="div" slot="right">
  500. <radio-group @change="radioChange">
  501. <label v-for="(item, index) in bodyTypeOptions" :key="index">
  502. <radio :value="item.value" :checked="bodyType==item.value" />
  503. <text>{{item.label}}</text>
  504. </label>
  505. </radio-group>
  506. </view>
  507. </flex-line>
  508. <view class="div btn-wrapper">
  509. <view class="div common-btn ds-button-large default btn"
  510. @click="hidePopup('bodyAddVisible')">取消</view>
  511. <view class="div common-btn ds-button-large btn" @click='confirmBodyAdd'>确定</view>
  512. </view>
  513. </view>
  514. </uni-popup>
  515. </uni-popup>
  516. <uni-popup background-color="#fff" ref="showAttr" type="right">
  517. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  518. <view class="div common-header-wrap">
  519. <view :style="'height:'+navHeight+'px'"></view>
  520. <view class="common-header-holder"></view>
  521. <view class="common-header-fixed">
  522. <title-header />
  523. <uni-nav-bar title="商品属性" class="common-header" left-icon="back"
  524. @clickLeft="hidePopup('showAttr')">
  525. </uni-nav-bar>
  526. </view>
  527. </view>
  528. <view class="div common-popup-content" v-if="attr_list">
  529. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  530. <view class="block-wrapper">
  531. <view class="div" v-for="(item,index) in attr_list" :key="index"
  532. @click="popAttr(index)">
  533. <flex-line :is-link="true" :show-border="true"><text
  534. class="span line-name">{{item.attr_name}}</text><text class="span"
  535. slot="right">{{attrValue[index]}}</text></flex-line>
  536. </view>
  537. </view>
  538. </scroll-view>
  539. </view>
  540. </view>
  541. <uni-popup background-color="#fff" v-for="(item,index) in attrList" :key="index"
  542. :ref="'showAttrValue_'+index" type="bottom">
  543. <view>
  544. <view class="div toolbar">
  545. <text class="button toolbar-item cancel-item" @click="cancelAttr(index)">取消</text>
  546. <view class="div picker-header">选择属性</view>
  547. <text class="button toolbar-item confirm-item" @click="confirmAttr(index)">确定</text>
  548. </view>
  549. </view>
  550. <picker-view class="popup-content" indicator-style="height:80rpx" :value="gaPicker[index]"
  551. @change="onAttrChange($event,index)">
  552. <picker-view-column v-for="(item,index) in attrList[index]" :key="index">
  553. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text
  554. class="popup-item">{{v.attrvalue_name}}</text></view>
  555. </picker-view-column>
  556. </picker-view>
  557. </uni-popup>
  558. </uni-popup>
  559. <uni-popup background-color="#fff" ref="showSpecName" type="right">
  560. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  561. <view class="div common-header-wrap">
  562. <view :style="'height:'+navHeight+'px'"></view>
  563. <view class="common-header-holder"></view>
  564. <view class="common-header-fixed">
  565. <title-header />
  566. <uni-nav-bar title="设置规格名" class="common-header" left-icon="back"
  567. @clickLeft="hideSpecName()">
  568. </uni-nav-bar>
  569. </view>
  570. </view>
  571. <view class="div common-popup-content" v-if="spec_list">
  572. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  573. <view class="block-wrapper">
  574. <view class="div" v-for="(val,k) in spec_list" :key="k">
  575. <flex-line class="field-line" :show-border="true">
  576. <view class="div field-line-right" slot="right"><input class="field-input"
  577. style="text-align: left;" v-model="sp_name[k]" /></view>
  578. </flex-line>
  579. <checkbox-group @change="checkboxChange(k,$event)">
  580. <label v-for="(item,i) in sp_option[k]" :key="i">
  581. <checkbox :checked="sp_val[k].indexOf(item.value+'')>-1"
  582. :value="item.value+''">
  583. </checkbox>
  584. {{item.label}}
  585. </label>
  586. </checkbox-group>
  587. <view class="div common-btn ds-button-large mt-10"
  588. @click="sp_id=k;showPopup('showSpecAdd')">添加规格值</view>
  589. </view>
  590. </view>
  591. </scroll-view>
  592. </view>
  593. </view>
  594. <uni-popup background-color="#fff" ref="showSpecAdd">
  595. <view style="padding:1rem">
  596. <flex-line class="field-line" :show-border="true">
  597. <view class="div field-line-right" slot="right"><input class="field-input"
  598. style="text-align: left;" v-model="spec_add_value" placeholder="请输入规格值" />
  599. </view>
  600. </flex-line>
  601. <view class="div common-btn ds-button-large mt-10" @click="goodsSpecAdd()">确定</view>
  602. </view>
  603. </uni-popup>
  604. </uni-popup>
  605. </view>
  606. <view class="div">
  607. <region-picker ref="picker" @onConfirm="onPickerConfirm" @onCancel="area_info=''"></region-picker>
  608. </view>
  609. <tui-picture-cropper v-if="cropperOption.imgUrl" :width="cropperOption.autoCropWidth"
  610. :height="cropperOption.autoCropHeight" :imageUrl="cropperOption.img" @ready="cropReady"
  611. @cropper="useCrop" @back="cropBack"></tui-picture-cropper>
  612. <uni-popup background-color="#fff" ref="showVirtualPicker" type="bottom">
  613. <view>
  614. <view class="toolbar">
  615. <text class="button toolbar-item cancel-item" @click="hidePopup('showVirtualPicker')">取消</text>
  616. <view class="picker-header">选择虚拟商品类型</view>
  617. <text class="button toolbar-item confirm-item" @click="confirmVirtual">确定</text>
  618. </view>
  619. <picker-view class="popup-content" indicator-style="height:80rpx" @change="onVirtualChange"
  620. :value="virtualPicker">
  621. <picker-view-column v-for="(item,index) in virtualItems" :key="index">
  622. <view class="popup-item-wrapper" v-for="(v,i) in item.values" :key="i"><text
  623. class="popup-item">{{v.name}}</text></view>
  624. </picker-view-column>
  625. </picker-view>
  626. </view>
  627. </uni-popup>
  628. <uni-popup background-color="#fff" class="middle-popup" ref="cardPopup">
  629. <view class="card-wrapper">
  630. <view class="card-notice">添加卡密格式为卡号+空格+密码,一行一组,如AAAAA BBBBB</view>
  631. <textarea class="card-textarea" v-model="cardContent"></textarea>
  632. <view class="common-btn ds-button-large mt-10" @click="addCard()">确定</view>
  633. </view>
  634. </uni-popup>
  635. </view>
  636. </seller-base>
  637. </template>
  638. <script>
  639. import TitleHeader from '../../TitleHeader'
  640. import {
  641. urlencode,
  642. getFontSize
  643. } from '@/util/common'
  644. import SellerBase from '../SellerBase'
  645. import tuiPictureCropper from "@/components/thorui/tui-picture-cropper/tui-picture-cropper"
  646. import Step from '../../Step'
  647. import transportList from '../transport/transportList'
  648. import transportForm from '../transport/transportForm'
  649. import RegionPicker from '../../RegionPicker'
  650. import {
  651. getBrandList
  652. } from '../../../api/homesearch'
  653. import {
  654. getCommonData,
  655. goodsEdit,
  656. goodsSpecAdd,
  657. uploadInfoFile,
  658. uploadVideo,
  659. goodsSave,
  660. uploadResource,
  661. delResource
  662. } from '../../../api/sellerGoods'
  663. import {
  664. getGoodsClassTree
  665. } from '../../../api/sellerGoodsClass'
  666. import flexLine from '../../flexLine'
  667. export default {
  668. data() {
  669. return {
  670. spvalue_key: '',
  671. cardContent: '',
  672. virtualItems: [{
  673. flex: 1,
  674. values: [{
  675. id: 0,
  676. name: '核销商品'
  677. }, {
  678. id: 1,
  679. name: '卡券商品'
  680. }, {
  681. id: 2,
  682. name: '网盘商品'
  683. }, {
  684. id: 3,
  685. name: '下载商品'
  686. }],
  687. textAlign: 'center'
  688. }],
  689. navHeight: 0,
  690. gaPicker: {},
  691. virtualPicker: [0],
  692. gcPicker: [0, 0],
  693. imageValue: {},
  694. vc_file: {},
  695. screenWidth: 0,
  696. cropType: '',
  697. cropperOption: {
  698. img: '',
  699. canMove: false,
  700. autoCrop: true,
  701. autoCropWidth: 100,
  702. autoCropHeight: 100,
  703. maxImgSize: 500,
  704. outputType: 'png'
  705. },
  706. controller: 'Sellergoodsonline',
  707. options: [{
  708. title: '选择商品分类'
  709. }, {
  710. title: '填写商品详情'
  711. }, {
  712. title: '上传商品图片'
  713. }],
  714. ifLoad: 0,
  715. class_id: 0,
  716. commonid: 0,
  717. action: '',
  718. goods: {
  719. goods_state: true,
  720. virtual_type: 0,
  721. virtual_type_text: '核销商品'
  722. },
  723. selectAttr: {},
  724. ifAttr: false,
  725. attrValue: {},
  726. attrList: {},
  727. ifSpec: false,
  728. mulSpec: false,
  729. showimage: '',
  730. showVideo: '',
  731. sp_val: {},
  732. sp_name: {},
  733. sp_option: {},
  734. spec_list: false,
  735. spec_json: false,
  736. attr_list: false,
  737. sp_id: 0,
  738. spec_add_value: '',
  739. specArray: false,
  740. spec: {},
  741. bodyVisible: false,
  742. bodyIndex: 0,
  743. bodyList: [{
  744. type: 'text',
  745. value: ''
  746. }],
  747. bodyItem: false,
  748. bodyTypeOptions: [{
  749. label: '文字',
  750. value: 'text'
  751. },
  752. {
  753. label: '图片',
  754. value: 'image'
  755. }
  756. ],
  757. bodyType: 'text',
  758. area_info: '',
  759. ifFixedFreight: true,
  760. brand_list: {},
  761. g_fccount: '',
  762. g_fcprefix: '',
  763. transparentQuery: {
  764. action: 'add',
  765. transport_id: 0
  766. },
  767. items: false,
  768. sgcate_id: [0],
  769. sgcate_name: [''],
  770. sgcate_index: 0,
  771. goods_class: {},
  772. attr_checked: false,
  773. spec_checked: false
  774. }
  775. },
  776. onLoad: function(option) {
  777. this.class_id = option.class_id ? option.class_id : ''
  778. this.commonid = option.commonid ? option.commonid : ''
  779. this.action = option.commonid ? 'add' : 'edit'
  780. getGoodsClassTree().then(res => {
  781. this.items = res.result.class_list
  782. }).catch(error => {
  783. uni.showToast({
  784. icon: 'none',
  785. title: error.message
  786. })
  787. })
  788. getBrandList(0).then(res => {
  789. this.brand_list = res.result.brand_l
  790. }).catch(function(error) {
  791. uni.showToast({
  792. icon: 'none',
  793. title: error.message
  794. })
  795. })
  796. getCommonData(this.controller, this.class_id).then(res => {
  797. var spec_list = res.result.spec_list
  798. var attr_list = res.result.attr_list
  799. if (attr_list && Object.keys(attr_list).length) {
  800. this.ifAttr = true
  801. this.attr_list = attr_list
  802. for (var i in attr_list) {
  803. this.attrList[i] = [{
  804. flex: 1,
  805. values: attr_list[i].value,
  806. textAlign: 'center'
  807. }]
  808. this.gaPicker[i] = [0]
  809. }
  810. }
  811. var sp_option = {}
  812. if (spec_list && Object.keys(spec_list).length) {
  813. this.mulSpec = true
  814. for (var k in spec_list) {
  815. var val = spec_list[k]
  816. sp_option[k] = []
  817. this.sp_val[k] = []
  818. if (typeof(this.sp_name[k]) === 'undefined') {
  819. this.sp_name[k] = val.sp_name
  820. }
  821. for (var j in val.value) {
  822. sp_option[k].push({
  823. label: val.value[j].spvalue_name,
  824. value: val.value[j].spvalue_id
  825. })
  826. }
  827. }
  828. }
  829. this.goods_class = res.result.goods_class
  830. this.spec_json = res.result.spec_json
  831. this.sp_option = sp_option
  832. this.spec_list = spec_list
  833. if (!this.goods_class.gc_id) {
  834. uni.showToast({
  835. icon: 'none',
  836. title: '请重新选择分类'
  837. })
  838. uni.navigateTo({
  839. url: '/pages/seller/goods/GoodsForm1' + '?' + urlencode({
  840. commonid: this.commonid
  841. })
  842. })
  843. }
  844. this.ifLoad++
  845. }).catch(error => {
  846. uni.showToast({
  847. icon: 'none',
  848. title: error.message
  849. })
  850. })
  851. if (this.commonid) {
  852. goodsEdit(this.controller, this.commonid).then(res => {
  853. var spec_checked = res.result.spec_checked
  854. this.attr_checked = res.result.attr_checked
  855. var goods = res.result.goods
  856. goods.is_virtual = !!goods.is_virtual
  857. goods.is_goodsfcode = !!goods.is_goodsfcode
  858. goods.goods_vat = !!goods.goods_vat
  859. goods.goods_state = !!goods.goods_state
  860. goods.is_appoint = !!goods.is_appoint
  861. goods.goods_commend = !!goods.goods_commend
  862. goods.virtual_invalid_refund = !!goods.virtual_invalid_refund
  863. if (goods.vc_file) {
  864. this.vc_file[0] = [{
  865. name: 'vc_file',
  866. extname: 'zip',
  867. url: goods.vc_file
  868. }]
  869. }
  870. if (goods.mb_body) {
  871. this.bodyList = goods.mb_body
  872. }
  873. this.ifFixedFreight = !goods.transport_id
  874. this.goods = goods
  875. if (this.goods.goods_image) {
  876. this.imageValue['goods_image'] = [{
  877. name: 'goods_image',
  878. extname: 'jpg',
  879. url: this.goods.goods_image_url
  880. }]
  881. }
  882. if (this.goods.goodsvideo_url) {
  883. this.imageValue['goods_video'] = [{
  884. name: 'goods_image',
  885. extname: 'mp4',
  886. url: this.goods.goodsvideo_url
  887. }]
  888. }
  889. if (goods.spec_name) {
  890. for (var k in goods.spec_name) {
  891. this.sp_name[k] = goods.spec_name[k]
  892. }
  893. }
  894. this.area_info = res.result.area ? res.result.area.area_name : ''
  895. var sp_value = res.result.sp_value
  896. for (var i in sp_value) {
  897. this.spec[i] = {
  898. goods_id: sp_value[i]['id'],
  899. label: sp_value[i]['label'],
  900. color: sp_value[i]['color'],
  901. sp_value: sp_value[i]['sp_value'],
  902. goods_marketprice: sp_value[i]['marketprice'],
  903. goods_price: sp_value[i]['price'],
  904. goods_storage_alarm: sp_value[i]['alarm'],
  905. goods_serial: sp_value[i]['sku'],
  906. goods_storage: sp_value[i]['stock'],
  907. goods_weight: sp_value[i]['goods_weight'],
  908. vc_card: sp_value[i]['vc_card'],
  909. vc_pan: sp_value[i]['vc_pan'],
  910. vc_file: sp_value[i]['vc_file']
  911. }
  912. }
  913. this.spec_checked = spec_checked
  914. this.sgcate_id = res.result.store_class_goods
  915. let store_goods_class = res.result.store_goods_class
  916. for (var i in this.sgcate_id) {
  917. if (store_goods_class[this.sgcate_id[i]]) {
  918. this.sgcate_name[i] = store_goods_class[this.sgcate_id[i]].storegc_name
  919. }
  920. }
  921. this.ifLoad++
  922. }).catch(error => {
  923. uni.showToast({
  924. icon: 'none',
  925. title: error.message
  926. })
  927. })
  928. }
  929. },
  930. computed: {
  931. fontSize() {
  932. return getFontSize()
  933. },
  934. getBannerStyle: function() {
  935. const res = uni.getSystemInfoSync()
  936. var width = res.windowWidth
  937. var height = res.windowHeight
  938. let itemWidth = width
  939. let itemHeight = height
  940. return "max-width:" + itemWidth + "px;max-height:" + itemHeight + "px"
  941. },
  942. windowWidth: function() {
  943. const res = uni.getSystemInfoSync()
  944. var width = res.windowWidth
  945. var size = getFontSize()
  946. return width - 2 * size
  947. },
  948. buildItems: function() {
  949. if (!this.items || !this.items[0]) {
  950. return []
  951. }
  952. let items = new Array()
  953. this.getDefaultItems(this.items, items)
  954. return items
  955. }
  956. },
  957. components: {
  958. TitleHeader,
  959. SellerBase,
  960. flexLine,
  961. tuiPictureCropper,
  962. Step,
  963. RegionPicker,
  964. transportForm,
  965. transportList
  966. },
  967. watch: {
  968. ifLoad: function() {
  969. if (this.attr_checked && this.attr_list && Object.keys(this.attr_checked).length && Object.keys(this
  970. .attr_list).length) {
  971. for (var i in this.attr_list) {
  972. for (var j in this.attr_list[i].value) {
  973. if (this.attr_checked.indexOf(this.attr_list[i].value[j].attrvalue_id) > -1) {
  974. this.attrValue[i] = this.attr_list[i].value[j].attrvalue_name
  975. }
  976. }
  977. }
  978. }
  979. if (this.spec_checked && Object.keys(this.spec_checked).length && this.spec_json && Object.keys(this
  980. .spec_json).length) {
  981. this.ifSpec = true
  982. var spvalue_ids = Object.keys(this.spec_checked)
  983. for (var i in this.spec_json) {
  984. var temp = Object.keys(this.spec_json[i])
  985. var arr = temp.filter(function(v) {
  986. return spvalue_ids.indexOf(v) !== -1 // 利用filter方法来遍历是否有相同的元素
  987. })
  988. if (arr.length) {
  989. this.sp_val[i] = arr
  990. }
  991. }
  992. this.getSpecArray()
  993. }
  994. this.$forceUpdate()
  995. }
  996. },
  997. mounted() {
  998. // #ifdef MP-WEIXIN
  999. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  1000. // #endif
  1001. this.screenWidth = uni.getSystemInfoSync().screenWidth
  1002. },
  1003. methods: {
  1004. uploadResource(event, spvalue_key) {
  1005. let files = event.tempFiles[0]
  1006. if (typeof(files) === 'undefined') {
  1007. return
  1008. }
  1009. var formdata = {
  1010. filePath: files.path,
  1011. name: 'file',
  1012. id: 'file'
  1013. }
  1014. uni.showLoading({
  1015. title: '加载中'
  1016. })
  1017. uploadResource(formdata).then(res => {
  1018. if (spvalue_key) {
  1019. this.spec[spvalue_key].vc_file = res.result.name
  1020. } else {
  1021. this.goods.vc_file = res.result.name
  1022. }
  1023. this.vc_file[spvalue_key?spvalue_key:0] = [{
  1024. name: 'vc_file',
  1025. extname: 'zip',
  1026. url: res.result.name
  1027. }]
  1028. this.$forceUpdate()
  1029. uni.hideLoading()
  1030. }).catch(function(error) {
  1031. uni.showToast({
  1032. icon: 'none',
  1033. title: error.message
  1034. })
  1035. uni.hideLoading()
  1036. })
  1037. },
  1038. showCard(spvalue_key) {
  1039. this.spvalue_key = spvalue_key
  1040. if (spvalue_key) {
  1041. this.cardContent = this.spec[spvalue_key].vc_card
  1042. } else {
  1043. this.cardContent = this.goods.vc_card
  1044. }
  1045. this.showPopup('cardPopup')
  1046. },
  1047. addCard() {
  1048. var snsArr = this.cardContent.split(/[(\r\n)\r\n]+/)
  1049. if (snsArr.length > 1000) {
  1050. uni.showToast({
  1051. icon: 'none',
  1052. title: '最多可添加100对卡密'
  1053. })
  1054. return
  1055. }
  1056. snsArr.forEach((item, index) => {
  1057. if (!item) {
  1058. snsArr.splice(index, 1); //删除空项
  1059. }
  1060. })
  1061. if (snsArr.length > 100) {
  1062. uni.showToast({
  1063. icon: 'none',
  1064. title: '最多可添加100对卡密'
  1065. })
  1066. return
  1067. }
  1068. if (this.spvalue_key) {
  1069. this.spec[this.spvalue_key].vc_card = this.cardContent
  1070. this.spec[this.spvalue_key].card_num = snsArr.length
  1071. } else {
  1072. this.goods.vc_card = this.cardContent
  1073. this.goods.card_num = snsArr.length
  1074. }
  1075. this.hidePopup('cardPopup')
  1076. this.$forceUpdate()
  1077. },
  1078. onVirtualChange(e) {
  1079. this.virtualPicker = e.detail.value
  1080. this.$forceUpdate()
  1081. },
  1082. confirmVirtual() {
  1083. let values = []
  1084. for (var i in this.virtualPicker) {
  1085. values[i] = this.virtualItems[i]['values'][this.virtualPicker[i]]
  1086. if (!values[i]) {
  1087. values[i] = {
  1088. id: 0,
  1089. name: ''
  1090. }
  1091. }
  1092. }
  1093. var temp = values[0]
  1094. this.goods.virtual_type = temp.id
  1095. this.goods.virtual_type_text = temp.name
  1096. this.hidePopup('showVirtualPicker')
  1097. this.$forceUpdate()
  1098. },
  1099. checkboxChange(k, event) {
  1100. this.sp_val[k] = event.detail.value
  1101. this.$forceUpdate()
  1102. },
  1103. switchChange(i, e) {
  1104. switch (i) {
  1105. case 1:
  1106. this.goods.is_virtual = e.detail.value
  1107. break
  1108. case 2:
  1109. this.goods.virtual_invalid_refund = e.detail.value
  1110. break
  1111. case 3:
  1112. this.goods.is_goodsfcode = e.detail.value
  1113. break
  1114. case 4:
  1115. this.ifFixedFreight = e.detail.value
  1116. break
  1117. case 5:
  1118. this.goods.goods_vat = e.detail.value
  1119. break
  1120. case 6:
  1121. this.goods.goods_state = e.detail.value
  1122. break
  1123. case 7:
  1124. this.goods.is_appoint = e.detail.value
  1125. break
  1126. case 8:
  1127. this.goods.goods_commend = e.detail.value
  1128. break
  1129. }
  1130. this.$forceUpdate()
  1131. },
  1132. radioChange(e) {
  1133. this.bodyType = e.detail.value
  1134. },
  1135. showPopup(id) {
  1136. this.$refs[id].open()
  1137. },
  1138. hidePopup(id) {
  1139. this.$refs[id].close()
  1140. },
  1141. goBack() {
  1142. uni.navigateBack({
  1143. delta: 1
  1144. })
  1145. },
  1146. hideSpecName() {
  1147. this.hidePopup('showSpecName')
  1148. this.checkSpec()
  1149. this.calcSpec()
  1150. },
  1151. goClass() {
  1152. uni.navigateTo({
  1153. url: '/pages/seller/goods/GoodsForm1' + '?' + urlencode({
  1154. commonid: this.commonid
  1155. })
  1156. })
  1157. },
  1158. popAttr(index) {
  1159. this.$refs['showAttrValue_' + index][0].open()
  1160. this.$forceUpdate()
  1161. },
  1162. selectBrand(brand_id, brand_name) {
  1163. this.goods.brand_name = brand_name
  1164. this.goods.brand_id = brand_id
  1165. this.hidePopup('showBrand')
  1166. },
  1167. calcSpec() {
  1168. let min_price
  1169. let min_marketprice
  1170. let total_storage = 0
  1171. let goods_storage_alarm = 0
  1172. let goods_serial
  1173. var goods_weight = 0
  1174. for (var j in this.specArray.spvalue_key) {
  1175. var i = this.specArray.spvalue_key[j]
  1176. if (isNaN(this.spec[i].goods_storage)) {
  1177. this.spec[i].goods_storage = 0
  1178. }
  1179. if (isNaN(this.spec[i].goods_storage_alarm)) {
  1180. this.spec[i].goods_storage_alarm = 0
  1181. }
  1182. if (!goods_weight) {
  1183. goods_weight = this.spec[i].goods_weight
  1184. }
  1185. var temp = parseFloat(this.spec[i].goods_price)
  1186. if (!isNaN(temp) && (typeof(min_price) === 'undefined' || min_price > temp)) {
  1187. min_price = temp
  1188. min_marketprice = this.spec[i].goods_marketprice
  1189. goods_storage_alarm = this.spec[i].goods_storage_alarm
  1190. goods_serial = this.spec[i].goods_serial
  1191. }
  1192. if (this.spec[i].goods_storage > 0) {
  1193. total_storage += parseInt(this.spec[i].goods_storage)
  1194. }
  1195. }
  1196. this.goods.goods_serial = goods_serial
  1197. this.goods.goods_price = min_price
  1198. this.goods.goods_marketprice = min_marketprice
  1199. this.goods.goods_storage_alarm = goods_storage_alarm
  1200. this.goods.goods_storage = total_storage
  1201. this.goods.goods_weight = goods_weight
  1202. this.hidePopup('showSpecValue')
  1203. },
  1204. checkSpec() {
  1205. this.ifSpec = false
  1206. for (var k in this.sp_val) {
  1207. if (this.sp_val[k].length) {
  1208. this.ifSpec = true
  1209. break
  1210. }
  1211. }
  1212. this.getSpecArray()
  1213. },
  1214. addStoreClass() {
  1215. this.sgcate_id.push(0)
  1216. this.sgcate_name.push('')
  1217. },
  1218. getDefaultItems(_item, defaultItems) {
  1219. defaultItems.push({
  1220. flex: 1,
  1221. values: _item,
  1222. textAlign: 'center'
  1223. })
  1224. defaultItems.push({
  1225. flex: 1,
  1226. values: _item[0].children,
  1227. textAlign: 'center'
  1228. })
  1229. },
  1230. cancelClass() {
  1231. this.hidePopup('showClassPicker')
  1232. },
  1233. confirmClass() {
  1234. let values = []
  1235. for (var i in this.gcPicker) {
  1236. values[i] = this.buildItems[i]['values'][this.gcPicker[i]]
  1237. if (!values[i]) {
  1238. values[i] = {
  1239. id: 0,
  1240. value: ''
  1241. }
  1242. }
  1243. }
  1244. var temp = values[1]
  1245. if (!temp.id) {
  1246. temp = values[0]
  1247. }
  1248. this.sgcate_name.splice(this.sgcate_index, 1, temp.value)
  1249. this.sgcate_id[this.sgcate_index] = temp.id
  1250. this.hidePopup('showClassPicker')
  1251. },
  1252. onClassChange(e) {
  1253. let value = e.detail.value
  1254. let gcPicker = this.gcPicker
  1255. for (var i in value) {
  1256. gcPicker[i] = value[i]
  1257. i = parseInt(i)
  1258. if (i < (value.length - 1)) {
  1259. if (!this.buildItems[i]['values'].length || !this.buildItems[i]['values'][value[i]]['children'] ||
  1260. !this.buildItems[i]['values'][value[i]]['children'].length) {
  1261. this.buildItems[i + 1]['values'] = []
  1262. gcPicker[i + 1] = 0
  1263. } else if (!this.buildItems[i + 1]['values'].length || this.buildItems[i]['values'][value[i]][
  1264. 'children'
  1265. ][0]['id'] != this.buildItems[i + 1]['values'][0]['id']) {
  1266. this.buildItems[i + 1]['values'] = this.buildItems[i]['values'][value[i]]['children']
  1267. gcPicker[i + 1] = 0
  1268. }
  1269. }
  1270. }
  1271. this.gcPicker = gcPicker
  1272. this.$forceUpdate()
  1273. },
  1274. cancelAttr(index) {
  1275. this.$refs['showAttrValue_' + index][0].close()
  1276. this.$forceUpdate()
  1277. },
  1278. confirmAttr(index) {
  1279. let values = []
  1280. for (var i in this.gaPicker[index]) {
  1281. values[i] = this.attrList[index][i]['values'][this.gaPicker[index][i]]
  1282. if (!values[i]) {
  1283. values[i] = {
  1284. attrvalue_id: 0,
  1285. attrvalue_name: ''
  1286. }
  1287. }
  1288. }
  1289. if (typeof(this.selectAttr[index]) === 'undefined') {
  1290. this.selectAttr[index] = {
  1291. name: this.attr_list[index].attr_name
  1292. }
  1293. this.selectAttr[index][values[0].attrvalue_id] = values[0].attrvalue_name
  1294. }
  1295. this.cancelAttr(index)
  1296. this.attrValue[index] = values[0].attrvalue_name
  1297. this.$forceUpdate()
  1298. },
  1299. onAttrChange(e, index) {
  1300. this.gaPicker[index] = e.detail.value
  1301. },
  1302. showTransportList() {
  1303. this.showPopup('showTransportList')
  1304. this.$nextTick(function() {
  1305. this.$refs.transportList.reload()
  1306. })
  1307. },
  1308. saveTransport() {
  1309. this.$refs.transportList.reload()
  1310. this.hidePopup('showTransportForm')
  1311. },
  1312. useTransport(transport_id, transport_title) {
  1313. this.goods.transport_id = transport_id
  1314. this.goods.transport_title = transport_title
  1315. this.hidePopup('showTransportList')
  1316. },
  1317. editTransport(transport_id) {
  1318. this.transparentQuery = {
  1319. action: 'edit',
  1320. transport_id: transport_id
  1321. }
  1322. this.showPopup('showTransportForm')
  1323. },
  1324. onRegion(picker, values) {
  1325. this.$refs.picker.show()
  1326. },
  1327. onPickerConfirm(values) {
  1328. this.area_info = this.getRegionStr(values)
  1329. this.goods.areaid_1 = values[0].area_id
  1330. this.goods.areaid_2 = values[1].area_id
  1331. },
  1332. getRegionStr(values) {
  1333. let title = ''
  1334. for (let i = 0; i < values.length; i++) {
  1335. const element = values[i]
  1336. if (i !== 0) {
  1337. title = title + ' ' + element.area_name
  1338. } else {
  1339. title = title + element.area_name
  1340. }
  1341. }
  1342. return title
  1343. },
  1344. bodyDel(index) {
  1345. this.bodyList.splice(index, 1)
  1346. },
  1347. bodyMove(index, mode) {
  1348. if (mode == 'up') {
  1349. this.bodyList.splice(index - 1, 2, this.bodyList[index], this.bodyList[index - 1])
  1350. } else {
  1351. this.bodyList.splice(index, 2, this.bodyList[index + 1], this.bodyList[index])
  1352. }
  1353. },
  1354. confirmBodyAdd() {
  1355. let bodyItem = {
  1356. type: this.bodyType,
  1357. value: ''
  1358. }
  1359. this.bodyList.splice(this.bodyIndex, 0, bodyItem)
  1360. this.hidePopup('bodyAddVisible')
  1361. this.bodyEdit(this.bodyIndex, bodyItem)
  1362. },
  1363. bodyAdd(index) {
  1364. this.showPopup('bodyAddVisible')
  1365. this.bodyIndex = index
  1366. },
  1367. bodyEdit(index, item) {
  1368. this.showPopup('bodyEditVisible')
  1369. this.bodyItem = item
  1370. if (this.bodyItem.value_url) {
  1371. this.imageValue['goods_body'] = [{
  1372. name: 'goods_body',
  1373. extname: 'jpg',
  1374. url: this.bodyItem.value_url
  1375. }]
  1376. }
  1377. },
  1378. getSpecArray() {
  1379. let sp_val = this.sp_val
  1380. this.specArray = this.doExchange(sp_val)
  1381. this.$forceUpdate()
  1382. },
  1383. doExchange(arr) {
  1384. var len = Object.keys(arr).length
  1385. // 当数组大于等于2个的时候
  1386. if (len >= 2 || typeof(arr[0]) === 'undefined') {
  1387. var j = 0
  1388. var myArr = []
  1389. // 将新组合的数组并到原数组中
  1390. var newArr = {}
  1391. for (var i in arr) {
  1392. if (myArr.length > 1) {
  1393. if (arr[i].length) {
  1394. newArr[i] = arr[i]
  1395. }
  1396. } else {
  1397. if (i == 0 || arr[i].length) {
  1398. myArr.push({
  1399. sp_id: i,
  1400. spvalue_id: arr[i]
  1401. })
  1402. }
  1403. }
  1404. j++
  1405. }
  1406. if (myArr.length > 0) {
  1407. var temp
  1408. if (typeof(arr[0]) === 'undefined') {
  1409. temp = {
  1410. spvalue_id: [],
  1411. spvalue_name: []
  1412. }
  1413. for (var i in myArr[0].spvalue_id) {
  1414. temp.spvalue_id[i] = [myArr[0].spvalue_id[i]]
  1415. temp.spvalue_name[i] = [this.spec_json[myArr[0].sp_id][myArr[0].spvalue_id[i]]
  1416. .spvalue_name]
  1417. }
  1418. } else {
  1419. temp = arr[0]
  1420. }
  1421. if (myArr.length > 1) {
  1422. newArr[0] = {
  1423. spvalue_id: [],
  1424. spvalue_name: []
  1425. }
  1426. var index = 0
  1427. for (var i in temp.spvalue_id) {
  1428. for (var j in myArr[1].spvalue_id) {
  1429. newArr[0].spvalue_id[index] = temp.spvalue_id[i].concat([myArr[1].spvalue_id[j]])
  1430. newArr[0].spvalue_name[index] = temp.spvalue_name[i].concat([this.spec_json[myArr[1]
  1431. .sp_id][myArr[1].spvalue_id[j]].spvalue_name])
  1432. index++
  1433. }
  1434. }
  1435. } else {
  1436. newArr[0] = temp
  1437. }
  1438. } else {
  1439. newArr[0] = []
  1440. }
  1441. // 执行回调
  1442. return this.doExchange(newArr)
  1443. } else {
  1444. arr[0]['spvalue_key'] = []
  1445. for (var i in arr[0].spvalue_id) {
  1446. let color = null
  1447. var spvalue_id_list = arr[0].spvalue_id[i]
  1448. if (this.spec_list[1]) {
  1449. for (var j in this.spec_list[1].value) {
  1450. if (spvalue_id_list.indexOf(this.spec_list[1].value[j].spvalue_id) > -1 || spvalue_id_list
  1451. .indexOf(this.spec_list[1].value[j].spvalue_id.toString()) > -1) {
  1452. color = this.spec_list[1].value[j].spvalue_id
  1453. }
  1454. }
  1455. }
  1456. var spvalue_name = arr[0].spvalue_name[i]
  1457. var spvalue_id = arr[0].spvalue_id[i]
  1458. var sp_value = {}
  1459. for (var k in spvalue_name) {
  1460. sp_value[spvalue_id[k]] = spvalue_name[k]
  1461. }
  1462. var spvalue_id_str = spvalue_id.sort(function(a, b) {
  1463. return a - b
  1464. }).join('')
  1465. arr[0]['spvalue_key'].push(spvalue_id_str)
  1466. if (typeof(this.spec[spvalue_id_str]) === 'undefined') {
  1467. this.spec[spvalue_id_str] = {
  1468. goods_id: 0,
  1469. label: arr[0].spvalue_name[i].join('|'),
  1470. color: color,
  1471. sp_value: sp_value,
  1472. goods_marketprice: this.goods.goods_marketprice,
  1473. goods_price: this.goods.goods_price,
  1474. goods_storage_alarm: this.goods.goods_storage_alarm,
  1475. goods_serial: this.goods.goods_serial,
  1476. goods_storage: this.goods.goods_storage,
  1477. goods_weight: this.goods.goods_weight,
  1478. vc_card: this.goods.vc_card,
  1479. vc_pan: this.goods.vc_pan,
  1480. vc_file: this.goods.vc_file
  1481. }
  1482. } else {
  1483. if (this.spec[spvalue_id_str].vc_file) {
  1484. this.vc_file[spvalue_id_str] = [{
  1485. name: 'vc_file',
  1486. extname: 'zip',
  1487. url: this.spec[spvalue_id_str].vc_file
  1488. }]
  1489. }
  1490. }
  1491. }
  1492. return arr[0]
  1493. }
  1494. },
  1495. goodsSpecAdd() {
  1496. if (!this.spec_add_value) {
  1497. uni.showToast({
  1498. icon: 'none',
  1499. title: '请输入规格值'
  1500. })
  1501. return
  1502. }
  1503. goodsSpecAdd(this.controller, this.spec_add_value, this.class_id, this.sp_id).then(res => {
  1504. this.sp_option[this.sp_id].push({
  1505. label: this.spec_add_value,
  1506. value: res.result.value_id
  1507. })
  1508. if (typeof(this.spec_json[this.sp_id]) === 'undefined') {
  1509. this.spec_json[this.sp_id] = {}
  1510. }
  1511. this.spec_json[this.sp_id][res.result.value_id] = {
  1512. spvalue_name: this.spec_add_value,
  1513. spvalue_id: res.result.value_id,
  1514. spvalue_color: null
  1515. }
  1516. if (this.sp_id == 1) {
  1517. this.spec_list[1].value.push(this.spec_json[this.sp_id][res.result.value_id])
  1518. }
  1519. this.hidePopup('showSpecAdd')
  1520. }).catch(error => {
  1521. uni.showToast({
  1522. icon: 'none',
  1523. title: error.message
  1524. })
  1525. })
  1526. },
  1527. nextStep() {
  1528. if (isNaN(this.goods.goods_price) || this.goods.goods_price <= 0) {
  1529. uni.showToast({
  1530. icon: 'none',
  1531. title: '请检查价格'
  1532. })
  1533. return
  1534. }
  1535. if (parseFloat(this.goods.goods_marketprice) < parseFloat(this.goods.goods_price) && parseFloat(this.goods
  1536. .goods_marketprice) > 0) {
  1537. uni.showToast({
  1538. icon: 'none',
  1539. title: '市场价不能小于价格'
  1540. })
  1541. return
  1542. }
  1543. if (isNaN(this.goods.goods_storage) || this.goods.goods_storage < 0) {
  1544. uni.showToast({
  1545. icon: 'none',
  1546. title: '请检查库存'
  1547. })
  1548. return
  1549. }
  1550. if (this.goods.goods_weight && (isNaN(this.goods.goods_weight) || this.goods.goods_weight < 0)) {
  1551. uni.showToast({
  1552. icon: 'none',
  1553. title: '请检查重量'
  1554. })
  1555. return
  1556. }
  1557. if (this.goods.goods_storage_alarm && (isNaN(this.goods.goods_storage_alarm) || this.goods
  1558. .goods_storage_alarm < 0)) {
  1559. uni.showToast({
  1560. icon: 'none',
  1561. title: '请检查库存预警值'
  1562. })
  1563. return
  1564. }
  1565. this.goods.goods_discount = parseInt(this.goods.goods_price / this.goods.goods_marketprice * 100)
  1566. var sp_val = {}
  1567. for (var i in this.sp_val) {
  1568. sp_val[i] = {}
  1569. for (var j in this.sp_val[i]) {
  1570. sp_val[i][this.sp_val[i][j]] = this.spec_json[i][this.sp_val[i][j]].spvalue_name
  1571. }
  1572. }
  1573. if (this.ifFixedFreight) {
  1574. this.goods.transport_id = 0
  1575. }
  1576. var spec = {}
  1577. if (this.specArray) {
  1578. for (i in this.specArray.spvalue_key) {
  1579. spec[this.specArray.spvalue_key[i]] = this.spec[this.specArray.spvalue_key[i]]
  1580. }
  1581. }
  1582. goodsSave(this.controller, this.class_id, this.commonid, this.goods, this.bodyList, this.sgcate_id, spec,
  1583. this.sp_name, sp_val, this.selectAttr, this.g_fccount, this.g_fcprefix).then(res => {
  1584. if (!this.commonid) {
  1585. uni.redirectTo({
  1586. url: '/pages/seller/goods/GoodsForm3' + '?' + urlencode({
  1587. commonid: res.result.commonid,
  1588. action: this.action
  1589. })
  1590. })
  1591. }
  1592. uni.showToast({
  1593. icon: 'none',
  1594. title: res.message
  1595. })
  1596. }).catch(error => {
  1597. uni.showToast({
  1598. icon: 'none',
  1599. title: error.message
  1600. })
  1601. })
  1602. },
  1603. openVideo(src) {
  1604. this.showVideo = src
  1605. this.showPopup('isVideo')
  1606. },
  1607. uploadVideo(event) {
  1608. let files = event.tempFiles[0]
  1609. if (typeof(files) === 'undefined') {
  1610. return
  1611. }
  1612. var formdata = {
  1613. filePath: files.path,
  1614. name: 'file',
  1615. id: 'file'
  1616. }
  1617. uni.showLoading({
  1618. title: '加载中'
  1619. })
  1620. uploadVideo(this.controller, formdata).then(res => {
  1621. this.goods.goodsvideo_name = res.result.path
  1622. this.goods.goodsvideo_url = res.result.url
  1623. this.$forceUpdate()
  1624. uni.hideLoading()
  1625. }).catch(function(error) {
  1626. uni.showToast({
  1627. icon: 'none',
  1628. title: error.message
  1629. })
  1630. uni.hideLoading()
  1631. })
  1632. },
  1633. openImage(src) {
  1634. this.showimage = src
  1635. this.showPopup('isshow')
  1636. },
  1637. dropImage() {
  1638. this.goods.goods_image = ''
  1639. },
  1640. useCrop(res) {
  1641. let type = this.cropType
  1642. var formdata = {
  1643. filePath: res.url,
  1644. name: 'file',
  1645. }
  1646. uni.showLoading({
  1647. title: '加载中'
  1648. })
  1649. uploadInfoFile(this.controller, formdata).then(res => {
  1650. if (type == 'goods_image') {
  1651. this.goods.goods_image = res.result.path
  1652. this.goods.goods_image_url = res.result.url
  1653. } else {
  1654. this.bodyItem.value = res.result.url
  1655. this.bodyItem.value_url = res.result.url
  1656. this.hidePopup('bodyEditVisible')
  1657. }
  1658. this.imageValue[type] = [{
  1659. name: 'file',
  1660. extname: 'jpg',
  1661. url: res.result.url
  1662. }]
  1663. this.cropperOption.imgUrl = ''
  1664. this.$forceUpdate()
  1665. uni.hideLoading()
  1666. }).catch((error) => {
  1667. uni.showToast({
  1668. icon: 'none',
  1669. title: error.message
  1670. })
  1671. uni.hideLoading()
  1672. this.cropperOption.imgUrl = ''
  1673. this.$forceUpdate()
  1674. })
  1675. },
  1676. cropReady() {
  1677. this.cropperOption.img = this.cropperOption.imgUrl
  1678. },
  1679. cropBack() {
  1680. this.cropperOption.imgUrl = ''
  1681. this.$forceUpdate()
  1682. },
  1683. uploadImage(index, event) {
  1684. let that = this
  1685. this.cropType = index
  1686. let file = event.tempFiles[0]
  1687. that.cropperOption.imgUrl = file.path
  1688. that.cropperOption.autoCropWidth = uni.getSystemInfoSync().windowWidth
  1689. that.cropperOption.autoCropHeight = uni.getSystemInfoSync().windowWidth
  1690. that.cropperOption.maxImgSize = uni.getSystemInfoSync().windowHeight - 40
  1691. that.$forceUpdate()
  1692. },
  1693. }
  1694. }
  1695. </script>
  1696. <style lang="scss">
  1697. .goods-form-2 {
  1698. input[readonly] {
  1699. color: #999
  1700. }
  1701. .mint-radiolist {
  1702. display: flex;
  1703. .mint-cell {
  1704. flex: 1;
  1705. .mint-radio-input:checked+.mint-radio-core {
  1706. background-color: #ff9900 !important;
  1707. border-color: #ff9900 !important;
  1708. }
  1709. &:after {
  1710. display: none
  1711. }
  1712. }
  1713. }
  1714. }
  1715. </style>
  1716. <style scoped lang="scss">
  1717. .file-uploader {
  1718. position: relative;
  1719. .file {
  1720. position: absolute;
  1721. top: 0;
  1722. right: 0;
  1723. left: 0;
  1724. bottom: 0;
  1725. opacity: 0
  1726. }
  1727. }
  1728. .file-wrapper {
  1729. display: inline-block;
  1730. padding: .5rem;
  1731. position: relative;
  1732. border: 1px solid #e1e1e1;
  1733. .file-name {
  1734. font-size: $fontSize
  1735. }
  1736. .file-btn {
  1737. font-size: $fontSize;
  1738. position: absolute;
  1739. top: 0;
  1740. right: 0
  1741. }
  1742. }
  1743. .card-wrapper {
  1744. padding: 1rem;
  1745. .card-notice {
  1746. font-size: $fontSize;
  1747. padding-bottom: 1rem;
  1748. }
  1749. .card-textarea {
  1750. width: 100%;
  1751. height: 10rem
  1752. }
  1753. }
  1754. .block-wrapper {
  1755. padding: 0 $pageSpace
  1756. }
  1757. .common-header {
  1758. .btn {
  1759. background: #000;
  1760. color: #fff;
  1761. box-shadow: 0px 2px 4px #d2d2d2;
  1762. }
  1763. }
  1764. .main-content {
  1765. background: #fff;
  1766. padding: 0 $pageSpace
  1767. }
  1768. .close-btn {
  1769. position: absolute;
  1770. top: .5rem;
  1771. right: .5rem;
  1772. z-index: 100
  1773. }
  1774. .container {
  1775. background: #fff;
  1776. .label {
  1777. padding: .5rem $pageSpace;
  1778. font-size: $subFontSize;
  1779. background: #eee;
  1780. }
  1781. .user-avatar-wrapper {
  1782. display: inline-block;
  1783. vertical-align: top;
  1784. margin-right: .5rem;
  1785. margin-bottom: .5rem
  1786. }
  1787. .user-avatar-wrapper .del-btn {
  1788. position: absolute;
  1789. bottom: .2rem;
  1790. right: .2rem
  1791. }
  1792. .btn-wrapper {
  1793. display: flex;
  1794. .btn {
  1795. flex: 1
  1796. }
  1797. }
  1798. .body-list {
  1799. .body-item {
  1800. padding: 1rem;
  1801. position: relative;
  1802. min-height: 2.2rem;
  1803. font-size: $fontSize;
  1804. .img {
  1805. max-width: 100%
  1806. }
  1807. .btn-list {
  1808. text-align: right;
  1809. background: rgba(0, 0, 0, .5);
  1810. position: absolute;
  1811. top: .5rem;
  1812. bottom: .5rem;
  1813. left: .5rem;
  1814. right: .5rem;
  1815. padding: .5rem;
  1816. box-sizing: border-box;
  1817. .i {
  1818. font-size: 1.2rem;
  1819. margin-left: .5rem;
  1820. color: #fff;
  1821. }
  1822. }
  1823. }
  1824. }
  1825. .middle-popup {
  1826. width: 80%
  1827. }
  1828. .brand-list {
  1829. .h2 {
  1830. line-height: 2rem;
  1831. font-size: $subFontSize;
  1832. padding-left: .5rem;
  1833. font-weight: 700;
  1834. }
  1835. .ul {
  1836. overflow: hidden;
  1837. border-top: 1px solid #f6f6f9
  1838. }
  1839. .li {
  1840. box-sizing: border-box;
  1841. text-align: center;
  1842. width: 25%;
  1843. padding-bottom: 20%;
  1844. float: left;
  1845. border-bottom: 1px solid #f6f6f9;
  1846. border-right: 1px solid #f6f6f9;
  1847. position: relative;
  1848. .p-img {
  1849. position: absolute;
  1850. top: .5rem;
  1851. bottom: .5rem;
  1852. right: .5rem;
  1853. left: .5rem;
  1854. background-size: contain;
  1855. background-position: center;
  1856. background-repeat: no-repeat;
  1857. }
  1858. }
  1859. .li:nth-child(4n) {
  1860. border-right: 0;
  1861. }
  1862. }
  1863. }
  1864. .toolbar {
  1865. height: 2rem;
  1866. display: flex;
  1867. flex-direction: row;
  1868. justify-content: space-between;
  1869. align-items: center;
  1870. background-color: #f0f2f5;
  1871. .toolbar-item {
  1872. font-size: $fontSize;
  1873. border: none;
  1874. border-radius: 0;
  1875. background-color: #f0f2f5;
  1876. }
  1877. .cancel-item {
  1878. margin-left: 0.5rem;
  1879. color: #4e545d;
  1880. }
  1881. .confirm-item {
  1882. margin-right: 0.5rem;
  1883. color: red;
  1884. }
  1885. .picker-header {
  1886. color: #4e545d;
  1887. line-height: 2rem;
  1888. font-size: $h2;
  1889. }
  1890. }
  1891. .popup-content {
  1892. padding: 0 40rpx;
  1893. height: 300rpx;
  1894. }
  1895. .popup-item-wrapper {
  1896. display: flex;
  1897. justify-content: center;
  1898. align-items: center;
  1899. }
  1900. .popup-item {
  1901. font-size: 30rpx;
  1902. line-height: 80rpx;
  1903. text-align: center;
  1904. overflow: hidden;
  1905. text-overflow: ellipsis;
  1906. white-space: nowrap;
  1907. }
  1908. </style>