simple.vue 10 KB

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