replenishmentHomePage.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="补货首页"></u-navbar>
  5. <view class="machine-box">
  6. 机器编号:{{deviceId}}
  7. </view>
  8. <view class="top-wrap">
  9. <view class="tab-wrap">
  10. <view class="tab">
  11. <u-tabs :list="tabList" :activeStyle="{color: '#333',fontWeight: 'bold',fontSize:'36rpx'}"
  12. :inactiveStyle="{fontSize:'32rpx'}" :scrollable="false" :current="tabsIndex" @click="tabschange"
  13. lineColor="#2C6FF3">
  14. </u-tabs>
  15. </view>
  16. </view>
  17. <view class="search-container">
  18. <u-search animation placeholder="商品搜索" :clearabled="false" v-model="keyword" :showAction="false"
  19. @search="search"></u-search>
  20. <!-- <view class="scan-icon" @click="scan">
  21. <u-icon name="scan" size="22" color="#909399"></u-icon>
  22. </view> -->
  23. <view class="search-history flex flex-wrap flex-start" v-if="historyList.length>0">
  24. <view class="history-tips">最近搜索</view>
  25. <view class="history-item" v-for="(item,index) in historyList" :key="index"
  26. @click="searchFast(item)">
  27. {{item}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="btns flex justify-between">
  32. <view class="btn-left flex">
  33. <view class="icon-btn" style="margin-right: 12rpx;">
  34. <xbutton width="184rpx" round="14rpx" @click="addgoods"
  35. icon="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_add.png">
  36. 新增商品</xbutton>
  37. </view>
  38. <view class="icon-btn" style="margin-right: 12rpx;">
  39. <xbutton width="184rpx" round="14rpx" @click="addlist"
  40. icon="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_add.png">
  41. 商品清单</xbutton>
  42. </view>
  43. <!-- <view class="add-btn">
  44. <xbutton width="184rpx" round="14rpx"
  45. icon="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_full.png">
  46. 一键满货</xbutton>
  47. </view> -->
  48. </view>
  49. <view class="btn-right">
  50. <xbutton width="144rpx" round="14rpx" @click="keep">提交</xbutton>
  51. </view>
  52. </view>
  53. </view>
  54. <scroll-view class="scrollview" :scroll-with-animation="true" scroll-y :style="{'height':fullHeight}"
  55. lower-threshold="100">
  56. <view v-if="goodsList&&goodsList.length>0" class="scroll-content">
  57. <view class="goods-box" v-for="(item,index) in goodsList" :key="item.id">
  58. <view class="flex flex-sub align-center">
  59. <view class="image">
  60. <u--image radius='14rpx' width="120rpx" height="120rpx"
  61. :src="item.cover?item.cover:'https://static.xynetweb.com/sysFile/defaultgoods.png'"
  62. mode="aspectFit" :lazy-load="true">
  63. </u--image>
  64. </view>
  65. <view class="flex flex-sub flex-direction justify-around goods-content">
  66. <view class="goods-name-price flex justify-between align-start">
  67. <view class="goods-name">
  68. {{item.name}}
  69. </view>
  70. <view class="goods-price" v-if="item.newPrice==null">
  71. ¥{{$xy.delMoney(item.price)}}
  72. </view>
  73. <view class="goods-price flex" v-else>
  74. <view style="color: #666;text-decoration: line-through;">
  75. ¥{{$xy.delMoney(item.price)}}
  76. </view>
  77. <view>
  78. ¥{{$xy.delMoney(item.newPrice)}}
  79. </view>
  80. </view>
  81. </view>
  82. <view class="goods-stock flex">
  83. <view>商品ID:{{item.id}}</view>
  84. </view>
  85. <view class="goods-stock flex">
  86. <view>商品SKUID:{{item.skuId}}</view>
  87. </view>
  88. <view class="goods-stock flex">
  89. <view>容量:{{item.capacity}}</view>
  90. <view style="margin-left: 24rpx;" v-if="item.newCapacity">
  91. 新容量:{{item.newCapacity}}</view>
  92. </view>
  93. <view class="goods-stock flex">
  94. <view>库存:{{item.stock}}</view>
  95. <view style="margin-left: 24rpx;" v-if="item.newStock!=0">
  96. 新库存:{{Number(item.stock)+Number(item.newStock)}}</view>
  97. </view>
  98. <view class="btn-input flex align-center flex-start" v-if="deviceInfo.deviceType!=5">
  99. <view class="btn-input-left">补货:</view>
  100. <view class="btn-input-right flex align-center">
  101. <image
  102. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_sub.png"
  103. mode="widthFix" @click="sub(item)"></image>
  104. <input type="doit" v-model="item.newStock">
  105. <image
  106. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_sup.png"
  107. mode="widthFix" @click="sup(item)"></image>
  108. </view>
  109. </view>
  110. <view style="height:20rpx;" v-if="deviceInfo.deviceType==5"></view>
  111. <image class="edit-goods" @click.stop="editGoods(item,index)"
  112. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_edit.png"
  113. mode="widthFix"></image>
  114. </view>
  115. </view>
  116. <view class="edit-box" v-if="item.show">
  117. <view @click.stop="changePrice(item)">改价</view>
  118. <view @click.stop="changeCapacity(item)">容量</view>
  119. <view @click.stop="del(item)">删除</view>
  120. <!-- <view>满货</view> -->
  121. </view>
  122. <view class="bg" v-if="editIndex!=null" @click.stop="editHidden"></view>
  123. </view>
  124. </view>
  125. <view v-else class='empty'>
  126. <u-empty mode="data" text="数据为空"></u-empty>
  127. </view>
  128. <!-- <u-loadmore v-if="isEmpty===false" :status="loadmoreStatus" /> -->
  129. </scroll-view>
  130. <view class="flex align-center justify-around bottom-btn">
  131. <view class="bottom-view" @tap="gethomePage">
  132. <image class="bottom-image"
  133. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_upd.png"
  134. mode="widthFix"></image>
  135. <view class="bottom-text">刷新</view>
  136. </view>
  137. <view class="bottom-view" @tap="openCabinet">
  138. <image class="bottom-image"
  139. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_open.png"
  140. mode="widthFix"></image>
  141. <view class="bottom-text">一键开柜</view>
  142. </view>
  143. <view class="bottom-view" @tap="cper">
  144. <image class="bottom-image"
  145. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/replenish/rep_home_rec.png"
  146. mode="widthFix">
  147. </image>
  148. <view class="bottom-text">补货记录</view>
  149. </view>
  150. </view>
  151. <xpopup :show="editPriceShow" @close="editPriceClose" @confirm="priceSet" :showBtn="true" :title="editTitle">
  152. <view class="pop-content">
  153. <u--input placeholder="请输入内容" type="digit" border="surround" v-model="editPrice" v-if="editTitle=='修改价格'"></u--input>
  154. <u--input placeholder="请输入内容" type="digit" border="surround" v-model="editCapacity" v-else></u--input>
  155. </view>
  156. </xpopup>
  157. <xpopup :show="backShow" @close="backClose" :safeAreaInsetBottom="false" :showBtn="false" @open="backOpen"
  158. mode="center">
  159. <view class="back-pop-content">
  160. <block v-for="(item,index) in changeList" :key="item.goodsName">
  161. <view class="back-price flex align-center" v-if="item.type=='price'">
  162. <view>{{item.goodsName}}</view>
  163. <view>价格:</view>
  164. <view>{{$xy.delMoney(item.oldPrice)}}</view>
  165. <view>更改为</view>
  166. <view>{{$xy.delMoney(item.newPrice)}}</view>
  167. </view>
  168. <view class="back-stock flex align-center" v-if="item.type=='stock'">
  169. <view>{{item.goodsName}}</view>
  170. <view>库存:</view>
  171. <view>{{item.oldStock}}</view>
  172. <view>更改为</view>
  173. <view>{{item.newStock}}</view>
  174. </view>
  175. <view class="back-capacity flex align-center" v-if="item.type=='capacity'">
  176. <view>{{item.goodsName}}</view>
  177. <view>容量:</view>
  178. <view>{{item.oldCapacity}}</view>
  179. <view>更改为</view>
  180. <view>{{item.newCapacity}}</view>
  181. </view>
  182. </block>
  183. </view>
  184. </xpopup>
  185. </view>
  186. </template>
  187. <script>
  188. import {
  189. supplyPage,
  190. delGoods,
  191. save,
  192. saveByOpenDoor,
  193. check,
  194. create
  195. } from "@/api/replenishment/replenishment.js"
  196. import {
  197. saveKeyWord
  198. } from '@/utils/common.js'
  199. export default {
  200. data() {
  201. return {
  202. goodsList: [],
  203. page: 1, //当前分页
  204. size: 10, //分页数据条数
  205. tabsIndex: 0,
  206. addGoodsShow: false,
  207. active: '',
  208. deviceId: null,
  209. deviceName: null,
  210. name: '', //商品名称/条形码
  211. workNo: '',
  212. fullHeight: 0,
  213. historyList: [],
  214. keyword: '',
  215. tabList: [{
  216. name: '全部'
  217. },
  218. {
  219. name: '缺货'
  220. },
  221. {
  222. name: '售罄'
  223. }
  224. ],
  225. editIndex: null,
  226. editPriceShow: false,
  227. editPrice: null,
  228. editGoodsIndex: null,
  229. changeList: [], //提交反显信息
  230. backShow: false,
  231. deviceInfo: {},
  232. editTitle:'修改价格',
  233. editCapacity:null
  234. }
  235. },
  236. onLoad(o) {
  237. let _this = this;
  238. const query = uni.createSelectorQuery().in(this);
  239. query.select(".scrollview").boundingClientRect((data) => {
  240. uni.getSystemInfo({
  241. success(res) {
  242. // 针对iPhone X等机型底部安全距离做适配
  243. const model = res.model;
  244. const modelInclude = [
  245. "iPhone X",
  246. 'iPhone XR',
  247. "iPhone XS",
  248. "iPhone XS MAX",
  249. "iPhone 12/13 mini",
  250. "iPhone 12/13 (Pro)",
  251. "iPhone 12/13 Pro Max",
  252. "iPhone 14 Pro Max"
  253. ];
  254. let safeDistance = modelInclude.includes(model)
  255. //动态设置商品区域高度
  256. if (safeDistance) {
  257. _this.fullHeight = res.windowHeight - data.top - 50 - 34 + 'px';
  258. } else {
  259. _this.fullHeight =res.windowHeight - data.top - 50 + 'px';
  260. }
  261. },
  262. });
  263. }).exec();
  264. if (uni.getStorageSync('goods')) {
  265. this.historyList = JSON.parse(uni.getStorageSync('goods'))
  266. }
  267. this.deviceId = o.id;
  268. this.deviceName = o.deviceName;
  269. },
  270. onShow() {
  271. this.gethomePage()
  272. },
  273. methods: {
  274. search(val) {
  275. if (val) {
  276. this.historyList = saveKeyWord('goods', this.keyword)
  277. }
  278. this.gethomePage()
  279. },
  280. searchFast(e) {
  281. this.keyword = e
  282. this.search()
  283. },
  284. scanQRCode() {
  285. uni.scanCode({
  286. needResult: 1, //默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  287. scanType: ["qrCode", "barCode"], //// 可以指定扫二维码还是一维码,默认二者都有
  288. success: (res) => {
  289. var result = res.resultStr; //当needResult 为 1 时,扫码返回的结果 获取扫码信息
  290. this.name = result
  291. this.gethomePage()
  292. },
  293. });
  294. },
  295. tabschange(e) {
  296. this.tabsIndex = e.index
  297. this.gethomePage()
  298. },
  299. addgoods() {
  300. this.$tab.navigateTo('/pages/equipment/addCom?id=' + this.deviceId)
  301. },
  302. addlist() {
  303. this.$tab.navigateTo('/pages/commodity/commoditylist?id=' + this.deviceId)
  304. },
  305. //补货记录
  306. cper() {
  307. this.$tab.navigateTo('replenishmentRecord?id=' + this.deviceId)
  308. },
  309. //一键满货
  310. allFull() {
  311. uni.showModal({
  312. title: '提示',
  313. content: '是否确认一键满货',
  314. success: res => {
  315. if (res.confirm) {
  316. for (var i = 0; i < this.goodsList.length; i++) {
  317. this.goodsList[i].stock = this.goodsList[i].capacity
  318. this.goodsList[i].newkcrl = true
  319. }
  320. } else if (res.cancel) {
  321. console.log('用户点击取消');
  322. }
  323. }
  324. });
  325. },
  326. // 一键开柜
  327. openCabinet() {
  328. uni.showModal({
  329. title: '提示',
  330. content: '是否确认一键开柜',
  331. success: res => {
  332. if (res.confirm) {
  333. saveByOpenDoor({
  334. "deviceId": this.deviceId
  335. })
  336. .then(res => {
  337. this.workNo = res.data
  338. this.checkWx()
  339. })
  340. } else if (res.cancel) {
  341. console.log('用户点击取消');
  342. }
  343. }
  344. });
  345. },
  346. //效验活动
  347. checkWx() {
  348. check({
  349. "deviceId": this.deviceId,
  350. "deviceType": 1,
  351. "door": 0,
  352. "isRestock": true
  353. })
  354. .then(res => {
  355. this.createOrder(res.data)
  356. })
  357. },
  358. //创建活动
  359. createOrder(e) {
  360. create({
  361. "deviceId": this.deviceId,
  362. "deviceType": 1,
  363. "door": 0,
  364. "payQueryOrderId": "",
  365. "payType": '',
  366. "sysType": 1,
  367. "workNo": this.workNo,
  368. "workType": 2
  369. }).then(res => {
  370. uni.showLoading({
  371. title: '开门中...'
  372. });
  373. setTimeout(function() {
  374. uni.showToast({
  375. title: '开门成功',
  376. duration: 2000
  377. });
  378. uni.hideLoading();
  379. }, 2000);
  380. }).catch(err => {
  381. uni.showToast({
  382. title: JSON.stringify(res),
  383. duration: 10000
  384. });
  385. })
  386. },
  387. // 满货
  388. fullCargo(val) {
  389. uni.showModal({
  390. title: '提示',
  391. content: '是否确认满货',
  392. success: res => {
  393. if (res.confirm) {
  394. for (var i = 0; i < this.goodsList.length; i++) {
  395. if (this.goodsList[i].goodsId === val.goodsId) {
  396. this.goodsList[i].stock = val.capacity
  397. this.goodsList[i].newkcrl = true
  398. }
  399. }
  400. } else if (res.cancel) {
  401. console.log('用户点击取消');
  402. }
  403. }
  404. });
  405. },
  406. //保存
  407. keep() {
  408. var goods = [] //收集提交改动商品参数
  409. var changeList = [] //收集提交改动商品清单,做提醒结果用
  410. this.goodsList.forEach(item => {
  411. if (item.newPrice != null || item.newStock != 0||item.newCapacity!=null) {
  412. goods.push({
  413. "deviceGoodsId": item.id,
  414. "oldStock": item.stock,
  415. "newStock": Number(item.newStock) + Number(item.stock),
  416. "oldPrice": item.price,
  417. "newPrice": item.newPrice,
  418. "oldCapacity": item.oldCapacity,
  419. "newCapacity": item.newCapacity,
  420. "oldWarning": item.warning,
  421. "newWarning": item.warning,
  422. "goodsId": item.goodsId,
  423. "goodsName": item.name
  424. })
  425. if (item.newPrice != null) { //改价商品
  426. changeList.push({
  427. goodsName: item.name,
  428. type: 'price',
  429. oldPrice: item.price,
  430. newPrice: item.newPrice
  431. })
  432. }
  433. if (item.newStock != 0) { //改库存商品
  434. changeList.push({
  435. goodsName: item.name,
  436. type: 'stock',
  437. oldStock: item.stock,
  438. newStock: Number(item.newStock) + Number(item.stock)
  439. })
  440. }
  441. if (item.newCapacity != null) { //改容量商品
  442. changeList.push({
  443. goodsName: item.name,
  444. type: 'capacity',
  445. oldCapacity: item.capacity,
  446. newCapacity: item.newCapacity
  447. })
  448. }
  449. }
  450. })
  451. this.changeList = JSON.parse(JSON.stringify(changeList))
  452. if (goods.length == 0) {
  453. this.$modal.msg('您未对商品做任何改动~')
  454. return
  455. }
  456. uni.showModal({
  457. title: '提示',
  458. content: '是否确认保存',
  459. success: res => {
  460. if (res.confirm) {
  461. save({
  462. id: this.workNo ? this.workNo : '',
  463. deviceId: this.deviceId,
  464. goods: goods
  465. }).then(res => {
  466. this.showChanged()
  467. this.clearStorage()
  468. this.gethomePage()
  469. }).catch(err => {
  470. uni.showModal({
  471. title: '提示',
  472. content: err,
  473. success: res => {
  474. if (res.confirm) {
  475. console.log('确定')
  476. }
  477. }
  478. })
  479. })
  480. } else if (res.cancel) {
  481. console.log('用户点击取消');
  482. }
  483. }
  484. });
  485. },
  486. //保存成功,显示改动结果
  487. showChanged() {
  488. this.backOpen()
  489. },
  490. // 保存成功,清空缓存
  491. clearStorage() {
  492. uni.setStorageSync(`replenish:${this.deviceId}`, '')
  493. },
  494. backClose() {
  495. this.backShow = false
  496. },
  497. backOpen() {
  498. this.backShow = true
  499. },
  500. //删除
  501. del(val) {
  502. this.editHidden()
  503. let _this = this
  504. uni.showModal({
  505. title: '提示',
  506. content: '是否确认删除',
  507. success: function(res) {
  508. if (res.confirm) {
  509. delGoods({
  510. "deviceId": _this.deviceId,
  511. "goodsIds": [val.goodsId]
  512. }).then(res => {
  513. _this.gethomePage()
  514. })
  515. } else if (res.cancel) {
  516. console.log('用户点击取消');
  517. }
  518. }
  519. });
  520. },
  521. gethomePage() {
  522. supplyPage({
  523. page: {
  524. size: -1
  525. },
  526. search: this.keyword,
  527. deviceId: this.deviceId,
  528. type: this.tabsIndex + 1, //类型
  529. isRefresh: true
  530. }).then(res => {
  531. let deviceInfo = res.data.deviceInfo
  532. let data = res.data.page.records
  533. let sto = uni.getStorageSync(`replenish:${this.deviceId}`)
  534. for (var i = 0; i < data.length; i++) {
  535. data[i].oldCapacity = data[i].capacity
  536. data[i].show = false
  537. data[i].newPrice = null
  538. data[i].newStock = 0
  539. // 暂存补货数据
  540. if (sto && sto != '') {
  541. let replenishList = JSON.parse(sto);
  542. replenishList.forEach(j => {
  543. if (data[i].goodsId === j.goodsId) {
  544. data[i].newPrice = j.newPrice
  545. data[i].newStock = j.newStock
  546. }
  547. })
  548. }
  549. }
  550. this.deviceInfo = deviceInfo
  551. this.goodsList = data;
  552. })
  553. },
  554. editGoods(item, index) {
  555. item.show = true
  556. this.editIndex = index
  557. this.editGoodsIndex = index
  558. },
  559. editHidden() {
  560. if (this.editIndex != null) {
  561. this.goodsList[this.editIndex].show = false
  562. this.editIndex = null
  563. }
  564. },
  565. sub(item) {
  566. if (Number(item.stock) + Number(item.newStock) == 0) {
  567. this.$modal.msg('这个商品没库存啦~')
  568. return
  569. }
  570. item.newStock--
  571. this.goodsChange()
  572. },
  573. sup(item) {
  574. item.newStock++
  575. this.goodsChange()
  576. },
  577. // 库存调整,设置缓存
  578. goodsChange(item) {
  579. //设置缓存
  580. let newListSto = []
  581. this.goodsList.forEach(i => {
  582. if (i.newPrice != null || i.newStock != 0) {
  583. let obj = {
  584. goodsId: i.goodsId,
  585. newPrice: i.newPrice,
  586. newStock: i.newStock
  587. }
  588. newListSto.push(obj)
  589. }
  590. })
  591. uni.setStorageSync(`replenish:${this.deviceId}`, JSON.stringify(newListSto))
  592. },
  593. changePrice(item) {
  594. this.editTitle='修改价格'
  595. this.editPriceShow = true;
  596. this.editHidden()
  597. },
  598. changeCapacity(){
  599. this.editTitle='修改容量'
  600. this.editPriceShow = true;
  601. this.editHidden()
  602. },
  603. editPriceClose() {
  604. this.editPriceShow = false;
  605. },
  606. priceSet() {
  607. if(this.editTitle=='修改价格'){
  608. if (this.editPrice == null) {
  609. this.$modal.msg('商品价格不能为空!')
  610. return
  611. }
  612. let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
  613. if (!reg.test(this.editPrice)) {
  614. uni.showToast({
  615. icon: 'none',
  616. title: '价格最多保留两位小数!'
  617. })
  618. return;
  619. }
  620. this.editPriceClose()
  621. this.goodsList[this.editGoodsIndex].newPrice = this.editPrice * 100
  622. this.goodsChange() //设置缓存
  623. this.editPrice = null
  624. this.editGoodsIndex = null
  625. }else{ //修改容量
  626. if (this.editCapacity == null) {
  627. this.$modal.msg('商品容量不能为空!')
  628. return
  629. }
  630. let reg = /^([0-9]*)$/
  631. if (!reg.test(this.editCapacity)) {
  632. uni.showToast({
  633. icon: 'none',
  634. title: '容量必须为整数!'
  635. })
  636. return;
  637. }
  638. this.editPriceClose()
  639. this.goodsList[this.editGoodsIndex].newCapacity = this.editCapacity
  640. this.goodsChange() //设置缓存
  641. this.newCapacity = null
  642. this.editGoodsIndex = null
  643. }
  644. }
  645. }
  646. }
  647. </script>
  648. <style>
  649. page {
  650. background-color: #eee;
  651. }
  652. </style>
  653. <style scoped lang="scss">
  654. .container {
  655. height: 100vh;
  656. background-color: #F4F4F4;
  657. position: static;
  658. .machine-box {
  659. width: 750rpx;
  660. height: 74rpx;
  661. font-size: 32rpx;
  662. line-height: 58rpx;
  663. text-align: center;
  664. background: #2C6FF3;
  665. color: #fff;
  666. border-radius: 0px 0px 50rpx 50rpx;
  667. }
  668. .top-wrap {
  669. background: linear-gradient(0deg, #D7D7D7, #FFFFFF);
  670. }
  671. .tab-wrap {
  672. background-color: #fff;
  673. padding-left: 30rpx;
  674. .tab {
  675. width: 60%;
  676. }
  677. }
  678. .search-container {
  679. padding: 26rpx 13rpx 26rpx;
  680. background-color: #fff;
  681. position: relative;
  682. .scan-icon {
  683. position: absolute;
  684. right: 36rpx;
  685. top: 38rpx;
  686. z-index: 2;
  687. }
  688. .search-history {
  689. .history-tips {
  690. font-size: 24rpx;
  691. color: #333333;
  692. line-height: 40rpx;
  693. margin-right: 10rpx;
  694. margin-top: 24rpx;
  695. }
  696. .history-item {
  697. margin-right: 10rpx;
  698. padding: 0 13rpx;
  699. background: #F6F8FB;
  700. color: #333;
  701. font-size: 24rpx;
  702. line-height: 40rpx;
  703. border-radius: 40rpx;
  704. margin-top: 24rpx;
  705. }
  706. }
  707. }
  708. .btns {
  709. background-color: #fff;
  710. padding: 20rpx 13rpx 20rpx;
  711. }
  712. .empty {
  713. margin-top: 120rpx
  714. }
  715. .active {
  716. background-color: #2C6FF3;
  717. color: #fff;
  718. }
  719. .marleft {
  720. margin-left: 10rpx;
  721. }
  722. .martop {
  723. margin-top: 20rpx;
  724. }
  725. .scrollview {
  726. padding-top: 10rpx;
  727. }
  728. .goods-box {
  729. width: 724rpx;
  730. margin-left: 13rpx;
  731. background-color: #fff;
  732. box-shadow: 0px 0px 10px 0px rgba(174, 201, 255, 0.2);
  733. border-radius: 14rpx;
  734. padding: 28rpx 12rpx 22rpx;
  735. position: relative;
  736. .edit-box {
  737. width: 180rpx;
  738. background-color: #fff;
  739. font-size: 30rpx;
  740. text-align: center;
  741. line-height: 60rpx;
  742. padding: 10rpx 0;
  743. box-shadow: 0px 0px 10px 0px rgba(174, 201, 255, 0.2);
  744. position: absolute;
  745. right: 20rpx;
  746. bottom: -120rpx;
  747. z-index: 99999;
  748. }
  749. &+.goods-box {
  750. margin-top: 10rpx;
  751. }
  752. .image {
  753. margin-right: 35rpx;
  754. height: 120rpx;
  755. width: 120rpx;
  756. }
  757. .goods-content {
  758. position: relative;
  759. .goods-name-price {
  760. .goods-name {
  761. font-size: 28rpx;
  762. font-weight: 800;
  763. color: #333333;
  764. line-height: 34rpx;
  765. }
  766. .goods-price {
  767. font-size: 32rpx;
  768. line-height: 32rpx;
  769. font-weight: 800;
  770. color: #FF0000;
  771. margin-right: 10rpx;
  772. }
  773. }
  774. .goods-stock {
  775. font-size: 26rpx;
  776. font-weight: 500;
  777. color: #555555;
  778. line-height: 26rpx;
  779. margin-top: 30rpx;
  780. }
  781. .btn-input {
  782. margin-top: 18rpx;
  783. .btn-input-left {
  784. font-size: 26rpx;
  785. }
  786. .btn-input-right {
  787. justify-content: flex-end;
  788. margin-left: 50rpx;
  789. >image {
  790. width: 56rpx;
  791. height: 56rpx;
  792. }
  793. >input {
  794. width: 100rpx;
  795. height: 56rpx;
  796. line-height: 56rpx;
  797. border: 2rpx solid #2C6FF3;
  798. border-radius: 10rpx;
  799. text-align: center;
  800. margin: 0 50rpx;
  801. }
  802. }
  803. }
  804. .edit-goods {
  805. width: 56rpx;
  806. height: 56rpx;
  807. position: absolute;
  808. right: 10rpx;
  809. bottom: 0;
  810. }
  811. }
  812. }
  813. .pop-content {
  814. padding: 24rpx;
  815. }
  816. .bottom-btn {
  817. width: 100%;
  818. position: fixed;
  819. bottom: 0;
  820. right: 0;
  821. left: 0;
  822. background-color: #fff;
  823. height: calc(98rpx + env(safe-area-inset-bottom) / 2);
  824. padding-bottom: calc(env(safe-area-inset-bottom) / 2);
  825. box-shadow: 0px -2px 10px 0px rgba(174, 201, 255, 0.2);
  826. z-index: 999;
  827. }
  828. .scroll-content {
  829. padding-bottom: calc(160rpx + env(safe-area-inset-bottom) / 2);
  830. }
  831. .bottom-view {
  832. display: flex;
  833. flex-direction: column;
  834. flex: 1;
  835. text-align: center;
  836. align-items: center;
  837. }
  838. .bottom-image {
  839. height: 48rpx;
  840. width: 48rpx;
  841. }
  842. .bottom-text {
  843. font-size: 22rpx;
  844. line-height: 22rpx;
  845. margin-top: 8rpx;
  846. }
  847. .save {
  848. position: fixed;
  849. right: 15rpx;
  850. bottom: 120rpx;
  851. width: 140rpx;
  852. height: 140rpx;
  853. border-radius: 50%;
  854. background-color: #f6d232;
  855. image {
  856. width: 80rpx;
  857. }
  858. }
  859. .bg {
  860. position: fixed;
  861. width: 100%;
  862. height: 100vh;
  863. z-index: 99998;
  864. left: 0;
  865. top: 0;
  866. }
  867. .back-pop-content {
  868. width: 700rpx;
  869. padding: 24rpx;
  870. line-height: 50rpx;
  871. >view {
  872. font-size: 30rpx;
  873. >view {
  874. display: inline-block;
  875. }
  876. >view:nth-child(1) {
  877. width: 270rpx;
  878. white-space: nowrap;
  879. overflow: hidden;
  880. text-overflow: ellipsis;
  881. }
  882. >view:nth-child(2) {
  883. margin-left: 24rpx;
  884. }
  885. >view:nth-child(3) {
  886. color: #38fb58;
  887. margin-left: 24rpx;
  888. margin-right: 24rpx;
  889. width: 50rpx;
  890. }
  891. >view:nth-child(5) {
  892. color: #ef9840;
  893. margin-left: 24rpx;
  894. width: 50rpx;
  895. }
  896. }
  897. .back-price {
  898. >view:nth-child(2) {
  899. color: #2C6FF3;
  900. }
  901. }
  902. .back-stock {
  903. >view:nth-child(2) {
  904. color: #ff67bd;
  905. }
  906. }
  907. .back-capacity{
  908. >view:nth-child(2) {
  909. color: #ff5500;
  910. }
  911. }
  912. }
  913. }
  914. </style>