simple.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <view class="app-content">
  3. <view class="ex-page">
  4. <view class="input-wrap">
  5. <view class="search-bar">
  6. <app-search-module v-model="py" placeholder="输拼音首字母也可以搜" @input="searchFn"/>
  7. </view>
  8. </view>
  9. <scroll-view scroll-y scroll-with-animation class="main-view">
  10. <view class="space-view ex-table">
  11. <t-table :headerBackgroundColor="'#F0F2F6'">
  12. <t-tr header>
  13. <t-th><view style="width:230upx;text-align:left;">名称</view></t-th>
  14. <t-th> </t-th>
  15. <t-th> </t-th>
  16. <t-th> </t-th>
  17. <t-th> </t-th>
  18. </t-tr>
  19. <block v-if="!$util.isEmpty(list.data)">
  20. <block v-for="(productItem, productIndex) in list.data" :key="productIndex">
  21. <t-tr>
  22. <t-td>
  23. <view style="width:230upx;text-align:left;color:black;font-size:28upx;
  24. overflow: hidden; white-space: nowrap; text-overflow: ellipsis;font-weight:bold;"
  25. @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
  26. {{productItem.name}}
  27. </view>
  28. </t-td>
  29. <t-td>
  30. <view style="color:#333333;font-size:29upx;" @click.stop="doPrintLabel(productItem,1)">打价码</view>
  31. </t-td>
  32. <t-td>
  33. <view style="color:#333333;font-size:29upx;" @click.stop="doPrintLabel(productItem,0)">打标签</view>
  34. </t-td>
  35. <t-td>
  36. <view style="color:#333333;font-size:29upx;" @click="goToStockDetail(productItem)">
  37. 库明细
  38. </view>
  39. </t-td>
  40. <t-td>
  41. <view style="color:#333333;font-size:29upx;" @click="moreAction(productItem)">
  42. 更多
  43. </view>
  44. </t-td>
  45. </t-tr>
  46. </block>
  47. </block>
  48. </t-table>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. <uni-popup ref="rightShowMore" background-color="#fff" type="center" :animation="true" class="class-popup-style">
  53. <view style="display:flex;width:100vw;padding:20upx 20upx 40upx 20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  54. <view style="width:100vw;"><button @click="costChange()">成本变动记录</button></view>
  55. <view style="width:100vw;margin-top:8upx;"><button @click="priceChange()">价格变动记录</button></view>
  56. <view style="width:100vw;margin-top:8upx;"><button @click="varietyManage()">多颜色</button></view>
  57. <view style="width:100vw;margin-top:8upx;"><button @click="preSell()">预售</button></view>
  58. <view style="width:100vw;margin-top:8upx;"><button @click="orderRecord()">下单记录</button></view>
  59. <view style="width:100vw;margin-top:8upx;"><button @click="copyCreate()">复制新建</button></view>
  60. <view style="width:100vw;margin-top:8upx;"><button @click="sendStock()">分配库存</button></view>
  61. <view style="width:100vw;margin-top:8upx;"><button @click="delItem()">删除</button></view>
  62. <view style="width:100vw;margin-top:30upx;"><button @click="closeRightShow()">取消</button></view>
  63. </view>
  64. </uni-popup>
  65. <modal-module :show="printLabelShow" @click="dialogInputConfirm" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
  66. <template v-slot:content>
  67. <div class="app-modal-input-wrap">
  68. <div class="inp-list-line">
  69. <div class="line-input">
  70. <input type="number" ref="input" style="width:61.8%;text-align:center;" @blur="blur" :focus="printFocus" v-model="printNum" :adjust-position="false" class="inp-input" />
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. </modal-module>
  76. </view>
  77. </template>
  78. <script>
  79. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  80. import SelectList from "@/components/plugin/selectList";
  81. import { getProductDataApi,print,cancelDiscountPrice,cancelPreSell,delStatusUpdate } from "@/api/product";
  82. import { getSimleList } from "@/api/item";
  83. import { allOut } from "@/api/stock-out"
  84. import { list } from "@/mixins";
  85. import ShopSelect from "@/components/module/shopSelect";
  86. import DateSelect from "@/components/module/dateSelect";
  87. import {mapActions, mapGetters} from "vuex";
  88. import AppSearchModule from "@/components/module/app-search";
  89. import ModalModule from "@/components/plugin/modal"
  90. import { getWeixinId } from "@/api/invite";
  91. export default {
  92. components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule,ModalModule},
  93. mixins: [list],
  94. computed: {
  95. ...mapGetters(["getDictionariesInfo","getLoginInfo","getMyShopInfo"])
  96. },
  97. data() {
  98. return {
  99. py:'',
  100. currentInfo:{},
  101. printLabelShow:false,
  102. getAppIdList:{},
  103. printItemId:0,
  104. printType:0,
  105. printNum:'',
  106. printFocus:false,
  107. warning:0,
  108. posterUrl:'',
  109. breakNum:'',
  110. breakFocus:false,
  111. breakShow:false
  112. };
  113. },
  114. onLoad() {
  115. this.getSimpleData()
  116. let that = this
  117. getWeixinId().then(res => {
  118. that.getAppIdList = res.data
  119. })
  120. },
  121. onPullDownRefresh() {
  122. this.resetList();
  123. this.getSimpleData()
  124. uni.stopPullDownRefresh()
  125. },
  126. onReachBottom() {
  127. if (!this.list.finished) {
  128. this.getSimpleData().then((res) => {
  129. uni.stopPullDownRefresh()
  130. })
  131. } else {
  132. uni.stopPullDownRefresh()
  133. }
  134. },
  135. methods: {
  136. goToStockDetail(item){
  137. this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+item.id+'&name='+item.name})
  138. },
  139. moreAction(item){
  140. this.currentInfo = item
  141. this.$refs.rightShowMore.open('top')
  142. },
  143. delItem(){
  144. let that = this
  145. that.$util.confirmModal({content:'确认删除?'},() => {
  146. delStatusUpdate({id:that.currentInfo.id,delStatus:1}).then(res=>{
  147. if(res.code == 1){
  148. that.closeRightShow()
  149. that.$msg('删除成功')
  150. }
  151. })
  152. })
  153. },
  154. sendStock(){
  155. this.pageTo({url: '/admin/item/sendStock?id='+this.currentInfo.id+'&price='+this.currentInfo.price+'&stock='+this.currentInfo.stock+'&name='+this.currentInfo.name})
  156. },
  157. downloadImg(){
  158. let that = this
  159. uni.downloadFile({
  160. url: this.posterUrl,
  161. success: (res) => {
  162. if (res.statusCode === 200) {
  163. uni.saveImageToPhotosAlbum({
  164. filePath: res.tempFilePath,
  165. success: function (data) {
  166. that.$refs.posterShow.close()
  167. uni.showToast({title:'保存成功'})
  168. }
  169. });
  170. }
  171. }
  172. });
  173. },
  174. changeClass(index){
  175. this.$refs.selectFlowerNumRef.close()
  176. this.swichClass(index)
  177. },
  178. selectFlowerNumFn(){
  179. this.$refs.selectFlowerNumRef.open('top')
  180. },
  181. blur() {
  182. this.printFocus = false
  183. },
  184. doPrintLabel(item,type){
  185. this.printItemId = item.id
  186. this.printType = type
  187. this.printLabelShow = true
  188. this.printNum = null
  189. setTimeout(x => {
  190. this.$nextTick(() => this.setFocus())
  191. }, 200)
  192. },
  193. setFocus() {
  194. this.printFocus = true
  195. },
  196. dialogInputConfirm(val) {
  197. let that = this
  198. if (val.index == 0) {
  199. that.printLabelShow = false
  200. that.printFocus = false
  201. return
  202. }
  203. let currentNum = this.printNum
  204. let itemId = this.printItemId
  205. if (currentNum == null) {
  206. that.$msg('请填写数量')
  207. that.printFocus = true
  208. return
  209. }
  210. if (currentNum <= 0) {
  211. that.$msg('数量不能小于1')
  212. that.printFocus = true
  213. return
  214. }
  215. if (itemId == 0) {
  216. that.$msg('打印的花材id出错')
  217. that.printLabelShow = false
  218. that.printFocus = false
  219. return
  220. }
  221. print({id:itemId,num:currentNum,type:this.printType}).then(res=>{
  222. if(res.code == 1){
  223. that.printLabelShow = false
  224. that.printFocus = false
  225. uni.showToast({ title: '操作成功', duration: 1500 })
  226. } else if(res.code == 0){
  227. that.printLabelShow = false
  228. that.printFocus = false
  229. that.$msg(res.msg)
  230. }
  231. })
  232. },
  233. closeRightShow(){
  234. this.$refs.rightShowMore.close()
  235. },
  236. costChange(){
  237. this.closeRightShow()
  238. this.pageTo({url: '/admin/changePrice/costChangeList?id='+this.currentInfo.id})
  239. },
  240. priceChange(){
  241. this.closeRightShow()
  242. this.pageTo({url: '/admin/changePrice/changeList?id='+this.currentInfo.id})
  243. },
  244. varietyManage(){
  245. this.closeRightShow()
  246. this.pageTo({url: "/admin/item/xjSelect?itemId="+this.currentInfo.id})
  247. },
  248. copyCreate(){
  249. this.closeRightShow()
  250. this.pageTo({url: '/admin/item/copy?id='+this.currentInfo.id})
  251. },
  252. orderRecord(){
  253. this.closeRightShow()
  254. this.pageTo({url: "/admin/order/itemOrder?productId="+this.currentInfo.id})
  255. },
  256. preSell(){
  257. this.closeRightShow()
  258. this.pageTo({url: "/admin/item/presell?id="+this.currentInfo.id})
  259. },
  260. init(){
  261. },
  262. closeRightShow(){
  263. this.$refs.rightShowMore.close()
  264. },
  265. searchFn(){
  266. this.resetList()
  267. this.getSimpleData()
  268. },
  269. getSimpleData(){
  270. let that = this
  271. getSimleList({name:this.py,page: this.list.page}).then(res=>{
  272. this.completes(res)
  273. if (this.$util.isEmpty(res.data)){
  274. return false
  275. }
  276. })
  277. }
  278. }
  279. };
  280. </script>
  281. <style lang="scss" scoped>
  282. .ex-page {
  283. background: white;
  284. padding-top:20upx;
  285. height: 100%;
  286. display: flex;
  287. flex-direction: column;
  288. .input-wrap {
  289. display: flex;
  290. padding: 22upx 20upx 22upx 13upx;
  291. .search-bar {
  292. flex: 1;
  293. }
  294. .city-select {
  295. display: flex;
  296. flex-shrink: 0;
  297. align-items: center;
  298. margin-right: 15upx;
  299. margin-left: 45upx;
  300. background-color: #ffff;
  301. .iconfont {
  302. margin-left: 20upx;
  303. font-size: 30upx;
  304. }
  305. }
  306. }
  307. .top-bar {
  308. position: absolute;
  309. left: 0;
  310. display: flex;
  311. width: 100%;
  312. top:130upx;
  313. z-index: 20;
  314. .bar{
  315. width: 50%;
  316. height: 100%;
  317. text-align: center;
  318. &:nth-child(1){
  319. border-right: 1upx solid #eeeeec;
  320. }
  321. }
  322. }
  323. .main-view {
  324. margin-top:20upx;
  325. flex: 1;
  326. background-color: #f9fbfc;
  327. .space-view {
  328. background-color: #fff;
  329. }
  330. .ex-info {
  331. padding: 30upx;
  332. .info-cell {
  333. display: flex;
  334. align-items: center;
  335. font-size: 28upx;
  336. &:not(:first-child) {
  337. margin-top: 20upx;
  338. }
  339. .cell-label {
  340. width: 110upx;
  341. color: #666666;
  342. }
  343. .cell-value {
  344. margin-left: 40upx;
  345. color: #333;
  346. &.warning {
  347. color: #ffaf1d;
  348. }
  349. &.success {
  350. color: #27c325;
  351. }
  352. }
  353. }
  354. }
  355. .ex-table {
  356. ::v-deep.icon-info {
  357. color: #333333;
  358. }
  359. }
  360. }
  361. .bar-view {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. padding: 0 30upx;
  366. width: 100%;
  367. height: 100upx;
  368. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  369. .info-view {
  370. font-size: 26upx;
  371. }
  372. .btn-view {
  373. display: flex;
  374. .admin-button-com {
  375. margin: 0 10upx;
  376. }
  377. }
  378. }
  379. }
  380. </style>