index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <zj-page-layout :hasFooter="true">
  4. <view class="form-container">
  5. <view class="item">
  6. <view class="label"><text>*</text>客户电话</view>
  7. <u--input :maxlength="11" placeholder="请输入" border="none" inputAlign="right" v-model="userMobile"></u--input>
  8. </view>
  9. <view class="item">
  10. <view class="label"><text>*</text>工单单号</view>
  11. <u--input :readonly="hasOid" placeholder="请输入" border="none" inputAlign="right" v-model="orderNo"></u--input>
  12. </view>
  13. <view class="item" @tap="hasOid ? '' : (isShowWebsitDialog = true)">
  14. <view class="label"><text>*</text>所属网点</view>
  15. <view class="picker">
  16. <text class="value" v-if="websit">{{ websit.name }}</text>
  17. <text class="placeholder" v-else>请选择工单所属网点</text>
  18. <text class="iconfont icon-jinru"></text>
  19. </view>
  20. </view>
  21. <!-- ------------------------------------ -->
  22. <view v-for="(item, index) in rpMaterialOrderItemList" :key="index">
  23. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  24. <view class="item">
  25. <view class="label" style="font-weight: bold">配件信息{{ index + 1 }}</view>
  26. <view class="label" style="color: red; margin-right: 10rpx" @click="delpeijian(index)">删除</view>
  27. </view>
  28. <view class="item">
  29. <view class="label"><text>*</text>是否质量问题</view>
  30. <radio-group
  31. @change="
  32. d => {
  33. item.repairFlag = d.detail.value
  34. }
  35. "
  36. >
  37. <label style="margin-right: 20upx">
  38. <radio value="INNER" :checked="item.repairFlag === 'INNER'" />保内
  39. </label>
  40. <label> <radio value="OUTSIDE" :checked="item.repairFlag === 'OUTSIDE'" />保外 </label>
  41. </radio-group>
  42. </view>
  43. <view class="item">
  44. <view class="label"><text>*</text>旧配件编号</view>
  45. <u--input placeholder="请输入" border="none" inputAlign="right" v-model="item.oldPartsNumber"></u--input>
  46. </view>
  47. <view class="item">
  48. <view class="label"><text>*</text>旧配件名称</view>
  49. <u--input placeholder="请输入" border="none" inputAlign="right" v-model="item.oldPartsName"></u--input>
  50. </view>
  51. <view class="item" @tap="toChooseProduct(index)">
  52. <view class="label"><text>*</text>新配件名称</view>
  53. <view class="picker">
  54. <text class="value" v-if="item">{{ item.goodsName }}</text>
  55. <text class="placeholder" v-else>选择产品</text>
  56. <text class="iconfont icon-jinru"></text>
  57. </view>
  58. </view>
  59. <view class="item">
  60. <view class="label"><text>*</text>新配件编号</view>
  61. <u--input
  62. :disabled="true"
  63. :readonly="true"
  64. placeholder="请输入"
  65. border="none"
  66. inputAlign="right"
  67. v-model="item.goodsCode"
  68. ></u--input>
  69. </view>
  70. </view>
  71. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  72. <u-button class="btnloukong" text="添加配件" @click="addpeijian"></u-button>
  73. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  74. </view>
  75. <template slot="footer">
  76. <view class="footer-btn-group">
  77. <u-button
  78. text="历史记录"
  79. @click="$navToPage({ url: `/packageMaterial/pages/newSale/orderList?type=${type}` })"
  80. ></u-button>
  81. <u-button type="primary" text="提交" @click="submitData"></u-button>
  82. </view>
  83. </template>
  84. <zjDialogPicker
  85. ref="websitDialog"
  86. :isShow="isShowWebsitDialog"
  87. :multiple="false"
  88. :styleType="2"
  89. :title="'所属网点'"
  90. :list="websitList"
  91. :keyName="'name'"
  92. @cancel="isShowWebsitDialog = false"
  93. @confirm="confirmWebsitDialog"
  94. >
  95. </zjDialogPicker>
  96. </zj-page-layout>
  97. <!-- #endif -->
  98. <!-- #ifndef H5 -->
  99. <web-view
  100. :src="webViewHref(`/packageMaterial/pages/newSale/index`, pam, crossPagePam)"
  101. @message="crossPage.$listener"
  102. ></web-view>
  103. <!-- #endif -->
  104. </template>
  105. <script>
  106. // #ifdef H5
  107. import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
  108. export default {
  109. components: {
  110. zjDialogPicker
  111. },
  112. data() {
  113. return {
  114. hasOid: false,
  115. wbId: null, // 维保工单
  116. wbIsAllFee: null, // 维保工单是否包含全部费用
  117. wbPayType: null, // 维保工单费用支付方式
  118. type: 'M',
  119. userMobile: '',
  120. orderNo: '',
  121. salesType: 'OUT',
  122. brand: null,
  123. brandList: [],
  124. isShowBrandDialog: false,
  125. category: null,
  126. categoryList: [],
  127. isShowCategoryDialog: false,
  128. websit: null,
  129. websitList: [],
  130. isShowWebsitDialog: false,
  131. rpMaterialOrderItemList:[]
  132. }
  133. },
  134. onLoad({type, oid = ''}) {
  135. this.type = type;
  136. this.hasOid = oid.length > 0;
  137. uni.setNavigationBarTitle({
  138.  title: '配件收款'
  139. })
  140. this.getWebsitList(() => {
  141. if(this.hasOid) {
  142. this.$api.post('/pg/order/base/detail', {
  143. orderBaseId: oid,
  144. }).then((res) => {
  145. console.log(res.data)
  146. const data = res.data;
  147. this.orderNo = oid;
  148. this.userMobile = data.userMobile;
  149. this.websit = this.websitList.find(item => item.websitId == data.websitId) || {}
  150. if(data.pgOrderProducts && data.pgOrderProducts.length > 0) {
  151. this.brand = {
  152. id: data.pgOrderProducts[0].brandId,
  153. brandName: data.pgOrderProducts[0].brandName
  154. }
  155. }
  156. this.wbId = data.rpProjectRepairId || '';
  157. this.wbIsAllFee = data.isAllFee || '';
  158. this.wbPayType = data.feePayMethod || '';
  159. })
  160. }
  161. });
  162. },
  163. onShow() {
  164. var data = this.$getStorage('materialSaleData')
  165. if (data.dijiIndex !== undefined && this.rpMaterialOrderItemList[Number(data.dijiIndex)]) {
  166. this.rpMaterialOrderItemList.splice(Number(data.dijiIndex), 1, {
  167. ...this.rpMaterialOrderItemList[Number(data.dijiIndex)],
  168. "goodsAmount": data.goodsAmount,
  169. "goodsCode": data.goodsCode,
  170. "goodsId": data.goodsId,
  171. "goodsName": data.goodsName,
  172. "unit": data.goodsUnit,
  173. "num": data.num,
  174. })
  175. }
  176. this.$removeStorage('materialSaleData')
  177. },
  178. methods: {
  179. addpeijian() {
  180. this.rpMaterialOrderItemList.push({
  181. "goodsAmount": "",
  182. "goodsCode": "",
  183. "goodsId": "",
  184. "goodsName": "",
  185. "unit": "",
  186. "num": "",
  187. "oldPartsName": "",
  188. "oldPartsNumber": "",
  189. "repairFlag": "",
  190. })
  191. },
  192. delpeijian(index) {
  193. this.rpMaterialOrderItemList.splice(index, 1)
  194. },
  195. getWebsitList(cb) {
  196. this.$api.get('/user/apply/websit')
  197. .then(res => {
  198. this.websitList = res.data;
  199. if (this.websitList.length == 1) {
  200. this.websit = this.websitList[0]
  201. }
  202. cb?.()
  203. })
  204. },
  205. confirmWebsitDialog(e) {
  206. this.websit = this.websitList[e[0]];
  207. this.isShowWebsitDialog = false;
  208. },
  209. toChooseProduct(index) {
  210. if(!this.websit) return this.$toast('请选择所属网点');
  211. if(!this.userMobile) return this.$toast('请输入客户电话');
  212. if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
  213. this.$navToPage({
  214. url: `/packageMaterial/pages/newSale/product?dijiIndex=${index}&type=${this.type}&categoryId=${this.type=='P'?this?.category?.categoryId:''}&categoryName=${this.type=='P'?this?.category?.name:''}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&partsWebsitId=${this.websit.partsWebsitId}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
  215. })
  216. },
  217. submitData() {
  218. if (this.rpMaterialOrderItemList.length < 1) return this.$toast('请选择');
  219. if(!this.orderNo) return this.$toast('请填写工单号');
  220. this.$setStorage('materialSaleDataZhiFu', {
  221. type: this.type,
  222. categoryId: this.type == 'P' ? this?.category?.categoryId : '',
  223. categoryName: this.type == 'P' ? this?.category?.name : '',
  224. salesType: 'OUT',
  225. brandId: null,
  226. brandName: null,
  227. websitId: this.websit.websitId,
  228. websitName: this.websit.name,
  229. userMobile: this.userMobile,
  230. orderNo: this.orderNo,
  231. wbId: this.wbId,
  232. wbIsAllFee: this.wbIsAllFee,
  233. wbPayType: this.wbPayType,
  234. goodsList: this.rpMaterialOrderItemList
  235. });
  236. this.$navToPage({
  237. url: `/packageMaterial/pages/newSale/order`
  238. })
  239. },
  240. },
  241. }
  242. // #endif
  243. // #ifndef H5
  244. export default {
  245. data() {
  246. return {
  247. pam: {},
  248. }
  249. },
  250. onLoad(pam) {
  251. this.pam = pam;
  252. }
  253. }
  254. // #endif
  255. </script>
  256. <style lang="scss" scoped>
  257. .form-container {
  258. background: #ffffff;
  259. margin-top: 20rpx;
  260. border-top: 1px solid #f5f5f5;
  261. .btnloukong {
  262. height: 72rpx;
  263. border: 2rpx solid #005ef4;
  264. margin: 0;
  265. background: transparent;
  266. font-size: 28rpx;
  267. line-height: 72rpx;
  268. color: #0268fa;
  269. }
  270. .item {
  271. height: 108rpx;
  272. border-bottom: 1px solid #f5f5f5;
  273. display: flex;
  274. align-items: center;
  275. justify-content: space-between;
  276. padding: 0 20rpx;
  277. .label {
  278. margin-right: 30rpx;
  279. text {
  280. color: $error-color;
  281. }
  282. }
  283. .picker {
  284. .placeholder {
  285. color: $sec-font;
  286. }
  287. .iconfont {
  288. margin-left: 12rpx;
  289. color: $sec-font;
  290. }
  291. }
  292. ::v-deep .u-radio-group {
  293. flex: unset;
  294. .u-radio {
  295. margin-left: 50rpx;
  296. }
  297. }
  298. }
  299. }
  300. </style>